<div class="modal fade" id="enable-disable-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="add-label h-labels text-left bold hidden"><?php echo CommonLanguage::getMessage('confirm_enable'); ?></h5>
                <h5 class="edit-label h-labels text-left bold hidden"><?php echo CommonLanguage::getMessage('confirm_disable'); ?></h5>
            </div>
            <div class="modal-body">
                <div class="row"><?php echo Forms::AlertDiv('enable_disable_alert'); ?></div>
                <div class="row">
                    <input  type="hidden" id="target_item_id"/>
                    <input  type="hidden" id="target_item"/>
                    <input  type="hidden" id="target_item_value"/>
                    <input  type="hidden" id="current_status_id"/>
                    <div class="col-md-12 m-t-10 form-group">
                        <label class="about_enable_item hidden hide-close"><?php echo CommonLanguage::getMessage('about_enable_item'); ?></label>
                        <label class="about_disable_item hidden hide-close"><?php echo CommonLanguage::getMessage('about_disable_item'); ?></label>
                        <label><?php echo CommonLanguage::getMessage('Proceed_Delete'); ?></label>
                    </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_enable_disable"><?php print CommonLanguage::getMessage('Save'); ?></button>
            </div>
            <?php echo Forms::ModalLoader('enableDisableLoader'); ?>

        </div>
    </div>
</div>
<script>
    $(function(){
        $('#submit_enable_disable').on('click',function(){
            $("#enableDisableLoader").removeClass('hidden');
            $.ajax({
                url: "SettingsAjax/enableDisableItem",
                method: "POST",
                data: {target_item_id: $('#target_item_id').val(),target_item: $('#target_item').val(),
                       target_item_value:$('#target_item_value').val(),status_id:$('#current_status_id').val()},
                dataType: "JSON",
                complete: function (jqXHR, status) {
                    if (status == 'success') {
                        if (jqXHR.responseJSON[1] == "success") {
                            if($('#target_item_id').val() == 'Product_ID'){
                                RebuildDataTable(title, [0, 1, 2, 3], "InventoryAjax/listProductRequest",{Status_ID: $('#product_status').val(),category_id:$('#current_category_id').val(),show_zero_qty:$("#show_zero_qty").is(":checked") ? 1 : 0});
                            }else if($('#target_item_id').val() == 'Supplier_ID'){
                                RebuildDataTable(title, [0,1,2,3,4,5,6], 'InventoryAjax/CustomerListRequest',{IsVendor : true,status_id:$('#vendor_status').val()});
                            }else{
                                RebuildDataTable(title, [0,1,2,3,4,5,6], 'InventoryAjax/CustomerListRequest',{salesman_id:$('#salesman').val(),status_id:$('#customer_status').val(),customer_address:$("#customer_address").val()});
                            }
                            hideModalAlert('enable-disable-modal', 'enable_disable_alert');
                        }
                        AddAlert("#enable_disable_alert", jqXHR.responseJSON[0], jqXHR.responseJSON[1]);
                    }
                    $("#enableDisableLoader").addClass('hidden');
                }
            });
        });
    });
</script>