File manager - Edit - /home/autoph/public_html/data03252025consolidation/lms/resources/views/common/scripts/masterfile.js
Back
//MASTER FILE///////////////////////////////////////////////////////////////////////////////////////////////////// function init_masterfile_page() { init_header(); if (side_menu_loaded) { init_masterfile(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_masterfile(); }); } } var init_masterfile = function() { return $.ajax({ url: "resources/views/masterfile.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'Masterfile'; $('#center_content').html(data); add_content_close_listener('center_content'); $('#master_add_company').on('click', function() { if(!global_menu_access.includes(2)){ return false; } $.when(init_company_modal()).done(function(ajax1Results) { $('#company_modal').modal('show'); $('#company_modal').on('hidden.bs.modal', function() { $('#company_modal').remove(); }); var selected_tab = 1; $('#txt_company_code').focus(); $('#company-modal-company-tab').on('click', function() { selected_tab = 1; }); $('#company-modal-dealer-tab').on('click', function() { selected_tab = 2; }); $("#dd_dealer_company").select2({ // tags:true, // multiple: true, placeholder: "Select company", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/company.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'company_list', api: true, search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); $('#btn_company_save').on('click', function() { if (parseInt(selected_tab) === 1) { if (check_if_empty_field($('#txt_company_code'), 'Code is required.')) { return; } if (check_if_empty_field($('#txt_company_name'), 'Name is required.')) { return; } var $element = $("[json-company-modal]"); var json_data = generate_json('json-company-modal', $element); return $.ajax({ url: "app/models/company.php", data: { model: 'add', json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_company_save').prop( 'disabled', true); toastr.remove(); toastr.info("Adding..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result .message); refreshMasterfileTable(); $('#company_modal').modal( 'hide'); $('#company_modal') .remove(); } else { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (parseInt(selected_tab) === 2) { if (check_if_empty_field($('#dd_dealer_company'), 'Dealer company is required.')) { return; } if (check_if_empty_field($('#txt_dealer_code'), 'Code is required.')) { return; } if (check_if_empty_field($('#txt_dealer_name'), 'Name is required.')) { return; } var $element = $("[json-dealer-modal]"); var json_data = generate_json('json-dealer-modal', $element); return $.ajax({ url: "app/models/dealer.php", data: { model: 'add', json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_company_save').prop( 'disabled', true); toastr.remove(); toastr.info("Adding..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result .message); $('#company_modal').modal( 'hide'); $('#company_modal') .remove(); } else { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } }); }); }); refreshMasterfileTable(); $('#table_masterfile').on('click-cell.bs.table', function(field, row, value, $el) { if (row != "remove") { selected_company = $el.id; init_leadfile_page(); // init_groupfile_page(); } }); accessManagement(2); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_company_modal() { return $.ajax({ url: "resources/views/modals/company_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function initMasterfileList() { var $table = $('#table_masterfile'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() { $('.masterfile_action_remove').hide(); accessManagement(2) // if(!global_menu_access.includes(2)){ // $('.masterfile_action_remove').hide(); // }else{ // $('.masterfile_action_remove').show(); // } }, exportOptions: { fileName: function() { return 'titile' } } }); } function refreshMasterfileTable() { initMasterfileList(); var $table = $('#table_masterfile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/company.php' }); }) } function masterFileQueryParams(params) { return { search: params.search, offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, model: 'company_table', }; } function removeCompanyFormatter(value, row, index) { return '<i class="fa-times fa fa-times text-danger cursor-pointer" aria-hidden="true"></i>'; } window.removeCompanyEvent = { 'click i': function(e, value, row, index) { if(!global_menu_access.includes(2)){ return false; } Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this company?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { $.ajax({ url: "app/models/company.php", method: "POST", dataType: 'json', data: { model: 'remove', id: row.id }, beforeSend: function() { toastr.remove(); toastr.info('Removing...') }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); refreshMasterfileTable(); } else { toastr.remove(); toastr.error(result.message); } } }); } else if (result.isDenied) {} else {} }) } }; //MASTER FILE/////////////////////////////////////////////////////////////////////////////////////////////////////
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings