coderaiser / minify

Minifier of js, css, html and img
https://coderaiser.github.io/minify
MIT License
229 stars 29 forks source link

Minification error `minify@10.5.2` doesn't respect double quotes and convert it all to single quotes #117

Closed nadyshalaby closed 12 months ago

nadyshalaby commented 1 year ago

I use minify as a command line tool to minify all of my js/css files using vscode built-in file watcher.

Senario:

I have js file and i want to minify it on file change by running this command minify /path/to/app/assets/js/ajaxdata-processor.js > /path/to/app/assets/js/ajaxdata-processor.min.js

OS

Expected Behaviour

Actual Result

I got this error when i used 10.5.2 version but when i downgraded to 9.2.0 it worked fine.

[onFileChange] for pattern "(?<!\.min)\.(js|css)$" started
[cmd] minify /path/to/app/assets/js/ajaxdata-processor.js > /path/to/app/assets/js/ajaxdata-processor.min.js
[error] Error: ☝️ Looks like template values not linked: ["__a","__b","__c"] -> ["__"]
    at validateTemplateValues (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:1252010 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A1252010))
    at fix$8 (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:1251024 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A1251024))
    at file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:1251187 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A1251187)
    at tryCatch$5 (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:876534 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A876534))
    at tryToFix (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:897054 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A897054))
    at runFix$2 (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:897305 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A897305))
    at push (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:1232402 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A1232402))
    at file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:1233652 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A1233652)
    at tryCatch$5 (file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:876534 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A876534))
    at file:///Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/@putout/minify/bundle/minify.min.js:1:1256969 (file:///e%3A/Users/nadyshalaby/.nvm/versions/node/v19.6.0/lib/node_modules/minify/node_modules/%40putout/minify/bundle/minify.min.js#1%3A1256969) {
  loc: { line: 1129, column: 16 },
  rule: 'minify/convert-if-to-logical'
}

[onFileChange] for pattern "(?<!\.min)\.(js|css)$" finished
coderaiser commented 1 year ago

Could you please share the code which breaks Minify?

