multiple fixes in index.js
This commit is contained in:
parent
f25e2a29f7
commit
a92f060740
@ -185,30 +185,30 @@ function setup_details_page() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
|
let button = document.getElementById('submit-button');
|
||||||
|
button.disabled = true;
|
||||||
let form = document.querySelector('#customer-form');
|
let form = document.querySelector('#customer-form');
|
||||||
if (!form.checkValidity()) {
|
if (!form.checkValidity()) {
|
||||||
form.reportValidity();
|
form.reportValidity();
|
||||||
|
button.disabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
get_form_data();
|
let contact = get_form_data();
|
||||||
let appointment = (await frappe.call({
|
let appointment = (await frappe.call({
|
||||||
method: 'erpnext.www.book-appointment.index.create_appointment',
|
method: 'erpnext.www.book-appointment.index.create_appointment',
|
||||||
args: {
|
args: {
|
||||||
'date': window.selected_date,
|
'date': window.selected_date,
|
||||||
'time': window.selected_time,
|
'time': window.selected_time,
|
||||||
'contact': window.contact,
|
'contact': contact,
|
||||||
'tz':window.selected_timezone
|
'tz':window.selected_timezone
|
||||||
}
|
}
|
||||||
})).message;
|
})).message;
|
||||||
frappe.msgprint(__('Appointment Created Successfully'));
|
frappe.msgprint(__('Appointment Created Successfully'));
|
||||||
let button = document.getElementById('submit-button');
|
|
||||||
button.disabled = true;
|
|
||||||
button.onclick = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_form_data() {
|
function get_form_data() {
|
||||||
contact = {};
|
contact = {};
|
||||||
let inputs = ['name', 'skype', 'number', 'notes', 'email'];
|
let inputs = ['name', 'skype', 'number', 'notes', 'email'];
|
||||||
inputs.forEach((id) => contact[id] = document.getElementById(`customer_${id}`).value)
|
inputs.forEach((id) => contact[id] = document.getElementById(`customer_${id}`).value)
|
||||||
window.contact = contact
|
return contact
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user