pranav nachnekar | 7b9e309 | 2019-08-28 16:57:37 +0530 | [diff] [blame] | 1 | import frappe |
| 2 | import datetime |
| 3 | |
| 4 | |
| 5 | def get_context(context): |
| 6 | context.date = frappe.form_dict['date'] |
| 7 | settings = frappe.get_doc('Appointment Booking Settings') |
| 8 | holiday_list = frappe.get_doc('Holiday List', settings.holiday_list) |
| 9 | if(is_holiday(context.date,holiday_list)): |
| 10 | context.is_holiday = True |
| 11 | return context |
| 12 | get_time_slots(context.date,settings) |
| 13 | # time_slots = get_time_slots(date) |
| 14 | return context |
| 15 | |
| 16 | def is_holiday(date,holiday_list): |
| 17 | for holiday in holiday_list.holidays: |
| 18 | if holiday.holiday_date.isoformat() == date: |
| 19 | print('matched') |
| 20 | return True |
| 21 | return False |
| 22 | |
| 23 | |
| 24 | |
| 25 | def _deltatime_to_time(deltatime): |
| 26 | return (datetime.datetime.min + deltatime).time() |
| 27 | |
| 28 | weekdays = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"] |