

<style>
    .table thead tr >th{
        background-color: #4c0870;
        color:#fff;
    }
    .table thead tr th[class*='sorting_'] {
        color: #FFFFFF;
    }
    .bg-master-lighter {
        border:none;
        background-color:#fff;
        border-top:1px solid #ddd;
    }
    .select2-container .select2-choice {
        color:#000 !important;
        opacity: 1;
    }
    .wrong{
        border: 1px solid red !important;
    }
    .QuantityVal{

        text-align: center;
        border:none;
        background: #eee;
    }
    .hide {
        visibility: hidden;
    }
    #tableWithSearch .Hint{
        position: relative;
        font-size: 10px;
        font-weight: bold;
        height: 20px;
        line-height: 20px;
        bottom: -3px;
        right: -144px;
        color: rgb(153, 153, 153);
    }
</style>
<div class="container-fluid container-fixed-lg bg-white">
    <div class="panel panel-transparent">
        <div class="panel-heading">
            <div class="panel-title"> <?php print CommonLanguage::getMessage('Depot_Content') ?></div>
            <div id="UpdateStockSuccess" class="alert alert-success hidden"></div>
          

            <div class="clearfix"></div>
        </div>
        <div class="panel-body">
            <table class="table table-bordered demo-table-search" id="tableWithSearch" >
                <thead>
                    <tr>
                        <th class="text-center" style="width:5%" ><?php print CommonLanguage::getMessage('Code'); ?></th>
                        <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('Item'); ?></th>
                        <th class="text-center" style="width:5%" ><?php print CommonLanguage::getMessage('Quantity'); ?></th>
                        <!--<th class="text-center no-print" style="width:5%" ><?php print CommonLanguage::getMessage('Action'); ?></th>-->
                       
                    </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
<!--            suzan: note that we have hide this button using class "hide" for now, based on user request -->
            <?php if ($permissions->hasPermission('adjustStock')) { ?>
                <div class="container-sm-height">
                    <button class=" btn  btn-cons m-b-10 pull-right hide" id="AdjustStockSubmitButton" style="color:#fff;background-color:#ed9421 ;padding-top: 10px;top: 20px;min-width:253px;" type="button" ><i class="pg-form"></i> <span class="bold"><?php print CommonLanguage::getMessage('Adjust_Stock'); ?></span></button>
                </div>
            <?php } ?>
                    <button class=" btn  btn-cons m-b-10 pull-right " id="exportTable" style="color:#fff;background-color:#ed9421 ;padding-top: 10px;top: 20px;min-width:253px;" type="button" ><i class="pg-form"></i> <span class="bold"><?php print CommonLanguage::getMessage('export'); ?></span></button>

        </div>
    </div>
</div>





<script>
    var Failed_Submit = <?php echo json_encode(CommonLanguage::getMessage('Failed_Submit')); ?>,
            Submitted_Successfully = <?php echo json_encode(CommonLanguage::getMessage('Submitted_Successfully')); ?>,
            Action = <?php echo json_encode(CommonLanguage::getMessage('Action')); ?>,
            title = <?php echo json_encode(CommonLanguage::getMessage('Depot_Content')); ?>;
    var file_id = <?php echo json_encode($file_id);?>;
    $(function () {
        RebuildDataTable(title, [0, 1, 2], 'StockAjax/appAdjustment', {file_id:file_id});

//     $("#tableWithSearch").on("click",".update",function(){
//         var temp_id = $(this).attr("data-id"),
//            qty = $(this).parents("tr").find(".QuantityVal").val();
//            $.ajax({
//                url: "StockAjax/appAdjustmentAjax",
//                method: "POST",
//                data: {temp_id:temp_id,qty :qty},
//                complete: function (v1, v2) {
//                    if (v2 == "success" && v1.responseText == "OK") {
//                           RebuildDataTable(title, [0, 1, 2], 'StockAjax/appAdjustment', 1);
//                        $("#UpdateStockSuccess").attr("class", "alert alert-success").html(Submitted_Successfully)
//                       setTimeout(function(){
//                           $("#UpdateStockSuccess").hide()  
//                       },10000)
//          
//                    } else {
//                        $("#UpdateStockSuccess").attr("class", "alert alert-danger").html(Failed_Submit)
//                    }
//                }
//            })
//     })
     //exportAppAdjustment
     $("#exportTable").on("click",function(){
//          $.ajax({
//                url: "StockAjax/exportAppAdjustment",
//                method: "GET",
//                data: {id:file_id},
//                complete: function (v1, v2) {
//                    if (v2 == "success") {
//                        
//          
//                    } 
//                }
//            })
        $('#export_excel_iframe').remove();
        $("<iframe id='export_excel_iframe' src='StockAjax/exportAppAdjustment?id="+file_id+"'></iframe>").appendTo('body');
         
     })
//     $("#tableWithSearch").on("click",".update",function(){
//         var temp_id = $(this).attr("data-id"),
//            qty = $(this).parents("tr").find(".QuantityVal").val();
//            $.ajax({
//                url: "StockAjax/appAdjustmentAjax",
//                method: "POST",
//                data: {temp_id:temp_id,qty :qty},
//                complete: function (v1, v2) {
//                    if (v2 == "success" && v1.responseText == "OK") {
//                           RebuildDataTable(title, [0, 1, 2], 'StockAjax/appAdjustment', 1);
//                        $("#UpdateStockSuccess").attr("class", "alert alert-success").html(Submitted_Successfully)
//                       setTimeout(function(){
//                           $("#UpdateStockSuccess").hide()  
//                       },10000)
//          
//                    } else {
//                        $("#UpdateStockSuccess").attr("class", "alert alert-danger").html(Failed_Submit)
//                    }
//                }
//            })
//     })



    })


</script>

