<div class="container-fluid container-fixed-lg bg-white">
    <div class="panel panel-transparent">
        <div class="panel-heading">
            <div class="panel-title"> <?php print $title; ?></div>
        </div>
        <div class="panel-body">
            <div class="row form-group">
                <div class="col-md-4">
                    <label><?php echo CommonLanguage::getMessage('Date') ?></label>
                    <div class="input-group">
                        <span class="input-group-addon bg-primary"><i class="fa fa-calendar"></i></span>
                        <input id="invoice_from_to_date" type="text" class="form-control date_range_picker" name="invoice_from_to_date" autocomplete="off" >
                    </div>
                </div> 
                <div class="col-md-4">
                    <label><?php echo CommonLanguage::getMessage('pick_up_date') ?></label>
                    <div class="input-group">
                        <span class="input-group-addon bg-primary"><i class="fa fa-calendar"></i></span>
                        <input id="pick_up_from_to_date" type="text" class="form-control date_range_picker" name="pick_up_from_to_date" autocomplete="off" >
                    </div>
                </div>  
                <div class="col-md-4">
                    <label><?php echo CommonLanguage::getMessage('drop_off_date') ?></label>
                    <div class="input-group">
                        <span class="input-group-addon bg-primary"><i class="fa fa-calendar"></i></span>
                        <input id="drop_off_from_to_date" type="text" class="form-control date_range_picker" name="drop_off_from_to_date" autocomplete="off" >
                    </div>
                </div> 
            </div>
            <div class="row form-group">
                <div class="col-md-4">
                    <label><?php echo CommonLanguage::getMessage('choose_customer') ?></label>
                    <input id="customer_id" type="hidden" class="full-width" name="customer_id" >
                </div> 
                <div class="col-md-2 ">
                    <label><?php  echo CommonLanguage::getMessage('status');?></label>
                    <select name="shipping_status_id" id="shipping_status_id" class="full-width" data-init-plugin="select2">
                        <option value=""><?php  echo CommonLanguage::getMessage('All');?></option>
                        <?php  foreach($shipping_status as $value){?>
                        <option value="<?php  echo $value['shipping_status_id'];?>" <?php  echo  $value['shipping_status_id'] == 1 ? 'selected' : '';?> ><?php  echo $value['shipping_status_name'];?></option>
                        <?php }?>
                    </select>
                </div>
                <div class="col-md-4">
                    <label><?php echo CommonLanguage::getMessage('shipping_company_name') ?></label>
                    <input id="shipping_company_id" type="hidden" class="full-width " name="shipping_company_id" >
                </div> 
                <div class="col-md-2 ">
                    <label><?php  echo CommonLanguage::getMessage('status');?></label>
                    <select name="paid_type_id" id="paid_type_id" class="full-width" data-init-plugin="select2">
                        <option value=""><?php  echo CommonLanguage::getMessage('All');?></option>
                        <option value="1" checked><?php  echo CommonLanguage::getMessage('not_paid');?></option>
                        <option value="2"><?php  echo CommonLanguage::getMessage('paid');?></option>
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12 table-responsive">
                    <table class="table table-bordered inventory" id="tableWithSearch" >
                        <thead>
                            <tr>
                                <th class="text-center" style="width:5%" >
                                    <input type="checkbox" class="inv_check_all_td pull-left"/>#</th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('customer_name'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('Date'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('total'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('address'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('pick_up_date'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('drop_off_date'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('shipping_number'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('description'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('shipping_note'); ?></th>
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('status'); ?></th> 
                                <th class="text-center" style="width:15%" ><?php print CommonLanguage::getMessage('shipping_status'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td> <?php if ($permissions->hasPermission("ship_inv_multi_delete")) { ?>
                                    <button class="btn btn-primary m-b-10 full-width hidden" id="delete_multi_inv"><?php echo CommonLanguage::getMessage('Delete'); ?></button>
                                    <?php }?></td>
                                <td></td>
                                <td></td>
                                <td id="total_div"></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td class="tfoot_colspan">
                                    <button class="btn btn-primary m-b-10 hidden pull-right" id="request_pick_up_drop_off"><?php echo CommonLanguage::getMessage('request_pick_up_drop_off'); ?></button>
                                    <button class="btn btn-primary m-b-10 hidden pull-right" id="scheduled_private"><?php echo CommonLanguage::getMessage('scheuled'); ?></button>
                                    <button class="btn btn-primary m-b-10 hidden pull-right" id="delivered_private"><?php echo CommonLanguage::getMessage('delivered'); ?></button>
                                    <button class="btn btn-primary m-b-10 hidden pull-right" id="cancel_private"><?php echo CommonLanguage::getMessage('cancel'); ?></button>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
            <?php echo Forms::ModalLoader('shipping_loader'); ?>
        </div>
    </div>
</div>
<div class="modal fade" id="request_pick_up_drop_off_modal" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="pg-close fs-20"></i>
                </button>
                <h5 class="bold text-left"><?php print CommonLanguage::getMessage('request_pick_up_drop_off') ?></h5>
            </div>
            <div class="modal-body">
                <div class="row"><?php echo Forms::AlertDiv('request_alert'); ?></div>
                <form id="request_form">
                    <div class="row form-group m-t-10 fast_pax">
                        <label> <?php print CommonLanguage::getMessage('pick_up_date'); ?>
                            <span class="red-star">*</span></label>
                        <input type="text" name="pick_up_date" id="pick_up_date" class="form-control fast_pax_field" required/>
                    </div>
                    <div class="row form-group fast_pax">
                        <label> <?php print CommonLanguage::getMessage('drop_off_date'); ?>
                            <span class="red-star">*</span>
                        </label>
                        <input type="text" name="drop_off_date" id="drop_off_date"  class="form-control fast_pax_field" required/>
                    </div>
                    <div class="row form-group aramex">
                        <label> <?php print CommonLanguage::getMessage('pick_up_date'); ?>
                            <span class="red-star">*</span>
                        </label>
                        <input type="text" name="pick_up_due_date" id="pick_up_due_date"  class="form-control aramex_field" required/>
                    </div>
                    <div class="row form-group aramex">
                        <label> <?php print CommonLanguage::getMessage('From'); ?>
                            <span class="red-star">*</span>
                        </label>
                        <select name="from_location" id="from_location" class="full-width aramex_field" data-init-plugin="select2" required>
                            <option value="1">Megara</option>
                            <option value="2">Jouri</option>
                            <option value="3">K Boutique</option>
                            <option value="4">Lamaritta</option>
                        </select>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close') ?></button>
                <button type="button" class="btn btn-primary" id="submit_pick_up_drop_off"><?php print CommonLanguage::getMessage('Save') ?></button>
            </div>
            <?php echo Forms::ModalLoader('request_loader'); ?>
        </div>
    </div>
</div>
<div class="modal fade" id="schedule_modal" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="pg-close fs-20"></i>
                </button>
                <h5 class="bold text-left"><?php print CommonLanguage::getMessage('scheduled') ?></h5>
            </div>
            <div class="modal-body">
                <div class="row"><?php echo Forms::AlertDiv('schedule_alert'); ?></div>
                <form id="schedule_form">
                    <div class="row form-group m-t-10 ">
                        <label> <?php print CommonLanguage::getMessage('pick_up_date'); ?>
                            <span class="red-star">*</span></label>
                        <input type="text" name="pick_up_private_date" id="pick_up_private_date" class="form-control" required/>
                    </div>
                    <div class="row form-group ">
                        <label> <?php print CommonLanguage::getMessage('drop_off_date'); ?>
                            <span class="red-star">*</span>
                        </label>
                        <input type="text" name="drop_off_private_date" id="drop_off_private_date"  class="form-control" required/>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close') ?></button>
                <button type="button" class="btn btn-primary" id="submit_schedule"><?php print CommonLanguage::getMessage('Save') ?></button>
            </div>
            <?php echo Forms::ModalLoader('schedule_loader'); ?>
        </div>
    </div>
</div>
<div class="modal fade" id="confirm_delivered_modal" data-backdrop="static" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="pg-close fs-20"></i>
                </button>
                <h5 class=" text-left bold "><?php echo CommonLanguage::getMessage('confirm_delivered'); ?></h5>
            </div>
            <div class="modal-body">
                <div class="row"><?php echo Forms::AlertDiv('confirm_delivered_alert'); ?></div>
                <div class="row">
                    <div class="col-md-12 m-t-10 form-group">
                        <p><?php echo CommonLanguage::getMessage('Proceed_Delete'); ?></p>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close'); ?></button>
                <button class="btn bg-info-light text-white" id="submit_delivered_private"><?php print CommonLanguage::getMessage('Save'); ?>
                </button>
            </div>
            <?php echo Forms::ModalLoader('confirm_delivered_loader'); ?>
        </div>
    </div>
</div>
<script>
    var shipping_api=0,shipping_folder='',
        common_cancel_modal = <?php
        echo json_encode([CommonLanguage::getMessage('confirm_cancel'),
                          CommonLanguage::getMessage('about_to_cancel'),
                          CommonLanguage::getMessage('Proceed_Delete'),
                          CommonLanguage::getMessage('Close'),
                          CommonLanguage::getMessage('cancel'),
                          CommonLanguage::getMessage('Submitted_Successfully')
                         ]);
        ?>;
    $(function(){
        changeTable();
        build_select2($('#customer_id'), 'xhr/customerSearch');
        build_select2($("#shipping_company_id"), "xhr/searchShippingCompany");
        var table = $('#tableWithSearch').DataTable();
        table.on( 'draw.dt', function (e, settings) {
            var row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                var customer_id = $('input[name=shipping_address]', $(row[i])).attr('data-customer-id');
                build_select2($('input[name=shipping_address]', $(row[i])), 'xhr/searchShippingAddress?customer_id='+customer_id+'&api_folder='+shipping_folder);
            }
        });
        $('#tableWithSearch').on('change','input[name=shipping_address]',function(){
            var invoice_id = $(this).attr('data-invoice-id'),address_id= $(this).val();
            $('#shipping_loader').removeClass('hidden');
            $.ajax({
                url: "InventoryAjax/updateInvoiceShippingAddress",
                data: {Invoice_ID_Auto: invoice_id,address_id: address_id},
                dataType:"json",
                complete: function (jqXHR, v2) {
                    if (v2 == "success") {
                        if (jqXHR.responseJSON[1] == "success") {
                            toastr.success(jqXHR.responseJSON[0])
                        }else{
                            toastr.error(jqXHR.responseJSON[0])
                        }
                        $('#shipping_loader').addClass('hidden');
                    }
                }
            });

        });
        $("#tableWithSearch").on("click", "input.inv_check_all_td", function (e) {
            var is_checked = $(this).is(":checked");
            var row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                $(row[i]).find("input.inv_check_td").prop("checked", is_checked);
            }
        });
        $('#request_pick_up_drop_off').on('click',function(){
            var row = $("#tableWithSearch").dataTable().fnGetNodes(),is_address_empty = false;
            for (var i = 0; i < row.length; i++) {
                if(!$('input[name=shipping_address]', $(row[i])).val() && $("input.inv_check_td",$(row[i])).is(":checked"))
                    is_address_empty = true;
            }   
            if ($('input.inv_check_td:checked').length == 0) {
                toastr.error('<?php echo CommonLanguage::getMessage('choose_entry'); ?>')
                return;
            }   
            if(is_address_empty){
                toastr.error('<?php echo CommonLanguage::getMessage('choose_address_customer'); ?>')
                return; 
            }
            if(shipping_folder == 'fastpax'){
                $('.fast_pax').removeClass('hidden')
                $('.aramex').addClass('hidden')
                $('.fast_pax_field').attr('required',true)
                $('.aramex_field').attr('required',false)
            }else{
                $('.fast_pax').addClass('hidden')
                $('.aramex').removeClass('hidden')
                $('.fast_pax_field').attr('required',false)
                $('.aramex_field').attr('required',true)
            }
            $('#request_pick_up_drop_off_modal').modal('show');
            $('#drop_off_date,#pick_up_date,#pick_up_due_date').datepicker('setDate', new Date());
        });
        $('#pick_up_due_date').datepicker({autoclose:true,minDate:0});
        $('#drop_off_date,#pick_up_date').datepicker({autoclose:true,minDate:0});
        $('#pick_up_private_date,#drop_off_private_date').datepicker({autoclose:true,minDate:0});
        $('#submit_pick_up_drop_off').on('click',function(){
            if (!$("#request_form").valid())
                return;
            var Data = {invoices: [],pick_up_date:$('#pick_up_date').val(),
                        drop_off_date:$('#drop_off_date').val(),shipping_company_id:$('#shipping_company_id').val(),
                        pick_up_due_date:$('#pick_up_due_date').val(),from_location:$('#from_location').val()},
                row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                if ($(row[i]).find("input.inv_check_td").is(":checked")) {
                    Data.invoices.push($(row[i]).find('input.inv_check_td').attr("data-id"));
                }
            }
            if($('#pick_up_date').val() > $('#drop_off_date').val()){
                AddAlert("#request_alert", '<?php echo Commonlanguage::getMessage('dropOff_greater_pickUp');?>','danger');
                return;
            }
            $('#request_loader').removeClass('hidden');
            $.ajax({
                url: site_link+"shipping_api/"+shipping_folder+"/shipping_class.php",
                data: Data,
                method: "POST",
                dataType:"json",
                complete: function (v1, v2) {
                    if (v2 == "success") {
                        var response = v1.responseJSON;
                        if($.type(response == 'object')){
                            AddAlert("#request_alert",response['error_message'],response['error_type']);
                            if(response['error_type']=='success'){
                                changeTable();
                                hideModalAlert('request_pick_up_drop_off_modal');
                            }
                        }
                        $('#request_loader').addClass('hidden');
                    }
                }
            });
        });

        $('#cancel_private').on('click',function(){
            if ($('input.inv_check_td:checked').length == 0) {
                toastr.error('<?php echo CommonLanguage::getMessage('choose_entry'); ?>')
                return;
            }  
            var Data = {invoices: []},row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                if ($(row[i]).find("input.inv_check_td").is(":checked")) {
                    Data.invoices.push($(row[i]).find('input.inv_check_td').attr("data-id"));
                }
            }
            IncludeDeleteModal(common_cancel_modal, Data, function () {
                changeTable();
            }, "InventoryAjax/cancel_private_shipping");

        });
        $('#scheduled_private,#delivered_private').on('click',function(){
            if ($('input.inv_check_td:checked').length == 0) {
                toastr.error('<?php echo CommonLanguage::getMessage('choose_entry'); ?>')
                return;
            }  
            if($('#shipping_status_id').val() == 1){
                $('#schedule_modal').modal('show');
                $('#pick_up_private_date,#drop_off_private_date').datepicker('setDate', new Date());
            }else{
                $('#confirm_delivered_modal').modal('show')
            }

        });
        $('#submit_schedule').on('click',function(){
            if (!$("#schedule_form").valid())
                return;
            var Data = {invoices: [],pick_up_date:$('#pick_up_private_date').val(),
                        drop_off_date:$('#drop_off_private_date').val()},
                row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                if ($(row[i]).find("input.inv_check_td").is(":checked")) {
                    Data.invoices.push($(row[i]).find('input.inv_check_td').attr("data-id"));
                }
            }
            if($('#pick_up_private_date').val() > $('#drop_off_private_date').val()){
                AddAlert("#schedule_alert", '<?php echo Commonlanguage::getMessage('dropOff_greater_pickUp');?>','danger');
                return;
            }
            $('#schedule_loader').removeClass('hidden');
            $.ajax({
                url: "InventoryAjax/submit_schedule",
                data: Data,
                method: "POST",
                dataType:"json",
                complete: function (jqXHR, status) {
                    if (status == 'success') {
                        if (jqXHR.responseJSON[1] == "success") {
                            changeTable();
                            hideModalAlert('schedule_modal','schedule_alert');
                        }
                        AddAlert("#schedule_alert", jqXHR.responseJSON[0], jqXHR.responseJSON[1]);
                    }
                    $('#schedule_loader').addClass('hidden');
                }
            });
        }); 
        $('#submit_delivered_private').on('click',function(){
            var Data = {invoices: []},row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                if ($(row[i]).find("input.inv_check_td").is(":checked")) {
                    Data.invoices.push($(row[i]).find('input.inv_check_td').attr("data-id"));
                }
            }
            $('#confirm_delivered_loader').removeClass('hidden');
            $.ajax({
                url: "InventoryAjax/submit_delivery_private",
                data: Data,
                method: "POST",
                dataType:"json",
                complete: function (jqXHR, status) {
                    if (status == 'success') {
                        if (jqXHR.responseJSON[1] == "success") {
                            changeTable();
                            hideModalAlert('confirm_delivered_modal','confirm_delivered_alert');
                        }
                        AddAlert("#confirm_delivered_alert", jqXHR.responseJSON[0], jqXHR.responseJSON[1]);
                    }
                    $('#confirm_delivered_loader').addClass('hidden');
                }
            });
        });
        $('#customer_id,#shipping_status_id,#paid_type_id').on('change',function(){
            changeTable();
        });
        $("#shipping_company_id").on('change',function(){
            if($(this).val()){
                var response = $(this).select2('data');
                shipping_api = response.api_folder ? 1 : 0;
                shipping_folder = response.api_folder ? response.api_folder : '';
                changeTable();
            }else{
                shipping_api = 0;
                changeTable();
            }
        });
        $("input.date_range_picker").daterangepicker({
            ranges: {
                'Today': [moment(), moment()],
                'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                'This Month': [moment().startOf('month'), moment().endOf('month')],
                'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
            }, locale: {
                cancelLabel: 'Clear'
            }, allowEmpty: false,
            autoUpdateInput: false
        });
        $("input.date_range_picker").on('apply.daterangepicker', function (ev, picker) {
            var current_id = $(this).attr('id');
            if(current_id == 'invoice_from_to_date'){
                window.startDate = picker.startDate.format('YYYY-MM-DD');
                window.endDate = picker.endDate.format('YYYY-MM-DD');
            }else if(current_id == 'pick_up_from_to_date'){
                window.startPickUpDate = picker.startDate.format('YYYY-MM-DD');
                window.endPickUpDate = picker.endDate.format('YYYY-MM-DD');
            }else{
                window.startDropOffDate = picker.startDate.format('YYYY-MM-DD');
                window.endDropOffDate = picker.endDate.format('YYYY-MM-DD');
            }
            $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
            changeTable();
        });
        $("input.date_range_picker").on('cancel.daterangepicker', function (ev, picker) {
            var current_id = $(this).attr('id');
            if(current_id == 'invoice_from_to_date'){
                window.startDate = '';
                window.endDate = '';
            }else if(current_id == 'pick_up_from_to_date'){
                window.startPickUpDate = '';
                window.endPickUpDate = '';
            }else{
                window.startDropOffDate = '';
                window.endDropOffDate = '';
            }
            $(this).val('');
            changeTable();
        });
        $('#delete_multi_inv').on('click',function(){
            if ($('input.inv_check_td:checked').length == 0) {
                toastr.error('<?php echo CommonLanguage::getMessage('choose_entry'); ?>')
                return;
            }  
            var invoices = [],row = $("#tableWithSearch").dataTable().fnGetNodes();
            for (var i = 0; i < row.length; i++) {
                if ($(row[i]).find("input.inv_check_td").is(":checked")) {
                    invoices.push($(row[i]).find('input.inv_check_td').attr("data-id"));
                }
            }
            IncludeDeleteModal(common_delete_modal, {ids: invoices, is_purchase:0}, function () {
                changeTable();
            }, "InventoryAjax/delete_sales_invoice");
        });
    });
    function changeTable(){
        var Data = {
            shipping_company_id:$('#shipping_company_id').val(),
            customer_id:$('#customer_id').val(),
            shipping_status_id:$('#shipping_status_id').val(),
            paid_type_id:$('#paid_type_id').val(),
            drop_off_from_date: window.startDropOffDate,
            drop_off_to_date: window.endDropOffDate,
            pick_up_from_date: window.startPickUpDate,
            pick_up_to_date: window.endPickUpDate,
            from_date: window.startDate,
            to_date: window.endDate,
            shipping_api:shipping_api,
            shipping_folder:shipping_folder
        };
        (shipping_api == 1 && $('#shipping_status_id').val() == 1) ? $('#request_pick_up_drop_off').removeClass('hidden') : $('#request_pick_up_drop_off').addClass('hidden'); 
        if(shipping_api == 0 && $('#shipping_status_id').val() &&  $("#shipping_company_id").val()){
            if($('#shipping_status_id').val() == 1){
                $('#scheduled_private').removeClass('hidden');
                $('#delivered_private,#cancel_private').addClass('hidden');
            }else if($('#shipping_status_id').val() == 2){
                $('#scheduled_private').addClass('hidden');
                $('#delivered_private,#cancel_private').removeClass('hidden');
            }else{
                $('#scheduled_private,#delivered_private,#cancel_private').addClass('hidden'); 
            }
        }else{
            $('#scheduled_private,#delivered_private,#cancel_private').addClass('hidden'); 
        }
        ($('#shipping_status_id').val() == 8 || $('#shipping_status_id').val() == 4) ? $('#delete_multi_inv').removeClass('hidden') : $('#delete_multi_inv').addClass('hidden')
        $.ajax({
            url: "InventoryAjax/get_total_shippings",
            data: Data,
            complete: function (v1, v2) {
                if (v2 == "success") {
                    var optns = {
                        cb_ft: function (dt_optns) {
                            // stop sorting for column since on click on header checkbox the sorting is triggered
                            dt_optns.columnDefs.push({targets: [0], "orderable": false});
                        },
                    };
                    RebuildDataTable($('.panel-heading .panel-title').html(), [0], "InventoryAjax/shipping_list_ajax",Data,'','',optns);
                    $('#total_div').html(v1.responseText);
                }
            }
        });
    }
</script>