mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
feat: configurable redirect on success
This commit is contained in:
@@ -13,7 +13,9 @@
|
|||||||
"appointment_details_section",
|
"appointment_details_section",
|
||||||
"appointment_duration",
|
"appointment_duration",
|
||||||
"email_reminders",
|
"email_reminders",
|
||||||
"advance_booking_days"
|
"advance_booking_days",
|
||||||
|
"success_details",
|
||||||
|
"success_redirect_url"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
"fieldname": "number_of_agents",
|
"fieldname": "number_of_agents",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "No. Of Agents",
|
"label": "Number of Concurrent Appointments",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -48,9 +50,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
|
"description": "Notify customer and agent via email on the day of the appointment.",
|
||||||
"fieldname": "email_reminders",
|
"fieldname": "email_reminders",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Email Reminders"
|
"label": "Notify Via Email"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "7",
|
"default": "7",
|
||||||
@@ -82,10 +85,21 @@
|
|||||||
"fieldname": "appointment_details_section",
|
"fieldname": "appointment_details_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Appointment Details"
|
"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,
|
"issingle": 1,
|
||||||
"modified": "2019-10-04 11:36:20.839075",
|
"modified": "2019-11-14 12:17:08.721683",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Appointment Booking Settings",
|
"name": "Appointment Booking Settings",
|
||||||
|
|||||||
@@ -200,16 +200,32 @@ async function submit() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let contact = get_form_data();
|
let contact = get_form_data();
|
||||||
let appointment = (await frappe.call({
|
let appointment = 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': contact,
|
'contact': contact,
|
||||||
'tz':window.selected_timezone
|
'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() {
|
function get_form_data() {
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ def create_appointment(date, time, tz, contact):
|
|||||||
appointment.customer_email = contact.get('email', None)
|
appointment.customer_email = contact.get('email', None)
|
||||||
appointment.status = 'Open'
|
appointment.status = 'Open'
|
||||||
appointment.insert()
|
appointment.insert()
|
||||||
|
return appointment
|
||||||
|
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
def filter_timeslots(date, timeslots):
|
def filter_timeslots(date, timeslots):
|
||||||
|
|||||||
Reference in New Issue
Block a user