feat: configurable redirect on success
This commit is contained in:
parent
793ba8fc06
commit
511780a4d4
@ -13,7 +13,9 @@
|
||||
"appointment_details_section",
|
||||
"appointment_duration",
|
||||
"email_reminders",
|
||||
"advance_booking_days"
|
||||
"advance_booking_days",
|
||||
"success_details",
|
||||
"success_redirect_url"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@ -28,7 +30,7 @@
|
||||
"fieldname": "number_of_agents",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "No. Of Agents",
|
||||
"label": "Number of Concurrent Appointments",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
@ -48,9 +50,10 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Notify customer and agent via email on the day of the appointment.",
|
||||
"fieldname": "email_reminders",
|
||||
"fieldtype": "Check",
|
||||
"label": "Email Reminders"
|
||||
"label": "Notify Via Email"
|
||||
},
|
||||
{
|
||||
"default": "7",
|
||||
@ -82,10 +85,21 @@
|
||||
"fieldname": "appointment_details_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Appointment Details"
|
||||
},
|
||||
{
|
||||
"fieldname": "success_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Success Settings"
|
||||
},
|
||||
{
|
||||
"description": "Leave blank for home.\nThis is relative to site URL, for example \"/about\" will redirect to \"https://yoursitename.com/about\"",
|
||||
"fieldname": "success_redirect_url",
|
||||
"fieldtype": "Data",
|
||||
"label": "Success Redirect URL"
|
||||
}
|
||||
],
|
||||
"issingle": 1,
|
||||
"modified": "2019-10-04 11:36:20.839075",
|
||||
"modified": "2019-11-14 12:17:08.721683",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Appointment Booking Settings",
|
||||
|
@ -200,16 +200,32 @@ async function submit() {
|
||||
return;
|
||||
}
|
||||
let contact = get_form_data();
|
||||
let appointment = (await frappe.call({
|
||||
let appointment = frappe.call({
|
||||
method: 'erpnext.www.book-appointment.index.create_appointment',
|
||||
args: {
|
||||
'date': window.selected_date,
|
||||
'time': window.selected_time,
|
||||
'contact': contact,
|
||||
'tz':window.selected_timezone
|
||||
},
|
||||
callback: (response)=>{
|
||||
if (response.message.status == "Unverified") {
|
||||
frappe.show_alert("Please check your email to confirm the appointment")
|
||||
} else {
|
||||
frappe.show_alert("Appointment Created Successfully");
|
||||
}
|
||||
setTimeout(()=>{
|
||||
let redirect_url = "/";
|
||||
if (window.appointment_settings.success_redirect_url){
|
||||
redirect_url += window.appointment_settings.success_redirect_url;
|
||||
}
|
||||
window.location.href = redirect_url;},2)
|
||||
},
|
||||
error: (err)=>{
|
||||
frappe.show_alert("Something went wrong please try again");
|
||||
button.disabled = false;
|
||||
}
|
||||
})).message;
|
||||
frappe.msgprint(__('Appointment Created Successfully'));
|
||||
});
|
||||
}
|
||||
|
||||
function get_form_data() {
|
||||
|
@ -107,6 +107,7 @@ def create_appointment(date, time, tz, contact):
|
||||
appointment.customer_email = contact.get('email', None)
|
||||
appointment.status = 'Open'
|
||||
appointment.insert()
|
||||
return appointment
|
||||
|
||||
# Helper Functions
|
||||
def filter_timeslots(date, timeslots):
|
||||
|
Loading…
x
Reference in New Issue
Block a user