File manager - Edit - /home/autoph/public_html/data03252025consolidation/dist/js/nob/nob_crud.js
Back
var nature_id_selected = ""; // initializations $("input[data-bootstrap-switch]").each(function(){ $(this).bootstrapSwitch('state', $(this).prop('checked')); }); // $('#affiliation-status-checkbox').on('switchChange.bootstrapSwitch', function (e, data) { // affiliation_status = $('#affiliation-status-checkbox').bootstrapSwitch('state'); // }); $(function(){ $('#nature-status-checkbox').bootstrapSwitch('disabled', true); }); $('#details-nature-category').select2({ allowClear: false }); function refreshNatureList(){ $.ajax({ url:"app/nature_of_business/reload_nature.php", type:"POST", data: { type: 1 }, beforeSend: function(){ }, success: function(result) { $('#nature-list').html(''); $('#nature-list').append("\"" + result + "\""); }, }) } function delay(callback, ms) { var timer = 0; return function() { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } $('#submit-nature').on('click', function(){ var new_nature = $('#new-nature-name').val(); if(new_nature == ""){ toastr.remove(); toastr.error('NoB name field is empty'); return; } $.ajax({ url:"app/nature_of_business/add_nature.php", type:"POST", dataType: 'json', data: { new_nature: new_nature }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.error(result.message); } else if(result.status == 1){ toastr.remove(); toastr.success("New NoB added successfully"); $('#new-nature-name').val(""); $('#modal-add-nature').modal('hide'); refreshNatureList(); } }, }); }); $('#nature-list').on('change', function(){ nature_id_selected = $('#nature-list').val(); $.ajax({ url:"app/nature_of_business/reload_nature.php", type:"POST", dataType: 'json', data: { nature_id: nature_id_selected, type: 2 }, beforeSend: function(){ }, success: function(result) { // alert(result.category); $('#details-nature-name').val(result.name); $('#details-nature-category').val(parseInt(result.category)).trigger('change'); $('#details-nature-added-by').text(result.creator + "\n" + result.add_source); $('#details-nature-last-modified-by').text(result.last_modifier); $('#details-nature-date-added').text(result.date_added); $('#nature-status-checkbox').bootstrapSwitch('disabled', false); $('#nature-status-checkbox').bootstrapSwitch('state', result.status); }, }) }); $('#details-update-nature').on('click', function (){ var update_nature_name = $('#details-nature-name').val(); var update_nature_category = $('#details-nature-category').val(); var status = $('#nature-status-checkbox').bootstrapSwitch('state'); if(nature_id_selected == ""){ toastr.remove(); toastr.error("Please select NoB name to be modified first"); return; } if(update_nature_name == ""){ toastr.remove(); toastr.error("NoB name is empty"); return; } $.ajax({ url:"app/nature_of_business/update_nature_of_business.php", type:"POST", dataType: 'json', data: { nature_id: nature_id_selected, new_nature_name: update_nature_name, new_nature_category: update_nature_category, status: status }, beforeSend: function(){ }, success: function(result) { if(result.status == 0){ toastr.remove(); toastr.error("NoB already existing"); return; } if(result.status == 1){ // success update toastr.remove(); toastr.success("NoB name successfully updated"); refreshNatureList(); $('#details-nature-name').val(""); $('#details-nature-category').val(0).trigger('change'); $('#details-nature-added-by').text(""); $('#details-nature-date-added').text(""); $('#details-nature-last-modified-by').text(""); $('#nature-status-checkbox').bootstrapSwitch('disabled', true); return; } else if(result.status == 2) { // failed update toastr.remove(); toastr.error("There's something wrong in updating", "Update failed"); return; } }, }) }); $('#search-nature').on('keyup', delay(function (e){ var search_nature = $('#search-nature').val(); nature_id_selected = ""; $.ajax({ url:"app/nature_of_business/reload_nature.php", type:"POST", data: { type: 3, search_item: search_nature }, beforeSend: function(){ }, success: function(result){ $('#nature-list').html(''); $('#nature-list').append("\"" + result + "\""); } }); }, 500)); $('#close-modal').click(function(){ $('#modal-add-nature').modal('hide'); $('#new-nature-name').val(""); });
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings