mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
fix:readability
This commit is contained in:
@@ -34,7 +34,7 @@ function setup_timezone_selector() {
|
||||
window.timezones.forEach(timezone => {
|
||||
let opt = document.createElement('option');
|
||||
opt.value = timezone;
|
||||
if(timezone == moment.tz.guess()){
|
||||
if (timezone == moment.tz.guess()) {
|
||||
opt.selected = true;
|
||||
}
|
||||
opt.innerHTML = timezone;
|
||||
@@ -140,7 +140,7 @@ function select_time() {
|
||||
return;
|
||||
}
|
||||
let selected_element = document.getElementsByClassName('selected');
|
||||
if (!(selected_element.length > 0)){
|
||||
if (!(selected_element.length > 0)) {
|
||||
this.classList.add('selected');
|
||||
show_next_button();
|
||||
return;
|
||||
@@ -191,7 +191,7 @@ function setup_details_page() {
|
||||
|
||||
async function submit() {
|
||||
let form = document.querySelector('#customer-form');
|
||||
if(!form.checkValidity()){
|
||||
if (!form.checkValidity()) {
|
||||
form.reportValidity();
|
||||
return;
|
||||
}
|
||||
@@ -211,7 +211,6 @@ async function submit() {
|
||||
}
|
||||
|
||||
function get_form_data() {
|
||||
|
||||
contact = {};
|
||||
contact.name = document.getElementById('customer_name').value;
|
||||
contact.number = document.getElementById('customer_number').value;
|
||||
|
||||
@@ -9,21 +9,26 @@ WEEKDAYS = ["Monday", "Tuesday", "Wednesday",
|
||||
|
||||
no_cache = 1
|
||||
|
||||
|
||||
def get_context(context):
|
||||
is_enabled = frappe.db.get_single_value('Appointment Booking Settings','enable_scheduling')
|
||||
is_enabled = frappe.db.get_single_value(
|
||||
'Appointment Booking Settings', 'enable_scheduling')
|
||||
if is_enabled:
|
||||
return context
|
||||
else:
|
||||
raise frappe.DoesNotExistError
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_appointment_settings():
|
||||
settings = frappe.get_doc('Appointment Booking Settings')
|
||||
return settings
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def is_enabled():
|
||||
enable_scheduling = frappe.db.get_single_value('Appointment Booking Settings','enable_scheduling')
|
||||
enable_scheduling = frappe.db.get_single_value(
|
||||
'Appointment Booking Settings', 'enable_scheduling')
|
||||
return enable_scheduling
|
||||
|
||||
|
||||
@@ -131,15 +136,18 @@ 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:
|
||||
@@ -147,10 +155,12 @@ 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)
|
||||
return (date_time-midnight)
|
||||
|
||||
Reference in New Issue
Block a user