Best JavaScript code snippet using wpt
receive_payment.js
Source:receive_payment.js
1function get_load_customers_table() {2 $("#loader-modal").show();3 $.ajax({4 url: baseURL + "/accounting/get_load_customers_table",5 type: "POST",6 dataType: "json",7 data: {},8 success: function(data) {9 $('#customers_table tbody').html(data.html);10 $("#loader-modal").hide();11 },12 });13}14var payment_method_information = "";15$(document).ready(function() {16 payment_method_information = $("div#customer_receive_payment_modal .payment_method_information").html();17 $("div#customer_receive_payment_modal .payment_method_information").html("");18 $("div#addsalesreceiptModal .payment_method_information").html("");19 $("div#create_estimate_modal .payment_method_information").html("");20 $("div#add_refund_receipt_Modal .payment_method_information").html("");21});22$('#addsalesreceiptModal .recurring-form-part.below .date-part .input-field-1 .datepicker').datepicker({23 uiLibrary: 'bootstrap'24});25$('#addsalesreceiptModal .recurring-form-part.below .date-part .input-field-3 .by-end-date .datepicker').datepicker({26 uiLibrary: 'bootstrap'27});28$('#receive_payment_form .form-group .datepicker').datepicker({29 uiLibrary: 'bootstrap'30});31$('#receive_payment_form .form-group .filter-panel .date-filter .date-from .datepicker').datepicker({32 uiLibrary: 'bootstrap'33});34$('#receive_payment_form .form-group .filter-panel .date-filter .date-to .datepicker').datepicker({35 uiLibrary: 'bootstrap'36});37$(document).on("click", "#customer_receive_payment_modal .customer_receive_payment_modal_content .close-btn", function(event) {38 $("#customer_receive_payment_modal").fadeOut();39 get_customer_info_for_receive_payment_modal('');40 event.preventDefault();41});42$(document).on("click", function(event) {43 if ($(event.target).closest("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .right-option").length === 0) {44 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .right-option .sub-option").hide();45 }46 if ($(event.target).closest("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter").length === 0) {47 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter .filter-panel").hide();48 }49 if ($(event.target).closest("#customer_receive_payment_modal .find-by-invoice-no-section").length === 0) {50 $("#customer_receive_payment_modal .find-by-invoice-no-panel").hide();51 }52 if ($(event.target).closest("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .center-options").length === 0) {53 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .more-sub-option").hide();54 }55});56$(document).on("click", "#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .clear-btn", function(event) {57 var customer_id = $("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").val();58 get_customer_info_for_receive_payment_modal(customer_id);59 event.preventDefault();60});61$(document).on("click", "#receive_payment_form .form-group .find-by-invoice-no", function(event) {62 event.preventDefault();63 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter .filter-panel").show();64});65$(document).on("click", "#customer_receive_payment_modal .find-by-invoice-no-section button.find-by-invoice-no", function(event) {66 event.preventDefault();67 $("#customer_receive_payment_modal .find-by-invoice-no-panel").show();68});69$(document).on("click", "#customer_receive_payment_modal .find-by-invoice-no-section button.cancel-btn", function(event) {70 event.preventDefault();71 $("#customer_receive_payment_modal .find-by-invoice-no-panel").hide();72});73$(document).on("click", "#customer_receive_payment_modal .find-by-invoice-no-section button.find-btn", function(event) {74 event.preventDefault();75 $.ajax({76 url: baseURL + "/accounting/find_cutsomer_by_invoice_number",77 type: "POST",78 dataType: "json",79 data: {80 find_inv_no: $("#customer_receive_payment_modal .find-by-invoice-no-section .find-by-invoice-no-panel input[name='find-by-invoice-no']").val()81 },82 success: function(data) {83 if (data.customer_id != "") {84 $("#customer_receive_payment_modal .find-by-invoice-no-section .find-by-invoice-no-panel label.error").hide();85 $("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").val(data.customer_id);86 get_customer_info_for_receive_payment_modal(data.customer_id);87 } else {88 $("#customer_receive_payment_modal .find-by-invoice-no-section .find-by-invoice-no-panel label.error").show();89 }90 },91 });92});93$(document).on("click", "#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter .filter-panel .buttons .cancel-btn", function(event) {94 event.preventDefault();95 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter .filter-panel").hide();96 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_from']").val("");97 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_to']").val("");98 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_overdue']").prop('checked', false);99 var customer_id = $("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").val();100 get_customer_info_for_receive_payment_modal(customer_id);101});102$(document).on("click", ".customer_receive_payment_btn", function(event) {103 $("#customer_receive_payment_modal").fadeIn();104 event.preventDefault();105 var customer_id = $(this).attr("data-customer-id");106 $("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").val(customer_id);107 get_customer_info_for_receive_payment_modal(customer_id);108 $('#new-popup').modal('hide');109});110$(document).on("click", "#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter .filter-panel .buttons .apply-btn", function(event) {111 event.preventDefault();112 var filter_date_from = $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_from']").val();113 var filter_date_to = $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_to']").val();114 var filter_overdue = $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_overdue']").is(':checked');115 var customer_id = $("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").val();116 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_from']").removeClass("empty");117 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_to']").removeClass("empty");118 get_customer_filtered_info_for_receive_payment_modal(filter_date_from, filter_date_to, filter_overdue, customer_id);119 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter .filter-panel").fadeOut();120});121$("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").change(function() {122 var customer_id = $(this).val();123 get_customer_info_for_receive_payment_modal(customer_id);124}).change();125$("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='checkbox-all-action']").change(function() {126 for (var i = 0; i < invoice_count; i++) {127 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='inv_cb_" + i + "']").prop("checked", $(this).is(":checked"));128 }129}).change();130$(document).on("change", "#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .inv_cb", function(event) {131 var unchecked_found = false;132 for (var i = 0; i < invoice_count; i++) {133 if (!$("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='inv_cb_" + i + "']").is(":checked")) {134 unchecked_found = true;135 }136 }137 if (unchecked_found) {138 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='checkbox-all-action']").prop("checked", false);139 } else {140 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='checkbox-all-action']").prop("checked", true);141 }142})143$(document).on("click", "div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .btn-save-dropdown", function(event) {144 event.preventDefault();145 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .right-option .sub-option").show();146});147var invoice_count = 0;148function get_customer_info_for_receive_payment_modal(customer_id) {149 $("#loader-modal").show();150 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_header .tittle span").html("");151 $("#customer_receive_payment_modal form input[name='attachment-file']").val('');152 if ($("#customer_receive_payment_modal #receive_payment_form input[name='receive_payment_id']").val() != "") {153 $("#customer_receive_payment_modal form .attachement-file-section input[name='attachement-filenames']").val("");154 $("#customer_receive_payment_modal form .attachement-file-section input[name='attachment-file']").val("");155 }156 upload_attachment("#customer_receive_payment_modal form");157 $("#customer_receive_payment_modal #receive_payment_form input[name='receive_payment_id']").val("");158 $("#customer_receive_payment_modal #receive_payment_form input[name='ref_no']").removeAttr("disabled");159 $("#customer_receive_payment_modal #receive_payment_form input[name='payment_date']").removeAttr("disabled");160 $.ajax({161 url: baseURL + "/accounting/get_customer_info_for_receive_payment",162 type: "POST",163 dataType: "json",164 data: { customer_id: customer_id },165 success: function(data) {166 if (data.html == "") {167 $("#customer_receive_payment_modal .invoices .outstanding-transactions").hide();168 } else {169 $("#customer_receive_payment_modal .invoices .outstanding-transactions").show();170 }171 $('#customer_receive_payment_modal #customer_invoice_table .table-body').html(data.html);172 $('#receive_payment_form .total-receive-payment .amount').html("$" + data.display_receivable_payment);173 $('div#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .total-amount .amount-to-apply .amount').html("$" + data.display_receivable_payment);174 $("#customer_receive_payment_modal #receive_payment_form input[name='amount_received']").val(data.display_receivable_payment);175 invoice_count = parseFloat(data.inv_count);176 $("#customer_receive_payment_modal #receive_payment_form input[name='invoice_count']").val(data.inv_count);177 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='checkbox-all-action']").prop("checked", true);178 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_from']").val("");179 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_to']").val("");180 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_overdue']").prop('checked', false);181 $("#customer_receive_payment_modal .customer_receive_payment_modal_content input[name='payment_date']").val("");182 $("#customer_receive_payment_modal .customer_receive_payment_modal_content select[name='payment_method']").val("");183 $("#customer_receive_payment_modal .customer_receive_payment_modal_content input[name='ref_no']").val("");184 $("#customer_receive_payment_modal .customer_receive_payment_modal_content select[name='deposite_to']").val("");185 $('#customer_receive_payment_modal form .attachement-file-section div.attachement-viewer').html("");186 $("#customer_receive_payment_modal form .attachement-file-section input[name='attachement-filenames']").val("");187 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .btn-more").hide();188 $("#loader-modal").hide();189 },190 });191}192function get_customer_filtered_info_for_receive_payment_modal(filter_date_from, filter_date_to, filter_overdue, customer_id) {193 $("#loader-modal").show();194 $.ajax({195 url: baseURL + "/accounting/get_customer_filtered_info_for_receive_payment_modal",196 type: "POST",197 dataType: "json",198 data: {199 customer_id: customer_id,200 filter_date_from: filter_date_from,201 filter_date_to: filter_date_to,202 filter_overdue: filter_overdue203 },204 success: function(data) {205 $('#customer_receive_payment_modal #customer_invoice_table .table-body').html(data.html);206 $('#receive_payment_form .total-receive-payment .amount').html("$" + data.display_receivable_payment);207 $('div#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .total-amount .amount-to-apply .amount').html("$" + data.display_receivable_payment);208 $("#customer_receive_payment_modal #receive_payment_form input[name='amount_received']").val(data.display_receivable_payment);209 invoice_count = parseFloat(data.inv_count);210 $("#customer_receive_payment_modal #receive_payment_form input[name='invoice_count']").val(data.inv_count);211 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='checkbox-all-action']").prop("checked", true);212 $("#loader-modal").hide();213 },214 });215}216$("#customer_receive_payment_modal #receive_payment_form .filter input[name='invoice_number']").on("keyup", function() {217 var value = $(this).val().toLowerCase();218 $("#customer_receive_payment_modal #customer_invoice_table tbody tr").filter(function() {219 $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);220 });221});222$('#customer_receive_payment_modal').on('hidden', function() {223 console.log("closed");224 $("#customer_receive_payment_modal #receive_payment_form input[name='ref_no']").removeAttr("disabled");225 $("#customer_receive_payment_modal #receive_payment_form input[name='payment_date']").removeAttr("disabled");226 $('#customer_receive_payment_modal form').trigger("reset");227 get_customer_info_for_receive_payment_modal('');228});229$(document).on("click", "#customer_receive_payment_modal #receive_payment_form button[data-action='print']", function(event) {230 var submit_type = $(this).attr('data-submit-type');231 $("#customer_receive_payment_modal #receive_payment_form input[name='submit_option']").val(submit_type);232 var empty_flds = 0;233 $("#customer_receive_payment_modal #receive_payment_form .required").each(function() {234 if (!$.trim($(this).val())) {235 empty_flds++;236 }237 });238 if (empty_flds == 0) {239 event.preventDefault();240 // $("#customer_receive_payment_modal #receive_payment_form").attr("action", baseURL + "/accounting/print_receive_payment");241 // $("#customer_receive_payment_modal #receive_payment_form").attr("target", "_blank");242 // $("#customer_receive_payment_modal #receive_payment_form").attr("method", "POST");243 // $("#customer_receive_payment_modal #receive_payment_form").submit();244 $("#loader-modal").show();245 $("#customer_receive_payment_modal #receive_payment_form input[name='ref_no']").removeAttr("disabled");246 $("#customer_receive_payment_modal #receive_payment_form input[name='payment_date']").removeAttr("disabled");247 $.ajax({248 url: baseURL + "/accounting/print_receive_payment",249 type: "POST",250 dataType: "json",251 data: $("#customer_receive_payment_modal #receive_payment_form").serialize(),252 success: function(data) {253 if (data.count_save > 0) {254 $("#customer_receive_payment_modal form input[name='receive_payment_id']").val(data.receive_payment_id);255 $('#sales_receipt_pdf_preview_modal').modal('show');256 $('#sales_receipt_pdf_preview_modal .send_sales_receipt_section').hide();257 $("#sales_receipt_pdf_preview_modal .pdf-print-preview").html(258 '<iframe src="' + data.file_location + '"></iframe>');259 $("#sales_receipt_pdf_preview_modal .pdf_preview_section .print-button").attr("href", data.file_location);260 $("#sales_receipt_pdf_preview_modal .pdf_preview_section .download-button").attr("href", data.file_location);261 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .btn-more").show();262 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .more-sub-option").hide();263 }264 $("#loader-modal").hide();265 },266 });267 }268});269$(document).on("click", "#customer_receive_payment_modal #receive_payment_form button[data-action='save']", function(event) {270 $("#customer_receive_payment_modal #receive_payment_form").removeAttr("target");271 $("#customer_receive_payment_modal #receive_payment_form").removeAttr("action");272 var submit_type = $(this).attr('data-submit-type');273 $("#customer_receive_payment_modal #receive_payment_form input[name='submit_option']").val(submit_type);274 var empty_flds = 0;275 $("#customer_receive_payment_modal #receive_payment_form .required").each(function() {276 if (!$.trim($(this).val())) {277 console.log($(this).attr("name"));278 empty_flds++;279 }280 });281 if (empty_flds == 0) {282 event.preventDefault();283 Swal.fire({284 title: "Save Receive Payment?",285 html: "Are you sure you want to save this?",286 showCancelButton: true,287 imageUrl: baseURL + "/assets/img/accounting/customers/folder.png",288 cancelButtonColor: "#d33",289 confirmButtonColor: "#2ca01c",290 confirmButtonText: $(this).html(),291 }).then((result) => {292 if (result.value) {293 $("#loader-modal").show();294 $("#customer_receive_payment_modal #receive_payment_form input[name='ref_no']").removeAttr("disabled");295 $("#customer_receive_payment_modal #receive_payment_form input[name='payment_date']").removeAttr("disabled");296 $.ajax({297 url: baseURL + "/accounting/save_receive_payment_from_modal",298 type: "POST",299 dataType: "json",300 data: $("#customer_receive_payment_modal #receive_payment_form").serialize(),301 success: function(data) {302 console.log(data.uplaod_result);303 if (data.count_save > 0) {304 $("div#customer_receive_payment_modal .customer_receive_payment_modal .customer_receive_payment_modal_footer .btn-more").show();305 $("#customer_receive_payment_modal form input[name='receive_payment_id']").val(data.receive_payment_id);306 $("#customer_receive_payment_modal #receive_payment_form input[name='ref_no']").attr("disabled", "true");307 $("#customer_receive_payment_modal #receive_payment_form input[name='payment_date']").attr("disabled", "true");308 get_load_customers_table();309 if (submit_type == "save-send") {310 Swal.fire({311 showConfirmButton: false,312 timer: 2000,313 title: "Success",314 html: "Receive payment has been saved.",315 icon: "success",316 });317 $('#sales_receipt_pdf_preview_modal').modal('show');318 $('#sales_receipt_pdf_preview_modal .send_sales_receipt_section').show();319 $('#sales_receipt_pdf_preview_modal .pdf_preview_section').hide();320 $('#sales_receipt_pdf_preview_modal .modal-title').html("Send email");321 $('#sales_receipt_pdf_preview_modal form#send_sales_receipt input[name="receive_payment_id"]').val(data.receive_payment_id);322 $('#sales_receipt_pdf_preview_modal form#send_sales_receipt input[name="email"]').val(data.customer_email);323 $('#sales_receipt_pdf_preview_modal form#send_sales_receipt input[name="subject"]').val("Payment Receipt from " + data.business_name);324 $('#sales_receipt_pdf_preview_modal form#send_sales_receipt textarea[name="body"]').val(`Please find our payment receipt attached to this email.325Thank you.326 327Have a great day,328` + data.business_name);329 $("#sales_receipt_pdf_preview_modal .modal-footer .send_sales_receipt_section .download-button").attr('href', data.file_location);330 $("#sales_receipt_pdf_preview_modal .send_sales_receipt_section .send_sales_receipt-preview").html(331 '<iframe src="' + data.file_location + '"></iframe>');332 get_load_customers_table();333 } else {334 Swal.fire({335 showConfirmButton: false,336 timer: 2000,337 title: "Success",338 html: "Receive payment has been saved.",339 icon: "success",340 });341 }342 } else {343 Swal.fire({344 showConfirmButton: false,345 timer: 2000,346 title: "Error",347 html: "No payment saved. Please double check your inputs.",348 icon: "error",349 });350 }351 if (submit_type == "save-new") {352 $("#customer_receive_payment_modal #receive_payment_form select[name='customer_id']").val("");353 get_customer_info_for_receive_payment_modal('');354 } else if (submit_type == "save-close") {355 $("#customer_receive_payment_modal").fadeOut();356 }357 },358 });359 }360 });361 }362});363$(document).on("change", "div#customer_receive_payment_modal .customer_receive_payment_modal_content #customer_invoice_table td .inv_grand_amount", function(event) {364 receive_payment_inv_grand_amount_changed();365});366$(document).on("click", "div#customer_receive_payment_modal .customer_receive_payment_modal_content button.clear-payment", function(event) {367 for (var i = 0; i < invoice_count; i++) {368 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content #customer_invoice_table td input[name='inv_" + i + "']").val(0);369 }370 receive_payment_inv_grand_amount_changed();371});372function receive_payment_inv_grand_amount_changed() {373 var receivable_payment = 0;374 for (var i = 0; i < invoice_count; i++) {375 if ($("div#customer_receive_payment_modal .customer_receive_payment_modal_content #customer_invoice_table td input[name='inv_cb_" + i + "']").is(":checked")) {376 var inv_amount = $("div#customer_receive_payment_modal .customer_receive_payment_modal_content #customer_invoice_table td input[name='inv_" + i + "']").val();377 receivable_payment += parseFloat(inv_amount.replace(/,/g, ''));378 }379 }380 const formatter = new Intl.NumberFormat('en-US', {381 notation: "scientific",382 minimumFractionDigits: 2383 })384 $('#receive_payment_form .total-receive-payment .amount').html("$" + formatMoney(receivable_payment));385 $('div#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .total-amount .amount-to-apply .amount').html("$" + formatMoney(receivable_payment));386 $("#customer_receive_payment_modal #receive_payment_form input[name='amount_received']").val(formatMoney(receivable_payment));387 $(this).val(formatMoney($(this).val().replace(/,/g, '')));388}389function formatMoney(n) {390 return "" + (Math.round(n * 100) / 100).toLocaleString();391}392$("#customer_receive_payment_modal #receive_payment_form").submit(function(event) {393 if ($("#customer_receive_payment_modal #receive_payment_form").attr("target") == "") {394 event.preventDefault();395 }396});397$(document).on("click", "div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .more-sub-option li", function(event) {398 event.preventDefault();399 var receive_payment_id = $("#customer_receive_payment_modal #receive_payment_form input[name='receive_payment_id']").val();400 if (receive_payment_id != "") {401 Swal.fire({402 title: "",403 html: "This transaction is linked to others. Are you sure you want to " + $(this).html() + " it?",404 showCancelButton: true,405 imageUrl: baseURL + "/assets/img/accounting/customers/exclamation-mark.png",406 cancelButtonColor: "#d33",407 confirmButtonColor: "#2ca01c",408 confirmButtonText: "Yes",409 cancelButtonText: "No",410 }).then((result) => {411 if (result.value) {412 var action = "";413 if ($(this).attr("data-option-type") == "void") {414 action = "void";415 } else if ($(this).attr("data-option-type") == "delete") {416 action = "delete";417 }418 $.ajax({419 url: baseURL + "/accounting/receive_payment_more_option",420 type: "POST",421 dataType: "json",422 data: {423 receive_payment_id: receive_payment_id,424 action: action425 },426 success: function(data) {427 if (data.result == "success") {428 if (action == "delete") {429 $("#customer_receive_payment_modal #receive_payment_form input[name='receive_payment_id']").val("");430 action = "deleted.";431 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .btn-more").hide();432 } else {433 action = "voided.";434 }435 Swal.fire({436 showConfirmButton: false,437 timer: 2000,438 title: "Success",439 html: "Transaction has been" + action,440 icon: "success",441 });442 } else {443 Swal.fire({444 showConfirmButton: false,445 timer: 2000,446 title: "Something went wrong.",447 icon: "error",448 });449 }450 },451 });452 }453 });454 }455});456$(document).on("click", "div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .btn-more", function(event) {457 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .more-sub-option").show();458});459$(document).on("change", "div#customer_receive_payment_modal form select[name='payment_method']", function(event) {460 $("div#customer_receive_payment_modal .payment_method_information").html("");461 $("div#addsalesreceiptModal .payment_method_information").html("");462 $("div#customer_receive_payment_modal .payment_method_information").html(payment_method_information);463 if (this.value == 'Cash') {464 // alert('cash');465 // $('#exampleModal').modal('toggle');466 $('#cash_area').show();467 $('#check_area').hide();468 $('#credit_card').hide();469 $('#debit_card').hide();470 $('#ach_area').hide();471 $('#venmo_area').hide();472 $('#paypal_area').hide();473 $('#invoicing').hide();474 $('#square_area').hide();475 $('#warranty_area').hide();476 $('#home_area').hide();477 $('#e_area').hide();478 $('#other_credit_card').hide();479 $('#other_payment_area').hide();480 } else if (this.value == 'Invoicing') {481 $('#cash_area').hide();482 $('#check_area').hide();483 $('#invoicing').show();484 $('#credit_card').hide();485 $('#debit_card').hide();486 $('#ach_area').hide();487 $('#venmo_area').hide();488 $('#paypal_area').hide();489 $('#square_area').hide();490 $('#warranty_area').hide();491 $('#home_area').hide();492 $('#e_area').hide();493 $('#other_credit_card').hide();494 $('#other_payment_area').hide();495 } else if (this.value == 'Check') {496 // alert('Check');497 $('#cash_area').hide();498 $('#check_area').show();499 $('#credit_card').hide();500 $('#debit_card').hide();501 $('#invoicing').hide();502 $('#ach_area').hide();503 $('#venmo_area').hide();504 $('#paypal_area').hide();505 $('#square_area').hide();506 $('#warranty_area').hide();507 $('#home_area').hide();508 $('#e_area').hide();509 $('#other_credit_card').hide();510 $('#other_payment_area').hide();511 } else if (this.value == 'Credit Card') {512 // alert('Credit card');513 $('#cash_area').hide();514 $('#check_area').hide();515 $('#credit_card').show();516 $('#debit_card').hide();517 $('#invoicing').hide();518 $('#ach_area').hide();519 $('#venmo_area').hide();520 $('#paypal_area').hide();521 $('#square_area').hide();522 $('#warranty_area').hide();523 $('#home_area').hide();524 $('#e_area').hide();525 $('#other_credit_card').hide();526 $('#other_payment_area').hide();527 } else if (this.value == 'Debit Card') {528 // alert('Credit card');529 $('#cash_area').hide();530 $('#check_area').hide();531 $('#credit_card').hide();532 $('#debit_card').show();533 $('#ach_area').hide();534 $('#venmo_area').hide();535 $('#invoicing').hide();536 $('#paypal_area').hide();537 $('#square_area').hide();538 $('#warranty_area').hide();539 $('#home_area').hide();540 $('#e_area').hide();541 $('#other_credit_card').hide();542 $('#other_payment_area').hide();543 } else if (this.value == 'ACH') {544 // alert('Credit card');545 $('#cash_area').hide();546 $('#check_area').hide();547 $('#credit_card').hide();548 $('#debit_card').hide();549 $('#invoicing').hide();550 $('#ach_area').show();551 $('#venmo_area').hide();552 $('#paypal_area').hide();553 $('#square_area').hide();554 $('#warranty_area').hide();555 $('#home_area').hide();556 $('#e_area').hide();557 $('#other_credit_card').hide();558 $('#other_payment_area').hide();559 } else if (this.value == 'Venmo') {560 // alert('Credit card');561 $('#cash_area').hide();562 $('#check_area').hide();563 $('#credit_card').hide();564 $('#debit_card').hide();565 $('#ach_area').hide();566 $('#invoicing').hide();567 $('#venmo_area').show();568 $('#paypal_area').hide();569 $('#square_area').hide();570 $('#warranty_area').hide();571 $('#home_area').hide();572 $('#e_area').hide();573 $('#other_credit_card').hide();574 $('#other_payment_area').hide();575 } else if (this.value == 'Paypal') {576 // alert('Credit card');577 $('#cash_area').hide();578 $('#check_area').hide();579 $('#credit_card').hide();580 $('#debit_card').hide();581 $('#invoicing').hide();582 $('#ach_area').hide();583 $('#venmo_area').hide();584 $('#paypal_area').show();585 $('#square_area').hide();586 $('#warranty_area').hide();587 $('#home_area').hide();588 $('#e_area').hide();589 $('#other_credit_card').hide();590 $('#other_payment_area').hide();591 } else if (this.value == 'Square') {592 // alert('Credit card');593 $('#cash_area').hide();594 $('#check_area').hide();595 $('#credit_card').hide();596 $('#invoicing').hide();597 $('#debit_card').hide();598 $('#ach_area').hide();599 $('#venmo_area').hide();600 $('#paypal_area').hide();601 $('#square_area').show();602 $('#warranty_area').hide();603 $('#home_area').hide();604 $('#e_area').hide();605 $('#other_credit_card').hide();606 $('#other_payment_area').hide();607 } else if (this.value == 'Warranty Work') {608 // alert('Credit card');609 $('#cash_area').hide();610 $('#check_area').hide();611 $('#credit_card').hide();612 $('#invoicing').hide();613 $('#debit_card').hide();614 $('#ach_area').hide();615 $('#venmo_area').hide();616 $('#paypal_area').hide();617 $('#square_area').hide();618 $('#warranty_area').show();619 $('#home_area').hide();620 $('#e_area').hide();621 $('#other_credit_card').hide();622 $('#other_payment_area').hide();623 } else if (this.value == 'Home Owner Financing') {624 // alert('Credit card');625 $('#cash_area').hide();626 $('#check_area').hide();627 $('#credit_card').hide();628 $('#debit_card').hide();629 $('#invoicing').hide();630 $('#ach_area').hide();631 $('#venmo_area').hide();632 $('#paypal_area').hide();633 $('#square_area').hide();634 $('#warranty_area').hide();635 $('#home_area').show();636 $('#e_area').hide();637 $('#other_credit_card').hide();638 $('#other_payment_area').hide();639 } else if (this.value == 'e-Transfer') {640 // alert('Credit card');641 $('#cash_area').hide();642 $('#check_area').hide();643 $('#credit_card').hide();644 $('#debit_card').hide();645 $('#invoicing').hide();646 $('#ach_area').hide();647 $('#venmo_area').hide();648 $('#paypal_area').hide();649 $('#square_area').hide();650 $('#warranty_area').hide();651 $('#home_area').hide();652 $('#e_area').show();653 $('#other_credit_card').hide();654 $('#other_payment_area').hide();655 } else if (this.value == 'Other Credit Card Professor') {656 // alert('Credit card');657 $('#cash_area').hide();658 $('#check_area').hide();659 $('#credit_card').hide();660 $('#debit_card').hide();661 $('#invoicing').hide();662 $('#ach_area').hide();663 $('#venmo_area').hide();664 $('#paypal_area').hide();665 $('#square_area').hide();666 $('#warranty_area').hide();667 $('#home_area').hide();668 $('#e_area').hide();669 $('#other_credit_card').show();670 $('#other_payment_area').hide();671 } else if (this.value == 'Other Payment Type') {672 // alert('Credit card');673 $('#cash_area').hide();674 $('#check_area').hide();675 $('#credit_card').hide();676 $('#debit_card').hide();677 $('#invoicing').hide();678 $('#ach_area').hide();679 $('#venmo_area').hide();680 $('#paypal_area').hide();681 $('#square_area').hide();682 $('#warranty_area').hide();683 $('#home_area').hide();684 $('#e_area').hide();685 $('#other_credit_card').hide();686 $('#other_payment_area').show();687 }688});689$(document).on("click", "#customer_receive_payment_modal form .attachement-file-section button.attachment-btn", function(event) {690 // $(this).preventDefault();691 $("div#customer_receive_payment_modal form#receive_payment_form input[name='attachment-file']").trigger('click');692});693$(document).on("change", "div#customer_receive_payment_modal form#receive_payment_form input[name='attachment-file']", function(event) {694 upload_attachment("div#customer_receive_payment_modal form#receive_payment_form");695});696function upload_attachment(target_form) {697 var files = $(target_form + " .attachement-file-section input[name='attachement-filenames']").val();698 $.ajax({699 url: baseURL + "/accounting/delete_file_attachement",700 type: "POST",701 dataType: "json",702 data: {703 filenames: files,704 },705 success: function(data) {706 console.log(data);707 },708 });709 var formDatas = new FormData();710 $(target_form + ' .attachement-file-section div.attachement-viewer').html("");711 $(target_form + " .attachement-file-section input[name='attachement-filenames']").val("");712 var ctr = 0;713 for (var i = 0; i < $(target_form + " input[name='attachment-file']").get(0).files.length; ++i) {714 formDatas.append('file', $(target_form + " input[name='attachment-file']").get(0).files[i]);715 $.ajax({716 type: "POST",717 enctype: 'multipart/form-data',718 url: baseURL + "/accounting/add_attachement",719 dataType: "json",720 data: formDatas,721 processData: false,722 contentType: false,723 cache: false,724 beforeSend: function() {725 ctr = 0;726 },727 success: function(data) {728 var filenmae_val = $(target_form + " .attachement-file-section input[name='attachement-filenames']").val();729 if (filenmae_val == "") {730 $(target_form + " .attachement-file-section input[name='attachement-filenames']").val(data.uniquesavename + "." + data.ext);731 } else {732 $(target_form + " .attachement-file-section input[name='attachement-filenames']").val(data.uniquesavename + "." + data.ext + "," + filenmae_val);733 }734 var viewer_images = $(target_form + ' .attachement-file-section div.attachement-viewer').html();735 if (data.ext != "jpg" && data.ext != "jpeg" && data.ext != "png" && data.ext != "JPG" && data.ext != "JPEG" && data.ext != "PNG") {736 viewer_images += '<img src="' + baseURL + 'assets/img/accounting/customers/document.png" alt="">';737 } else {738 viewer_images += '<img src="' + baseURL + data.destination + '" alt="">';739 }740 $(target_form + ' .attachement-file-section div.attachement-viewer').html(viewer_images);741 },742 error: function(e) {743 console.log("ERROR : ", e);744 }745 });746 }747}748function get_receive_payment(customer_id, receive_payment_id, invoice_id) {749 $.ajax({750 url: baseURL + "invoice-page/get/receive-payment",751 type: "POST",752 dataType: "json",753 data: {754 customer_id: customer_id,755 receive_payment_id: receive_payment_id,756 invoice_id: invoice_id757 },758 success: function(data) {759 $("#customer_receive_payment_modal #receive_payment_form input[name='receive_payment_id']").val(receive_payment_id);760 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_header .tittle span").html("#" + receive_payment_id);761 if (data.html == "") {762 $("#customer_receive_payment_modal .invoices .outstanding-transactions").hide();763 } else {764 $("#customer_receive_payment_modal .invoices .outstanding-transactions").show();765 }766 $('#customer_receive_payment_modal #customer_invoice_table .table-body').html(data.html);767 $('#receive_payment_form .total-receive-payment .amount').html("$" + data.display_receivable_payment);768 $('div#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .total-amount .amount-to-apply .amount').html("$" + data.display_receivable_payment);769 $("#customer_receive_payment_modal #receive_payment_form input[name='amount_received']").val(data.display_receivable_payment);770 invoice_count = parseFloat(data.inv_count);771 $("#customer_receive_payment_modal #receive_payment_form input[name='invoice_count']").val(data.inv_count);772 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices input[name='checkbox-all-action']").prop("checked", true);773 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_from']").val("");774 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_date_to']").val("");775 $("#customer_receive_payment_modal .customer_receive_payment_modal_content .invoicing-part .invoices .filter input[name='filter_overdue']").prop('checked', false);776 $("#customer_receive_payment_modal .customer_receive_payment_modal_content input[name='payment_date']").val(data.payment_date);777 $("#customer_receive_payment_modal .customer_receive_payment_modal_content select[name='payment_method']").val(data.payment_method);778 $("#customer_receive_payment_modal .customer_receive_payment_modal_content input[name='ref_no']").val(data.ref_no);779 $("#customer_receive_payment_modal .customer_receive_payment_modal_content select[name='deposite_to']").val(data.deposit_to);780 $('#customer_receive_payment_modal form .attachement-file-section div.attachement-viewer').html(data.attachments_images);781 $("#customer_receive_payment_modal form .attachement-file-section input[name='attachement-filenames']").val(data.attachments);782 $("div#customer_receive_payment_modal .customer_receive_payment_modal_content .customer_receive_payment_modal_footer .btn-more").hide();783 $("#loader-modal").hide();784 },785 });...
action-types.js
Source:action-types.js
1/* Keep this list alphabetized */2export const ACTION_RECEIVE = 'ACTION_RECEIVE';3export const ACTIONS_RECEIVE = 'ACTIONS_RECEIVE';4export const APPROVAL_REQUEST_CREATE = 'APPROVAL_REQUEST_CREATE';5export const APPROVAL_REQUEST_DELETE = 'APPROVAL_REQUEST_DELETE';6export const APPROVAL_REQUEST_RECEIVE = 'APPROVAL_REQUEST_RECEIVE';7export const EXPERIMENT_RECIPE_DATA_RECEIVE = 'EXPERIMENT_RECIPE_DATA_RECEIVE';8export const EXTENSION_LISTING_COLUMNS_CHANGE = 'EXTENSION_LISTING_COLUMNS_CHANGE';9export const EXTENSION_PAGE_RECEIVE = 'EXTENSION_PAGE_RECEIVE';10export const EXTENSION_RECEIVE = 'EXTENSION_RECEIVE';11export const NETWORK_NORMANDY_ADMIN_AVAILABLE = 'NETWORK_NORMANDY_ADMIN_AVAILABLE';12export const RECIPE_DELETE = 'RECIPE_DELETE';13export const RECIPE_FILTERS_RECEIVE = 'RECIPE_FILTERS_RECEIVE';14export const RECIPE_HISTORY_RECEIVE = 'RECIPE_HISTORY_RECEIVE';15export const RECIPE_LISTING_COLUMNS_CHANGE = 'RECIPE_LISTING_COLUMNS_CHANGE';16export const RECIPE_PAGE_RECEIVE = 'RECIPE_PAGE_RECEIVE';17export const RECIPE_RECEIVE = 'RECIPE_RECEIVE';18export const REQUEST_FAILURE = 'REQUEST_FAILURE';19export const REQUEST_SEND = 'REQUEST_SEND';20export const REQUEST_SUCCESS = 'REQUEST_SUCCESS';21export const REVISION_RECEIVE = 'REVISION_RECEIVE';22export const SERVICE_INFO_RECEIVE = 'SERVICE_INFO_RECEIVE';23export const SESSION_INFO_HISTORY_VIEW = 'SESSION_INFO_HISTORY_VIEW';24export const SESSION_INFO_RECEIVE = 'SESSION_INFO_RECEIVE';25export const USER_AUTH_ERROR = 'USER_AUTH_ERROR';26export const USER_AUTH_ERROR_NOTIFY = 'USER_AUTH_ERROR_NOTIFY';27export const USER_AUTH_FAILURE = 'USER_AUTH_FAILURE';28export const USER_AUTH_FINISH = 'USER_AUTH_FINISH';29export const USER_AUTH_START = 'USER_AUTH_START';30export const USER_LOGIN = 'USER_LOGIN';31export const USER_LOGIN_INSECURE = 'USER_LOGIN_INSECURE';32export const USER_LOGOUT = 'USER_LOGOUT';33export const USER_PROFILE_RECEIVE = 'USER_PROFILE_RECEIVE';34export const USER_RECEIVE = 'USER_RECEIVE';...
mutation_types.js
Source:mutation_types.js
1export default {2 RECEIVE_DELETE_BADGE: 'RECEIVE_DELETE_BADGE',3 RECEIVE_DELETE_BADGE_ERROR: 'RECEIVE_DELETE_BADGE_ERROR',4 RECEIVE_LOAD_BADGES: 'RECEIVE_LOAD_BADGES',5 RECEIVE_LOAD_BADGES_ERROR: 'RECEIVE_LOAD_BADGES_ERROR',6 RECEIVE_NEW_BADGE: 'RECEIVE_NEW_BADGE',7 RECEIVE_NEW_BADGE_ERROR: 'RECEIVE_NEW_BADGE_ERROR',8 RECEIVE_RENDERED_BADGE: 'RECEIVE_RENDERED_BADGE',9 RECEIVE_RENDERED_BADGE_ERROR: 'RECEIVE_RENDERED_BADGE_ERROR',10 RECEIVE_UPDATED_BADGE: 'RECEIVE_UPDATED_BADGE',11 RECEIVE_UPDATED_BADGE_ERROR: 'RECEIVE_UPDATED_BADGE_ERROR',12 REQUEST_DELETE_BADGE: 'REQUEST_DELETE_BADGE',13 REQUEST_LOAD_BADGES: 'REQUEST_LOAD_BADGES',14 REQUEST_NEW_BADGE: 'REQUEST_NEW_BADGE',15 REQUEST_RENDERED_BADGE: 'REQUEST_RENDERED_BADGE',16 REQUEST_UPDATED_BADGE: 'REQUEST_UPDATED_BADGE',17 START_EDITING: 'START_EDITING',18 STOP_EDITING: 'STOP_EDITING',19 UPDATE_BADGE_IN_FORM: 'UPDATE_BADGE_IN_FORM',20 UPDATE_BADGE_IN_MODAL: 'UPDATE_BADGE_IN_MODAL',...
Using AI Code Generation
1var wpt = require('wpt');2var wpt = new wpt('your api key');3wpt.receive('test', function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10var wpt = require('wpt');11var wpt = new wpt('your api key');12wpt.receive('test', function(err, data) {13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19var wpt = require('wpt');20var wpt = new wpt('your api key');21wpt.receive('141119_89_1R', function(err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});
Using AI Code Generation
1var wptoolkit = require('wptoolkit');2var wp = new wptoolkit();3wp.receive('hello', function(data) {4 console.log(data);5});6var wptoolkit = require('wptoolkit');7var wp = new wptoolkit();8wp.send('hello', 'hello world');
Using AI Code Generation
1var wptools = require('wptools');2var page = wptools.page('Barack Obama');3page.receive(function(err, data) {4 console.log(data);5});6 at errnoException (child_process.js:1011:11)7 at Process.ChildProcess._handle.onexit (child_process.js:802:34)8var wptools = require('wptools');9var page = wptools.page('Barack Obama');10page.get(function(err, data) {11 console.log(data);12});13 at errnoException (child_process.js:1011:11)14 at Process.ChildProcess._handle.onexit (child_process.js:802:34)15 at errnoException (child_process.js:1001:11)16 at Process.ChildProcess._handle.onexit (child_process.js:792:34)
Using AI Code Generation
1const wptools = require('wptools');2const wp = wptools.page('Einstein')3wp.get((err, page) => {4 console.log('Page: ', page);5});6const wptools = require('wptools');7const wp = wptools.page('Einstein')8wp.get((err, page) => {9 console.log('Page: ', page);10});11const wptools = require('wptools');12const wp = wptools.page('Einstein')13wp.get((err, page) => {14 console.log('Page: ', page);15});16const wptools = require('wptools');17const wp = wptools.page('Einstein')18wp.get((err, page) => {19 console.log('Page: ', page);20});21const wptools = require('wptools');22const wp = wptools.page('Einstein')23wp.get((err, page) => {24 console.log('Page: ', page);25});26const wptools = require('wptools');27const wp = wptools.page('Einstein')28wp.get((err, page) => {29 console.log('Page: ', page);30});31const wptools = require('wptools');32const wp = wptools.page('Einstein')33wp.get((err, page) => {34 console.log('Page: ', page);35});36const wptools = require('wptools');37const wp = wptools.page('Einstein')38wp.get((err, page) => {39 console.log('Page: ', page);40});41const wptools = require('wptools');42const wp = wptools.page('Einstein')43wp.get((err, page) => {44 console.log('Page: ', page);45});46const wptools = require('wptools');47const wp = wptools.page('Einstein')48wp.get((err, page)
Using AI Code Generation
1var wptools = require('./wptools.js');2wptools.receive("Barack Obama", function(err, data) {3 if (err) {4 console.log("Error: " + err);5 }6 else {7 console.log("Data: " + data);8 }9});10var request = require('request');11exports.receive = function(title, callback) {12 if (error) {13 callback(error);14 }15 else {16 callback(null, body);17 }18 });19};20{21 "scripts": {22 },23 "repository": {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!