PATH:
home
/
lab2454c
/
costbloc.com
/
public
/
dist
/
js
/
custom
'use strict'; // Filter $('#dataTableBuilder_length').addClass('p-0'); $('#dataTableBuilder').removeAttr('style'); $(document).on('click', '.filterbtn', function(){ $(this).toggleClass('btn-primary btn-outline-primary'); }); $(document).on('change', '.filter', function() { var urlQuery = '?'; $('.filter').each(function(){ urlQuery += $(this).attr('name') + '=' + $(this).val() + '&'; }); $(`#dataTableBuilder`).DataTable().ajax.url(urlQuery).load(); }); // Batch Delete const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; function generateString(length) { let result = ''; const charactersLength = characters.length; for (let i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } function headerCheckBox() { $('.need-batch-operation').find('table thead tr').prepend(` <th class="batch-header" width="5"> <input type="checkbox" id="header_checkbox" class="header-checkbox"> </th> `) } function bodyCheckBox() { let id = ''; let value = 0; $('.need-batch-operation').find('table tbody tr').each((k, v) => { id = generateString(10); value = $(v).find('.confirm-delete').attr('data-id'); $(v).prepend(` <td class="batch-body"> <div class="checkbox checkbox-warning d-block me-0 p-0"> <input class="body-checkbox" type="checkbox" id="${id}" value="${value}"> <label class="cr" for="${id}"></label> </div> </td> `) }) } function tableContent() { if ($('.need-batch-operation').find('table tbody tr td').length <= 1) { $('.batch-header').remove(); return false; } if ($('.need-batch-operation').find('table thead tr .batch-header').length == 0) { headerCheckBox() } else { needCheckHeader(false); } if ($('.need-batch-operation').find('table tbody tr .batch-body').length == 0) { bodyCheckBox(); } else { needCheckBody(false); } }; function needCheckBody(checked = true) { $('.need-batch-operation').find('table tbody tr .batch-body input').prop('checked', checked); } function needCheckHeader(checked = true) { $('.batch-header input').prop('checked', checked); } function checkCount() { return $('.batch-body input:checked').length; } function hideBatchDeleteButton() { $('.batch-delete-count').closest('a').addClass('d-none'); } function showBatchDeleteButton() { $('.batch-delete-count').closest('a').removeClass('d-none'); } function batchOperation() { $('.batch-delete-count').text(checkCount()); checkCount() ? showBatchDeleteButton() : hideBatchDeleteButton(); } $(document).ajaxComplete(function(event, xhr, settings) { if (settings.url.split('?')[0] == '' || window.location.href.split('?')[0] == settings.url.split('?')[0]) { tableContent() hideBatchDeleteButton() } }); $(document).on('change', '.batch-header input', function() { needCheckBody(this.checked); batchOperation() }); $(document).on('change', '.batch-body input', function () { needCheckHeader($('.batch-body').length == checkCount()); batchOperation() }); $(document).on('click', '.batch-delete-operation', function () { var records = []; $(this).text(jsLang('Deleting')).append(`<div class="spinner-border spinner-border-sm ml-2"></div>`).addClass('disabled-btn'); $('.batch-body input:checked').each((k, v) => { if ($(v).val() != 'undefined') { records.push($(v).val()) } }) $.ajax({ url: ADMIN_SITE_URL + '/batch/delete', type: 'POST', dataType: "json", data: { _token: token, records: records, namespace: $('.need-batch-operation').attr('data-namespace'), column: $('.need-batch-operation').attr('data-column'), }, success: function (data) { if (data.status == 'success') { $(`#dataTableBuilder`).DataTable().ajax.reload(null, false); $('.top-notification').removeClass('d-none').find('.alert').addClass('alert-success').removeClass('alert-danger').find('.alertText').text(data.message); } else { $('.top-notification').removeClass('d-none').find('.alert').addClass('alert-danger').removeClass('alert-success').find('.alertText').text(data.message); } $('.top-notification').siblings('.noti-alert').remove(); }, error: function (xhr, status, error) { $('.failed-notification').removeClass('d-none').find('.alertText').text(error); }, complete: function () { $('.batch-delete-operation').text(jsLang('Yes, Confirm')).removeClass('disabled-btn').find('.spinner-border').remove(); bootstrap.Modal.getOrCreateInstance(document.getElementById('batchDelete')).hide(); } }); }) function updateDataTableTranslations() { $('#dataTableBuilder_previous').html(jsLang('Previous')); $('#dataTableBuilder_next').html(jsLang('Next')); $('.dataTables_empty').eq(0).html(jsLang('No data available in table')); $('#btnGroupDrop1').html(jsLang('Export')); let info = $('#dataTableBuilder_info').html(); if (info) { let infoNumbers = info.match(/[\d\.]+/g); info = `${jsLang('Showing')} ${infoNumbers[0]} ${jsLang('to')} ${infoNumbers[1]} ${jsLang('of')} ${infoNumbers[2]} ${jsLang('entries')}`; $('#dataTableBuilder_info').html(info); } } $(() => { $('#dataTableBuilder') .on('draw.dt', () => updateDataTableTranslations()); })
[-] create-product.min.js
[edit]
[-] refund.js
[edit]
[-] shops.js
[edit]
[-] commission.min.js
[edit]
[-] user.min.js
[edit]
[-] installer.js
[edit]
[-] category.min.js
[edit]
[+]
site
[-] jquery.blockUI.js
[edit]
[-] category.js
[edit]
[-] create-product.js
[edit]
[-] refund.min.js
[edit]
[+]
..
[-] shipping.min.js
[edit]
[-] user.js
[edit]
[-] jquery.blockUI.min.js
[edit]
[-] option.min.js
[edit]
[-] users-activity-list.js
[edit]
[-] attribute.min.js
[edit]
[-] email-configuration.min.js
[edit]
[-] dashboard.js
[edit]
[-] order.min.js
[edit]
[-] delete-modal.js
[edit]
[-] withdrawal.js
[edit]
[-] product-setting.js
[edit]
[-] validation.js
[edit]
[-] vendors.min.js
[edit]
[-] shops.min.js
[edit]
[-] roles.js
[edit]
[-] review.js
[edit]
[-] common.min.js
[edit]
[-] geolocale-suggestion.min.js
[edit]
[-] custom-category.js
[edit]
[-] product.js
[edit]
[-] order-invoice.min.js
[edit]
[-] common.js
[edit]
[-] product_list.js
[edit]
[-] settings.js
[edit]
[-] permission.min.js
[edit]
[-] coupon.js
[edit]
[-] export.js
[edit]
[-] yajra-custom.min.js
[edit]
[-] users-activity-list.min.js
[edit]
[-] finance.min.js
[edit]
[-] geolocale-suggestion.js
[edit]
[-] option.js
[edit]
[-] newsletter.min.js
[edit]
[-] order.js
[edit]
[-] role-permission.js
[edit]
[-] brand.min.js
[edit]
[-] transaction.js
[edit]
[-] popup.min.js
[edit]
[-] validation.min.js
[edit]
[-] templates.min.js
[edit]
[-] attribute.js
[edit]
[-] brand.js
[edit]
[-] app-layout.js
[edit]
[-] preference.js
[edit]
[-] invoice.js
[edit]
[-] order-invoice.js
[edit]
[-] yajra-export.js
[edit]
[-] product-setting.min.js
[edit]
[-] yajra-custom.js
[edit]
[-] installer.min.js
[edit]
[-] invoice.min.js
[edit]
[-] product_list.min.js
[edit]
[-] email-configuration.js
[edit]
[-] custom-category.min.js
[edit]
[-] settings.min.js
[edit]
[-] yajra-export.min.js
[edit]
[-] withdrawal.min.js
[edit]
[-] payment.js
[edit]
[-] preference.min.js
[edit]
[-] roles.min.js
[edit]
[-] finance.js
[edit]
[-] app-layout.min.js
[edit]
[-] permission.js
[edit]
[-] transaction.min.js
[edit]
[-] popup.js
[edit]
[-] order_status.min.js
[edit]
[-] commission.js
[edit]
[-] coupon.min.js
[edit]
[-] shipping.js
[edit]
[-] review.min.js
[edit]
[-] templates.js
[edit]
[-] delete-modal.min.js
[edit]
[-] vendors.js
[edit]
[-] order_status.js
[edit]
[-] dashboard.min.js
[edit]
[-] newsletter.js
[edit]
[-] product.min.js
[edit]
[-] export.min.js
[edit]