File manager - Edit - /home/autoph/public_html/data03252025consolidation/dist/js/subscription/subscription.js
Back
// GLOBAL VARIABLES var company = 0; var dealer = 0; var message_type = ""; var delivery_type = ""; var reason = ""; var mask_contact = 1; $(function(){ initTableSubscription(); refreshSubscriptionTable(); addListenerCompanyFilter(); $('#dealer').attr('disabled', true); $('#span-company').text("ALL"); $('#span-dealer').text("ALL"); $('#span-other-all').attr('hidden', false); $('#span-other-message-type').attr('hidden', true); $('#span-other-delivery-type').attr('hidden', true); $('#span-other-reason').attr('hidden', true); }) function initTableSubscription() { var $table = $('#subscription-table') $table.bootstrapTable('destroy').bootstrapTable({ }) } function refreshSubscriptionTable() { var $table = $('#subscription-table') $(function() { $table.bootstrapTable('refresh', { // 1 url: 'app/table/subscription_table.php' }); }) } function queryParamsSubscriptionTable(params) { $('#span-company').text(company == 0 ? 'ALL' : $("#company-filter option:selected").text()); if(dealer == 0 || dealer == null) { $('#span-dealer').text("ALL"); } else { $('#span-dealer').text($("#dealer option:selected").text()); } if(message_type != "" || delivery_type != "" || reason != ""){ $('#span-other-all').attr('hidden', true); if(message_type != ""){ $('#span-other-message-type').attr('hidden', false); $('#span-other-message-type').text($('#message-type option:selected').text() + " ONLY | "); } else { $('#span-other-message-type').attr('hidden', true); } if(delivery_type != ""){ $('#span-other-delivery-type').attr('hidden', false); $('#span-other-delivery-type').text($('#delivery-type option:selected').text() + " ONLY | "); } else { $('#span-other-delivery-type').attr('hidden', true); } if(reason != ""){ $('#span-other-reason').attr('hidden', false); $('#span-other-reason').text($('#reason option:selected').text() + " ONLY | "); } else { $('#span-other-reason').attr('hidden', true); } } else { $('#span-other-filter').attr('hidden', false); } return { search: params.search, offset: params.offset, limit: params.limit, type: 1, company: company, dealer: dealer, message_type: message_type, delivery_type: delivery_type, mask_contact: mask_contact, reason: reason }; } function buttonsFunction() { return { grid_toggle_off: { 'icon': 'far fa-file-pdf', 'event': 'exportPdf', 'attributes': { 'id': 'download-pdf-bg', 'title': 'Export via PDF', 'text': 'PDF' } } // , // excel_export: { // 'icon': 'fa-file-excel', // 'event': 'exportXlsx', // 'attributes': { // 'id': 'download-excel-bg', // 'title': 'Download XLSX (Excel)', // 'data-test': 'test123' // } // } } } function exportPdf(){ if(generate_subscription_report == 0){ toastr.remove(); toastr.error("No access in generating report"); } else { window.open('print_subs_record.php?company=' + company + '&dealer='+ dealer + '&message_type='+ message_type + '&delivery_type=' + delivery_type + '&reason='+ reason + '&mask='+ mask_contact); } } function fillDealer(){ var comp = $('#company-filter').val(); $.ajax({ url:"app/misc/get_dealer3.php", type:"POST", data: { company: comp, type: 1 }, beforeSend: function(){ }, success: function(result){ $('#dealer').html(''); // $('#dealer').append("\"<option value=''>ALL</option>\""); $('#dealer').append("\"" + result + "\""); } }); } function addListenerCompanyFilter() { $('#company-filter').off('change.mychange').on('change.mychange', function() { company = $('#company-filter').val(); fillDealer(); $('#dealer').attr('disabled', false); refreshSubscriptionTable(); }); } $('#company-filter').select2({ placeholder: "Company", allowClear: true }) $('#dealer').select2({ placeholder: "Dealer", allowClear: true }) $('#message-type').select2({ placeholder: "Message Type", allowClear: true }) $('#delivery-type').select2({ placeholder: "Delivery Type", allowClear: true }) $('#reason').select2({ placeholder: "Reason", allowClear: true }) $('#btn-no-filter').on('click', function(){ $('#company-filter').off('change.mychange'); //off the company filter built in change event $('#company-filter').val('').trigger('change'); $('#dealer').off('change.mychange'); //off the company filter built in change event $('#dealer').val(0).trigger('change'); $('#dealer').html(''); company = 0; dealer = 0; message_type = ""; delivery_type = ""; reason = ""; refreshSubscriptionTable(); }) $('#chkMasked').on('click', function(){ if(mask_contact == 0){ mask_contact = 1; } else { mask_contact = 0; } refreshSubscriptionTable(); }) // $('#company-filter').on('change', function(){ // company = $('#company-filter').val(); // fillDealer(); // $('#dealer').attr('disabled', false); // if($('#company-filter').val() == ""){ // $('#dealer').attr('disabled', true); // } // refreshSubscriptionTable(); // }) $('#company-filter').on('select2:unselecting', function(event){ $('#dealer').attr('disabled', true); company = 0; dealer = 0; refreshSubscriptionTable(); }) $('#dealer').on('change', function(){ dealer = $('#dealer').val(); refreshSubscriptionTable(); }) $('#dealer').on('select2:unselecting', function(event){ dealer = 0; refreshSubscriptionTable(); }) $('#message-type').on('select2:unselecting', function(event){ $('#span-other-message-type').attr('hidden', true); message_type = ""; if(message_type == "" && delivery_type == "" && reason == ""){ $('#span-other-all').attr('hidden', false); } }) $('#delivery-type').on('select2:unselecting', function(event){ $('#span-other-delivery-type').attr('hidden', true); delivery_type = ""; if(message_type == "" && delivery_type == "" && reason == ""){ $('#span-other-all').attr('hidden', false); } }) $('#reason').on('select2:unselecting', function(event){ $('#span-other-reason').attr('hidden', true); reason = ""; if(message_type == "" && delivery_type == "" && reason == ""){ $('#span-other-all').attr('hidden', false); } }) $('#delivery-type').on('change', function(){ delivery_type = $('#delivery-type').val() refreshSubscriptionTable(); }) $('#message-type').on('change', function(){ message_type = $('#message-type').val(); refreshSubscriptionTable(); }) $('#reason').on('change', function(){ reason = $('#reason').val(); refreshSubscriptionTable(); }) document.getElementById("dropdown-filter").addEventListener('click', function(event) { event.stopPropagation(); }); $('#subscription-table').on('click-cell.bs.table', function(field, value, row, $el) { var customer_id = $el.customer_id; window.location.href = "customer_view.php?q=" + customer_id; });
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings