diff --git a/rmax_custom/public/js/create_customer.js b/rmax_custom/public/js/create_customer.js index b270f60..7ab0ff0 100644 --- a/rmax_custom/public/js/create_customer.js +++ b/rmax_custom/public/js/create_customer.js @@ -125,14 +125,12 @@ function open_create_customer_dialog(frm) { ], primary_action_label: "Create Customer", primary_action(values) { - function count_digits(val) { - if (!val) return 0; - return val.replace(/\D/g, "").length; - } - if (count_digits(values.mobile_no) < 10) { + const digits = (values.mobile_no || "").replace(/\D/g, "").length; + if (digits < 10) { frappe.throw("Mobile number must have at least 10 digits."); - } - frappe.call({ + return; + } + return frappe.call({ method: "rmax_custom.api.customer.create_customer_with_address", args: { customer_name: values.customer_name,