feat: configurable redirect on success
diff --git a/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.json b/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.json
index 25a7c69..aafdfd9 100644
--- a/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.json
+++ b/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.json
@@ -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",
diff --git a/erpnext/www/book-appointment/index.js b/erpnext/www/book-appointment/index.js
index b91e3b0..433b956 100644
--- a/erpnext/www/book-appointment/index.js
+++ b/erpnext/www/book-appointment/index.js
@@ -200,16 +200,32 @@
         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() {
diff --git a/erpnext/www/book-appointment/index.py b/erpnext/www/book-appointment/index.py
index 163fdc0..5b60dd5 100644
--- a/erpnext/www/book-appointment/index.py
+++ b/erpnext/www/book-appointment/index.py
@@ -107,6 +107,7 @@
 	appointment.customer_email = contact.get('email', None)
 	appointment.status = 'Open'
 	appointment.insert()
+	return appointment
 
 # Helper Functions
 def filter_timeslots(date, timeslots):