nadyshalaby commented 1 year ago
Code Example ```js var baseurl = document.getElementById('baseurl').getAttribute('data-url'); var isRtls = $('html').attr('dir'); var lg = document.documentElement.lang || 'ar'; if (lg === 'ar') { var sele = 'أختر'; $('.bootbox-cancel').html('إلغاء'); var del_msg_ = "هل أنت متأكد من متابعة عملية الحذف؟"; var imgcount__ = "عذرًا ، تجاوز عدد صور التحميل الحد المسموح به وهو 20 صور لكل مركبة!"; var manag_u_pass__ = "تم تعيين كلمة مرور المستخدم بنجاح"; } else if (lg === 'en') { var sele = 'Select'; $('.bootbox-cancel').html('Cancel'); var del_msg_ = "Are you sure to continue with the deletion process?"; var imgcount__ = "Sorry, the number of upload photos exceeded the allowed limit of 20 per vehicle!"; var manag_u_pass__ = "The user password was set successfully"; } else if (lg === 'hi') { var sele = 'चुनें'; $('.bootbox-cancel').html('रद्द करना'); var del_msg_ = "क्या आप वाकई हटाने के प्रक्रिया के साथ जारी रखना चाहते हैं?"; var imgcount__ = "क्षमा करें, अपलोड फोटो की संख्या अनुमत सीमा 20 प्रति वाहन को पार कर गई!"; var manag_u_pass__ = "उपयोगकर्ता पासवर्ड सफलतापूर्वक सेट किया गया था"; } $(function () { function boot_alert(msg) { bootbox.alert({ message: msg, className: 'bootbox-sm', callback: function () { // alert('Hello world callback'); }, }); } $('#change-user-self-password-form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-pws')); var data = $(this).serialize(); l.start(); var me = $(this); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); $(':input:not([type=hidden])').val(''); $('#modals-change-user-password').modal('hide'); showSwal('success', '', '') } else if (response.stu === 'error') { l.stop() showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#add_client_form_mini').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-565')); var tag = $("#tag").val(); var data = $(this).serialize(); l.start(); var me = $(this); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); $(':input:not([type=hidden])').val(''); $('#modal_add_new_client_g').modal('hide'); var o = new Option(response.txt, response.id); $(o).html(response.txt); $('.select-option-client').append(o); $(o).prop('selected', true); } else if (response.stu === 'found') { l.stop(); $('.alert_form').show(); $('.alert_form_text').html(response.msg); } else if (response.stu === 'error') { l.stop() showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#add_new_client_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-65746')); var tag = $("#tag").val(); var data = $(this).serialize(); l.start(); var me = $(this); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); $(':input:not([type=hidden])').val(''); $('textarea').val(''); var tot = parseInt($('.show_total_').html()); $('.show_total_').html(tot + 1); $('#modal_add_new_client').modal('hide'); $('#dt-clients').DataTable().ajax.reload(); showSwal('success', '', ''); } else if (response.stu === 'error') { l.stop() showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#verify_client').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-very')); //Ladda.bind('.ladda-button'); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); //$('#check_entry_card').addClass("scale-down-center "); // $("#load_cars_data").html('
Loading...
'); $('#load_cars_data').load(baseurl + 'load-cars-data.php?id=' + response.id + '&lg=' + lg + '&mo=' + response.mo, 'f' + Math.random() * 1000000,); $('#clientid746574').val(response.id); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#select_model_first').on("change", function (e) { var id = $(this).val(); var sd = $('.selected_model').attr('data-info'); $('.select-option-' + sd).find('option').remove(); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'select-model.php', data: {id: id}, // dataType: 'json', shouldRetry: 3, success: function (response) { $('.select-option-' + sd).append(response); }, }); }); $('.add_general_data_form').submit(function (e) { var lb = $('#actid').val(); var prt = $('#model_parent').val(); var l = Ladda.create(document.querySelector('.ladda-button-gt')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); if (!response.rso) { $(".removOption option").remove(); } $('.modal_add_new_general_data').modal('hide'); $('.gt-title').val(''); var o = new Option(response.txt, response.id); $(o).html(response.txt); $('.select-option-' + lb).append(o); $(o).prop('selected', true); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('.add_general_data_form2').submit(function (e) { var lb = $('#lb-x').val(); var l = Ladda.create(document.querySelector('.ladda-button-' + lb)); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); $('.modal_add_new_general_data2').modal('hide'); $('.gt-title').val(''); var o = new Option(response.txt, response.id); $(o).html(response.txt); $('.select-option-' + lb).append(o); $(o).prop('selected', true); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#add_new_user_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-001')); //Ladda.bind('.ladda-button'); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); window.location.href = baseurl + lg + "/settings/users/" + response.id; } else if (response.stu === 'error') { l.stop() showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#insert_new_car_data_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-94856')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); window.location.href = baseurl + lg + "/vehicles/"; } else if (response.stu === 'error') { l.stop() showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#insert_new_employee_mini').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-emp')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); $('#modal_add_new_employee').modal('hide'); var o = new Option(response.txt, response.id); $(o).html(response.txt); $(o).attr("data-foo", response.mob); $(o).attr("data-id", response.eml); $(o).attr("data-info", response.txt); $('.select-option-user').append(o); $(o).prop('selected', true); $('#email').val(response.eml); $('#emp_name').val(response.txt); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#add_new_car_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-ancf')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); window.location.href = baseurl + lg + "/inspections/create-65746/" + response.id; } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#insert_new_inspect_card_data_form').submit(function (e) { e.preventDefault(); function createInspection(confirmed) { var l = Ladda.create(document.querySelector('.ladda-button-ncx')); var me = $(this); var data = new FormData(this); data.append('send_welcome_message', confirmed); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, contentType: false, cache: false, processData: false, success: function (response) { if (response.stu === 'success') { l.stop(); showSwal('success', '', ''); window.location.href = baseurl + lg + "/inspections/view/" + response.id; } else if (response.stu === 'error') { l.stop(); showSwal('success', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); } var vm = this; bootbox.confirm({ message: __("Do you want to send a welcome message to this client?"), className: 'bootbox-sm', locale: lg, callback: function (confirmed) { createInspection.call(vm, confirmed); }, }); }); $('#edit_currnt_employee_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-edt-emp')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop() showSwal('success', '', ''); window.location.href = baseurl + lg + "/employees"; } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#insert_new_part_data_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-94756')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop() if (window.opener) { window.opener.postMessage({ type: "item-created", item: response.item, }); window.close(); } else { window.location.href = baseurl + lg + "/inventory"; } } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#change-user-manager-password-form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-765')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop() $("#modals-change-user-password").modal("hide"); showSwal('success', manag_u_pass__, ''); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#insert_new_employee_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-new-emp')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop() window.location.href = baseurl + lg + "/employees"; } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#delete_employee_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-del')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); var result = confirm(del_msg_); if (result) { e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); $("#modals-delete-employee").modal("hide"); showSwal('success', '', ''); setTimeout(function () { window.location.href = baseurl + lg + "/employees"; }, 1400); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); //Logic to delete the item } else { l.stop(); $("#modals-delete-employee").modal("hide"); return false; } }); $(".calcu_vat_on_the_air").keyup(function (e) { $(".with_vat").html('Loading..'); var val = $(this).val(); var tok = $('#token').val(); var lg = $('#lg').val(); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: {val: val, token: tok, lg: lg, switchr: "calculate_vat"}, dataType: 'json', shouldRetry: 3, success: function (response) { $(".with_vat").html(response.withvat); } }); }); $('#send_ticket_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-7632')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'data-processing.php', data: data, dataType: 'json', // shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); showSwal('success', '', ''); $(':input:not([type=hidden])').val(''); $('textarea').val(''); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#update-vat-submit').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button')); var me = $(this); var data = $(this).serialize(); l.start(); if (me.data('requestRunning')) { return } me.data('requestRunning', true); e.preventDefault(); $.ajax({ type: 'POST', url: baseurl + 'edit-data.php', data: data, dataType: 'json', shouldRetry: 3, success: function (response) { if (response.stu === 'success') { l.stop(); showSwal('success', '', ''); } else if (response.stu === 'error') { l.stop(); showSwal('error', response.msg, ''); } }, complete: function () { me.data('requestRunning', false); }, }); }); $('#logo_file').change(function (e) { var l = Ladda.create(document.querySelector('.ladda-button')); formdata = new FormData(); if ($(this).prop('files').length > 0) { var file = $(this).prop('files')[0]; formdata.append('logo', file); } l.start(); e.preventDefault(); $.ajax({ url: baseurl + 'source/upload_logo.php', type: 'POST', data: formdata, cache: false, dataType: 'json', processData: false, contentType: false, success: function (result) { if (result.stu == 'success') { l.stop(); $('.acc_logo').attr('src', baseurl + 'logos/' + result.img); $('#company_logo').attr('src', baseurl + 'logos/' + result.img); } else if (result.stu == 'type-error') { l.stop(); showSwal('error', imgtype__, ''); } else if (result.stu == 'size-error') { l.stop(); showSwal('error', imgsize__, ''); } }, }); }); $('#files').change(function (e) { var cid = $('#car_id').val(); var l = Ladda.create(document.querySelector('.ladda-button-fto')); var form_data = new FormData(); var totalfiles = document.getElementById('files').files.length; for (var index = 0; index < totalfiles; index++) { form_data.append('files[]', document.getElementById('files').files[index]); } form_data.append('carid', cid); l.start(); e.preventDefault(); $.ajax({ url: baseurl + 'source/upload-client-photo.php', type: 'POST', data: form_data, cache: false, dataType: 'json', processData: false, contentType: false, success: function (response) { if (response.stu === 'errtype') { l.stop(); showSwal('error', imgtype__, '') } else if (response.stu === 'errsize') { l.stop(); showSwal('error', imgsize__, '') } else if (response.stu === 'errcount') { l.stop(); showSwal('error', imgcount__, '') } else { l.stop(); $('.alert').hide(); for (var index = 0; index < response.length; index++) { var src = baseurl + 'dropezone/' + response[index]; var vsrc = getImgName(src); var idinfo = response[index].match(/\d+/); $('#img-preview').append( '
', ); } } }, }); }); $(".action-menu").on("click", ".chage-stu-onclick", function (e) { var element = this; var ins_id = $(this).attr("data-id"); var stu_id = $(this).attr("data-info"); var tok = $('#token').val(); var lg = $('#lg').val(); e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: {ins_id: ins_id, stu_id: stu_id, token: tok, lg: lg, switchr: "change_status_menu"}, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { $('.progress-bar-stu').removeClass(response.old_bg); $('.progress-bar-stu').addClass(response.new_bg); $('.progress-bar-stu').css({width: response.per}); $('#radio-toggle > label.btn').removeClass("btn-primary").addClass("btn-default text-secondary"); $('.' + stu_id).removeClass('btn-default text-secondary').addClass(response.color); $('.stu-status-per').html(response.per); $('.text-stu-show').html(response.nm); } else { showSwal('error', response.msg, '') } }, }); }); $(".img_warp").on("click", ".delete-car-img", function (e) { var img_id = $(this).attr("id"); var car_id = $(this).attr("data-id"); var tag_id = $(this).attr("data-info"); var tok = $('#token').val(); var lg = $('#lg').val(); bootbox.confirm({ message: del_msg_, className: 'bootbox-sm', locale: lg, callback: function (result) { if (result === true) { e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: {img_id: img_id, car_id: car_id, token: tok, lg: lg, switchr: "delet_car_img"}, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { $('.del-' + tag_id).hide(); } else { showSwal('error', response.msg, '') } }, }); //confirm the } }, }); }); $(".table").on("click", ".change_user_stu", function (e) { var element = this; var id = $(this).attr("data-id"); var stu = $(this).attr("data-info"); var tok = $('#token').val(); var lg = $('#lg').val(); var loading = '
Loading...
'; $(this).html(loading); e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: {id: id, stu: stu, token: tok, lg: lg, switchr: "edit_user_status"}, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { $(element).html(response.g); $(element).attr("data-info", response.g); $(element).removeClass("btn-outline-success"); $(element).removeClass("btn-outline-danger"); $(element).addClass("btn-outline-" + response.res); } else { showSwal('error', response.msg, '') } }, }); }); $(".table").on("click", ".change_user_role", function (e) { var element = this; var id = $(this).attr("data-id"); var sec = $(this).attr("data-info"); var typ = $(this).attr("data-url"); var tok = $('#token').val(); var lg = $('#lg').val(); var loading = '
Loading...
'; $(this).html(loading); e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: {id: id, sec: sec, typ: typ, token: tok, lg: lg, switchr: "edit_user_role"}, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { if (response.ty == "all") { $('button[data-info=' + sec + ']').html(response.res); } else { $(element).html(response.res); } } else { showSwal('error', response.msg, '') } }, }); }); $(".del_warp").on("click", ".delete_this_item", function (e) { var id = $(this).attr("id"); var insID = $(this).attr("data-info"); var part_id = $(this).attr("data-id"); var tok = $('#token').val(); var lg = $('#lg').val(); var q = $(this).attr("data-url"); bootbox.confirm({ message: del_msg_, className: 'bootbox-sm', locale: lg, callback: function (result) { if (result === true) { e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: { id: id, insID: insID, token: tok, lg: lg, part_id: part_id, q: q, switchr: "delet_this_item_form" }, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { $('.item-warp-' + id).hide(); $('#total_item_price').html(round(response.total, 2)); $('#total-price').val(round(response.total, 2)); $('#original_total_price').val(round(response.original, 2)); $('#flat-rate-total').html(response.flat_rate_markup); if (response.chk) { $('#create-invoice-btn').removeClass('btn-secondary').addClass('btn-primary'); $("#create-invoice-btn").prop("disabled", false); } else { $('#create-invoice-btn').removeClass('btn-primary').addClass('btn-secondary'); $("#create-invoice-btn").prop("disabled", true); $('#invo_print').addClass('disabled'); $('#shoinvo').addClass('disabled'); $("#copyinvo").prop("disabled", true); $(".send-invoice").prop("disabled", true); } } else { showSwal('error', response.msg, '') } }, }); //confirm the } }, }); }); $('#add_spare_part_row').change(function () { var data_item = $('option:selected', this).attr('data-info'); var data_item_price = $('option:selected', this).attr('data-url'); var pid = $('option:selected', this).attr('data-id'); $("#no_of_part").prop("disabled", false); $("#no_of_part").val("1"); $("#item").val(data_item); $("#item_price").val(data_item_price); var instk = $(this).val(); $('#stk_warp').show() $('#instk_no').html(instk); $("#no_of_part").attr("max", instk); $("#part_id").val(pid); }); $('#add_additional_services_row_form, #add_additional_flat_rate_services_row_form, #add_additional_parts_row_form').submit(function (e) { const $form = $(this); var l = Ladda.create(document.querySelector('.ladda-button-ins-serv')); var data = $(this).serialize(); l.start(); e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: data, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { l.stop(); $(':input:not([type=hidden])').val(''); $('#no_of_part').val("1").attr('value', '1'); $('.with_vat').html(''); $form.closest('.modal').modal('hide'); $('.kanban-box').append( '
' + response.q + ' / ' + response.price + ' ' + response.sar + '
' + response.item + (response.is_flat_rate_service ? '
' + '
' + __(response.flat_rate_service_price.car_type) + '
' + '
' + '' + response.flat_rate_service_price.price + '
' + '
' + '' + response.flat_rate_service_price.rate + '
' + '
' : '') + '
', ); $('#total_item_price').html(round(response.total_all, 2)); $('#flat-rate-total').html(response.flat_rate_markup); $('#total-price').val(round(response.total_all, 2)); $('#original_total_price').val(round(response.original, 2)); $('#create-invoice-btn').removeClass('btn-secondary').addClass('btn-primary'); $("#create-invoice-btn").prop("disabled", false); } else { l.stop(); showSwal('error', response.msg, '') } }, }); }); $('#add_spare_part_row_form').submit(function (e) { var l = Ladda.create(document.querySelector('.ladda-button-ins-part')); var data = $(this).serialize(); l.start(); e.preventDefault(); $.ajax({ url: baseurl + 'data-processing.php', type: 'POST', data: data, cache: false, dataType: 'json', success: function (response) { if (response.stu === 'success') { l.stop(); $('form#add_spare_part_row_form')[0].reset(); $('#modals_add_new_piece').modal('hide'); $('.kanban-box').append( '
' + response.q + ' / ' + response.price + ' ' + response.sar + '
' + response.item + '
', ); $('#total_item_price').html(round(response.total_all, 2)); $('#total-price').val(round(response.total_all, 2)); $('#original_total_price').val(round(response.original, 2)); $('#create-invoice-btn').removeClass('btn-secondary').addClass('btn-primary'); $("#create-invoice-btn").prop("disabled", false); } else { l.stop(); showSwal('error', response.msg, '') } }, }); }); function round(value, decimals) { return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals); } function checkForClass(e, c) { classCheck = $(e).is(c); return true; } function getImgName(g) { var fullPath = g; var filename = fullPath.replace(/^.*[\\\/]/, ''); // or, try this, // var filename = fullPath.split("/").pop(); return filename; } }); ```
nadyshalaby commented 12 months ago

