()
| 213 | } |
| 214 | } |
| 215 | async function submit() { |
| 216 | let button = document.getElementById("submit-button"); |
| 217 | button.disabled = true; |
| 218 | let form = document.querySelector("#customer-form"); |
| 219 | if (!form.checkValidity()) { |
| 220 | form.reportValidity(); |
| 221 | button.disabled = false; |
| 222 | return; |
| 223 | } |
| 224 | let contact = get_form_data(); |
| 225 | let appointment = frappe.call({ |
| 226 | method: "erpnext.www.book_appointment.index.create_appointment", |
| 227 | args: { |
| 228 | date: window.selected_date, |
| 229 | time: window.selected_time, |
| 230 | contact: contact, |
| 231 | tz: window.selected_timezone, |
| 232 | }, |
| 233 | callback: (response) => { |
| 234 | if (response.message.status == "Unverified") { |
| 235 | frappe.show_alert(__("Please check your email to confirm the appointment")); |
| 236 | } else { |
| 237 | frappe.show_alert(__("Appointment Created Successfully")); |
| 238 | } |
| 239 | setTimeout(() => { |
| 240 | let redirect_url = "/"; |
| 241 | if (window.appointment_settings.success_redirect_url) { |
| 242 | redirect_url += window.appointment_settings.success_redirect_url; |
| 243 | } |
| 244 | window.location.href = redirect_url; |
| 245 | }, 5000); |
| 246 | }, |
| 247 | error: (err) => { |
| 248 | frappe.show_alert(__("Something went wrong please try again")); |
| 249 | button.disabled = false; |
| 250 | }, |
| 251 | }); |
| 252 | } |
| 253 | |
| 254 | function get_form_data() { |
| 255 | let contact = {}; |
nothing calls this directly
no test coverage detected