mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +00:00
Added flow for verifying emails
This commit is contained in:
@@ -111,18 +111,15 @@ def filter_timeslots(date, timeslots):
|
||||
filtered_timeslots.append(timeslot)
|
||||
return filtered_timeslots
|
||||
|
||||
|
||||
def check_availabilty(timeslot, settings):
|
||||
return frappe.db.count('Appointment', {'scheduled_time': timeslot}) < settings.number_of_agents
|
||||
|
||||
|
||||
def _is_holiday(date, holiday_list):
|
||||
for holiday in holiday_list.holidays:
|
||||
if holiday.holiday_date == date:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _get_records(start_time, end_time, settings):
|
||||
records = []
|
||||
for record in settings.availability_of_slots:
|
||||
@@ -130,17 +127,14 @@ def _get_records(start_time, end_time, settings):
|
||||
records.append(record)
|
||||
return records
|
||||
|
||||
|
||||
def _deltatime_to_datetime(date, deltatime):
|
||||
time = (datetime.datetime.min + deltatime).time()
|
||||
return datetime.datetime.combine(date.date(), time)
|
||||
|
||||
|
||||
def _datetime_to_deltatime(date_time):
|
||||
midnight = datetime.datetime.combine(date_time.date(), datetime.time.min)
|
||||
return (date_time-midnight)
|
||||
|
||||
|
||||
def _convert_to_ist(datetime_object, timezone):
|
||||
offset = datetime.timedelta(minutes=timezone)
|
||||
datetime_object = datetime_object + offset
|
||||
@@ -148,7 +142,6 @@ def _convert_to_ist(datetime_object, timezone):
|
||||
datetime_object = datetime_object - offset
|
||||
return datetime_object
|
||||
|
||||
|
||||
def _convert_to_tz(datetime_object, timezone):
|
||||
offset = datetime.timedelta(minutes=timezone)
|
||||
datetime_object = datetime_object - offset
|
||||
|
||||
18
erpnext/www/book-appointment/verify/index.html
Normal file
18
erpnext/www/book-appointment/verify/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% extends "templates/web.html" %}
|
||||
|
||||
{% block title %}
|
||||
{{ _("Verify Email") }}
|
||||
{% endblock%}
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
{% if success==True %}
|
||||
<div class="alert alert-success">
|
||||
Your email has been verified and your appointment has been scheduled
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-danger">
|
||||
Verification failed please check the link
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock%}
|
||||
14
erpnext/www/book-appointment/verify/index.py
Normal file
14
erpnext/www/book-appointment/verify/index.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import frappe
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_context(context):
|
||||
email = frappe.form_dict['email']
|
||||
appointment_name = frappe.form_dict['appointment']
|
||||
if email and appointment_name:
|
||||
appointment = frappe.get_doc('Appointment',appointment_name)
|
||||
appointment.set_verified(email)
|
||||
context.success = True
|
||||
return context
|
||||
else:
|
||||
print('Something not found')
|
||||
context.success = False
|
||||
return context
|
||||
Reference in New Issue
Block a user