@coderaiser Please follow up me here.

coderaiser commented 12 months ago

Could you please decrease to smallest possible count of lines (10-20 lines maximum), so identification of problem could be possible.

nadyshalaby commented 12 months ago

No need i switched to another library ugilfy-js and csso

coderaiser commented 12 months ago

So you have a crash of Minify or issue with quotes? Why do you want double quotes in minified code? There is configuration option in @putout/printer but why do you need it?

Looks like the problem with line containing __:

   __(response.flat_rate_service_price.car_type) +

Please avoid using __ since this is a part of 🦎PutoutScript which is used for minification. Renaming this identifier fixes all the things:

Minified code ```js var baseurl=document.getElementById("baseurl").getAttribute("data-url"),isRtls=$("html").attr("dir"),lg=document.documentElement.lang||"ar";if("ar"===lg){var sele="أختر";$(".bootbox-cancel").html("إلغاء");var del_msg_="هل أنت متأكد من متابعة عملية الحذف؟",imgcount__="عذرًا ، تجاوز عدد صور التحميل الحد المسموح به وهو 20 صور لكل مركبة!",manag_u_pass__="تم تعيين كلمة مرور المستخدم بنجاح"}else if("en"===lg){sele="Select";$(".bootbox-cancel").html("Cancel");del_msg_="Are you sure to continue with the deletion process?",imgcount__="Sorry, the number of upload photos exceeded the allowed limit of 20 per vehicle!",manag_u_pass__="The user password was set successfully"}else if("hi"===lg){sele="चुनें";$(".bootbox-cancel").html("रद्द करना");del_msg_="क्या आप वाकई हटाने के प्रक्रिया के साथ जारी रखना चाहते हैं?",imgcount__="क्षमा करें, अपलोड फोटो की संख्या अनुमत सीमा 20 प्रति वाहन को पार कर गई!",manag_u_pass__="उपयोगकर्ता पासवर्ड सफलतापूर्वक सेट किया गया था"}$((function(){function round(value,decimals){return Number(Math.round(value+"e"+decimals)+"e-"+decimals)}$("#change-user-self-password-form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-pws")),data=$(this).serialize();l.start();var me=$(this);me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),$(":input:not([type=hidden])").val(""),$("#modals-change-user-password").modal("hide"),showSwal("success","","")):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#add_client_form_mini").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-565")),data=($("#tag").val(),$(this).serialize());l.start();var me=$(this);me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){if("success"===response.stu){l.stop(),$(":input:not([type=hidden])").val(""),$("#modal_add_new_client_g").modal("hide");var o=new Option(response.txt,response.id);$(o).html(response.txt),$(".select-option-client").append(o),$(o).prop("selected",!0)}else"found"===response.stu?(l.stop(),$(".alert_form").show(),$(".alert_form_text").html(response.msg)):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#add_new_client_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-65746")),data=($("#tag").val(),$(this).serialize());l.start();var me=$(this);me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){if("success"===response.stu){l.stop(),$(":input:not([type=hidden])").val(""),$("textarea").val("");var tot=parseInt($(".show_total_").html());$(".show_total_").html(tot+1),$("#modal_add_new_client").modal("hide"),$("#dt-clients").DataTable().ajax.reload(),showSwal("success","","")}else"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#verify_client").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-very")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),$("#load_cars_data").load(baseurl+"load-cars-data.php?id="+response.id+"&lg="+lg+"&mo="+response.mo,"f"+1e6*Math.random()),$("#clientid746574").val(response.id)):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#select_model_first").on("change",(function(e){var id=$(this).val(),sd=$(".selected_model").attr("data-info");$(".select-option-"+sd).find("option").remove(),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"select-model.php",data:{id:id},shouldRetry:3,success:function(response){$(".select-option-"+sd).append(response)}})})),$(".add_general_data_form").submit((function(e){var lb=$("#actid").val(),l=($("#model_parent").val(),Ladda.create(document.querySelector(".ladda-button-gt"))),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){if("success"===response.stu){l.stop(),response.rso||$(".removOption option").remove(),$(".modal_add_new_general_data").modal("hide"),$(".gt-title").val("");var o=new Option(response.txt,response.id);$(o).html(response.txt),$(".select-option-"+lb).append(o),$(o).prop("selected",!0)}else"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$(".add_general_data_form2").submit((function(e){var lb=$("#lb-x").val(),l=Ladda.create(document.querySelector(".ladda-button-"+lb)),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){if("success"===response.stu){l.stop(),$(".modal_add_new_general_data2").modal("hide"),$(".gt-title").val("");var o=new Option(response.txt,response.id);$(o).html(response.txt),$(".select-option-"+lb).append(o),$(o).prop("selected",!0)}else"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#add_new_user_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-001")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),window.location.href=baseurl+lg+"/settings/users/"+response.id):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#insert_new_car_data_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-94856")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),window.location.href=baseurl+lg+"/vehicles/"):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#insert_new_employee_mini").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-emp")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){if("success"===response.stu){l.stop(),$("#modal_add_new_employee").modal("hide");var o=new Option(response.txt,response.id);$(o).html(response.txt),$(o).attr("data-foo",response.mob),$(o).attr("data-id",response.eml),$(o).attr("data-info",response.txt),$(".select-option-user").append(o),$(o).prop("selected",!0),$("#email").val(response.eml),$("#emp_name").val(response.txt)}else"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#add_new_car_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-ancf")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),window.location.href=baseurl+lg+"/inspections/create-65746/"+response.id):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#insert_new_inspect_card_data_form").submit((function(e){function createInspection(confirmed){var l=Ladda.create(document.querySelector(".ladda-button-ncx")),me=$(this),data=new FormData(this);data.append("send_welcome_message",confirmed),l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,contentType:!1,cache:!1,processData:!1,success:function(response){"success"===response.stu?(l.stop(),showSwal("success","",""),window.location.href=baseurl+lg+"/inspections/view/"+response.id):"error"===response.stu&&(l.stop(),showSwal("success",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))}e.preventDefault();var vm=this;bootbox.confirm({message:fn("Do you want to send a welcome message to this client?"),className:"bootbox-sm",locale:lg,callback:function(confirmed){createInspection.call(vm,confirmed)}})})),$("#edit_currnt_employee_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-edt-emp")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),showSwal("success","",""),window.location.href=baseurl+lg+"/employees"):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#insert_new_part_data_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-94756")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),window.opener?(window.opener.postMessage({type:"item-created",item:response.item}),window.close()):window.location.href=baseurl+lg+"/inventory"):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#change-user-manager-password-form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-765")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),$("#modals-change-user-password").modal("hide"),showSwal("success",manag_u_pass__,"")):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#insert_new_employee_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-new-emp")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),window.location.href=baseurl+lg+"/employees"):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#delete_employee_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-del")),me=$(this),data=$(this).serialize();if(l.start(),!me.data("requestRunning")){if(me.data("requestRunning",!0),!confirm(del_msg_))return l.stop(),$("#modals-delete-employee").modal("hide"),!1;e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),$("#modals-delete-employee").modal("hide"),showSwal("success","",""),setTimeout((function(){window.location.href=baseurl+lg+"/employees"}),1400)):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}})}})),$(".calcu_vat_on_the_air").keyup((function(e){$(".with_vat").html("Loading..");var val=$(this).val(),tok=$("#token").val(),lg=$("#lg").val();e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:{val:val,token:tok,lg:lg,switchr:"calculate_vat"},dataType:"json",shouldRetry:3,success:function(response){$(".with_vat").html(response.withvat)}})})),$("#send_ticket_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-7632")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"data-processing.php",data:data,dataType:"json",success:function(response){"success"===response.stu?(l.stop(),showSwal("success","",""),$(":input:not([type=hidden])").val(""),$("textarea").val("")):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#update-vat-submit").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button")),me=$(this),data=$(this).serialize();l.start(),me.data("requestRunning")||(me.data("requestRunning",!0),e.preventDefault(),$.ajax({type:"POST",url:baseurl+"edit-data.php",data:data,dataType:"json",shouldRetry:3,success:function(response){"success"===response.stu?(l.stop(),showSwal("success","","")):"error"===response.stu&&(l.stop(),showSwal("error",response.msg,""))},complete:function(){me.data("requestRunning",!1)}}))})),$("#logo_file").change((function(e){var l=Ladda.create(document.querySelector(".ladda-button"));if(formdata=new FormData,$(this).prop("files").length>0){var file=$(this).prop("files")[0];formdata.append("logo",file)}l.start(),e.preventDefault(),$.ajax({url:baseurl+"source/upload_logo.php",type:"POST",data:formdata,cache:!1,dataType:"json",processData:!1,contentType:!1,success:function(result){"success"==result.stu?(l.stop(),$(".acc_logo").attr("src",baseurl+"logos/"+result.img),$("#company_logo").attr("src",baseurl+"logos/"+result.img)):"type-error"==result.stu?(l.stop(),showSwal("error",imgtype__,"")):"size-error"==result.stu&&(l.stop(),showSwal("error",imgsize__,""))}})})),$("#files").change((function(e){for(var cid=$("#car_id").val(),l=Ladda.create(document.querySelector(".ladda-button-fto")),form_data=new FormData,totalfiles=document.getElementById("files").files.length,index=0;index')}}}})})),$(".action-menu").on("click",".chage-stu-onclick",(function(e){var ins_id=$(this).attr("data-id"),stu_id=$(this).attr("data-info"),tok=$("#token").val(),lg=$("#lg").val();e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:{ins_id:ins_id,stu_id:stu_id,token:tok,lg:lg,switchr:"change_status_menu"},cache:!1,dataType:"json",success:function(response){"success"===response.stu?($(".progress-bar-stu").removeClass(response.old_bg),$(".progress-bar-stu").addClass(response.new_bg),$(".progress-bar-stu").css({width:response.per}),$("#radio-toggle > label.btn").removeClass("btn-primary").addClass("btn-default text-secondary"),$("."+stu_id).removeClass("btn-default text-secondary").addClass(response.color),$(".stu-status-per").html(response.per),$(".text-stu-show").html(response.nm)):showSwal("error",response.msg,"")}})})),$(".img_warp").on("click",".delete-car-img",(function(e){var img_id=$(this).attr("id"),car_id=$(this).attr("data-id"),tag_id=$(this).attr("data-info"),tok=$("#token").val(),lg=$("#lg").val();bootbox.confirm({message:del_msg_,className:"bootbox-sm",locale:lg,callback:function(result){!0===result&&(e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:{img_id:img_id,car_id:car_id,token:tok,lg:lg,switchr:"delet_car_img"},cache:!1,dataType:"json",success:function(response){"success"===response.stu?$(".del-"+tag_id).hide():showSwal("error",response.msg,"")}}))}})})),$(".table").on("click",".change_user_stu",(function(e){var element=this,id=$(this).attr("data-id"),stu=$(this).attr("data-info"),tok=$("#token").val(),lg=$("#lg").val();$(this).html('
Loading...
'),e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:{id:id,stu:stu,token:tok,lg:lg,switchr:"edit_user_status"},cache:!1,dataType:"json",success:function(response){"success"===response.stu?($(element).html(response.g),$(element).attr("data-info",response.g),$(element).removeClass("btn-outline-success"),$(element).removeClass("btn-outline-danger"),$(element).addClass("btn-outline-"+response.res)):showSwal("error",response.msg,"")}})})),$(".table").on("click",".change_user_role",(function(e){var element=this,id=$(this).attr("data-id"),sec=$(this).attr("data-info"),typ=$(this).attr("data-url"),tok=$("#token").val(),lg=$("#lg").val();$(this).html('
Loading...
'),e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:{id:id,sec:sec,typ:typ,token:tok,lg:lg,switchr:"edit_user_role"},cache:!1,dataType:"json",success:function(response){"success"===response.stu?"all"==response.ty?$("button[data-info="+sec+"]").html(response.res):$(element).html(response.res):showSwal("error",response.msg,"")}})})),$(".del_warp").on("click",".delete_this_item",(function(e){var id=$(this).attr("id"),insID=$(this).attr("data-info"),part_id=$(this).attr("data-id"),tok=$("#token").val(),lg=$("#lg").val(),q=$(this).attr("data-url");bootbox.confirm({message:del_msg_,className:"bootbox-sm",locale:lg,callback:function(result){!0===result&&(e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:{id:id,insID:insID,token:tok,lg:lg,part_id:part_id,q:q,switchr:"delet_this_item_form"},cache:!1,dataType:"json",success:function(response){"success"===response.stu?($(".item-warp-"+id).hide(),$("#total_item_price").html(round(response.total,2)),$("#total-price").val(round(response.total,2)),$("#original_total_price").val(round(response.original,2)),$("#flat-rate-total").html(response.flat_rate_markup),response.chk?($("#create-invoice-btn").removeClass("btn-secondary").addClass("btn-primary"),$("#create-invoice-btn").prop("disabled",!1)):($("#create-invoice-btn").removeClass("btn-primary").addClass("btn-secondary"),$("#create-invoice-btn").prop("disabled",!0),$("#invo_print").addClass("disabled"),$("#shoinvo").addClass("disabled"),$("#copyinvo").prop("disabled",!0),$(".send-invoice").prop("disabled",!0))):showSwal("error",response.msg,"")}}))}})})),$("#add_spare_part_row").change((function(){var data_item=$("option:selected",this).attr("data-info"),data_item_price=$("option:selected",this).attr("data-url"),pid=$("option:selected",this).attr("data-id");$("#no_of_part").prop("disabled",!1),$("#no_of_part").val("1"),$("#item").val(data_item),$("#item_price").val(data_item_price);var instk=$(this).val();$("#stk_warp").show(),$("#instk_no").html(instk),$("#no_of_part").attr("max",instk),$("#part_id").val(pid)})),$("#add_additional_services_row_form, #add_additional_flat_rate_services_row_form, #add_additional_parts_row_form").submit((function(e){const $form=$(this);var l=Ladda.create(document.querySelector(".ladda-button-ins-serv")),data=$(this).serialize();l.start(),e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:data,cache:!1,dataType:"json",success:function(response){"success"===response.stu?(l.stop(),$(":input:not([type=hidden])").val(""),$("#no_of_part").val("1").attr("value","1"),$(".with_vat").html(""),$form.closest(".modal").modal("hide"),$(".kanban-box").append('
'+response.q+" / "+response.price+' '+response.sar+'
'+response.item+(response.is_flat_rate_service?'
'+__(response.flat_rate_service_price.car_type)+'
'+response.flat_rate_service_price.price+'
'+response.flat_rate_service_price.rate+"
":"")+"
"),$("#total_item_price").html(round(response.total_all,2)),$("#flat-rate-total").html(response.flat_rate_markup),$("#total-price").val(round(response.total_all,2)),$("#original_total_price").val(round(response.original,2)),$("#create-invoice-btn").removeClass("btn-secondary").addClass("btn-primary"),$("#create-invoice-btn").prop("disabled",!1)):(l.stop(),showSwal("error",response.msg,""))}})})),$("#add_spare_part_row_form").submit((function(e){var l=Ladda.create(document.querySelector(".ladda-button-ins-part")),data=$(this).serialize();l.start(),e.preventDefault(),$.ajax({url:baseurl+"data-processing.php",type:"POST",data:data,cache:!1,dataType:"json",success:function(response){"success"===response.stu?(l.stop(),$("form#add_spare_part_row_form")[0].reset(),$("#modals_add_new_piece").modal("hide"),$(".kanban-box").append('
'+response.q+" / "+response.price+' '+response.sar+'
'+response.item+"
"),$("#total_item_price").html(round(response.total_all,2)),$("#total-price").val(round(response.total_all,2)),$("#original_total_price").val(round(response.original,2)),$("#create-invoice-btn").removeClass("btn-secondary").addClass("btn-primary"),$("#create-invoice-btn").prop("disabled",!1)):(l.stop(),showSwal("error",response.msg,""))}})}))})); ```

Just fixed issue related to single quotes in @putout/minify v2.8.0 🎉 . But __ should be renamed in your source, since this is design choice of 🐊Putout plugins API.

Is it works for you?