Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions appointment/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from babel.numbers import get_currency_symbol
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator, MinLengthValidator, MaxLengthValidator
from django.core.validators import MaxLengthValidator, MinLengthValidator, MinValueValidator
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from phonenumber_field.modelfields import PhoneNumberField

from appointment.utils.date_time import get_timestamp, get_weekday_num, convert_minutes_in_human_readable_format, \
from appointment.utils.date_time import convert_minutes_in_human_readable_format, get_timestamp, get_weekday_num, \
time_difference
from appointment.utils.view_helpers import generate_random_id, get_locale

Expand Down Expand Up @@ -557,6 +557,8 @@ class Config(models.Model):
default="",
help_text=_("Name of your website."),
)
app_offered_by_label = models.CharField(max_length=255, default=_("Offered by"),
help_text=_("Label for `Offered by` on the appointment page"))

# meta data
created_at = models.DateTimeField(auto_now_add=True)
Expand Down
2 changes: 1 addition & 1 deletion appointment/templates/appointment/appointments.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1 class="page-title">{{ service.name }}</h1>
class="appointment-form">
{% csrf_token %}
<div class="staff-members-list">
<label class="djangoAppt_item-name" for="staff_id">{% trans "Offered by" %}</label>
<label class="djangoAppt_item-name" for="staff_id">{{ label }}</label>
<select name="staff_member" id="staff_id">
{% if not staff_member %}
<option value="none" selected>{% trans 'Please select a staff member' %}</option>
Expand Down
8 changes: 6 additions & 2 deletions appointment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from appointment.email_sender import notify_admin
from appointment.forms import AppointmentRequestForm, AppointmentForm
from appointment.logger_config import logger
from appointment.models import Service, Appointment, AppointmentRequest, EmailVerificationCode, StaffMember, DayOff
from appointment.models import Config, Service, Appointment, AppointmentRequest, EmailVerificationCode, StaffMember, \
DayOff
from appointment.utils.db_helpers import get_website_name, get_user_model, create_payment_info_and_get_url, \
get_user_by_email, \
get_non_working_days_for_staff, check_day_off_for_staff, create_new_user, create_and_save_appointment, \
Expand Down Expand Up @@ -73,7 +74,7 @@ def get_available_slots_ajax(request):
message = _("Day off. Please select another date!")
custom_data['available_slots'] = []
return json_response(message=message, custom_data=custom_data, success=False, error_code=ErrorCode.INVALID_DATE)
# if selected_date is not a working day for the staff, return an empty list of slots and message is Day Off
# if selected_date is not a working day for the staff, return an empty list of slots and 'message' is Day Off
weekday_num = get_weekday_num_from_date(selected_date)
is_working_day_ = is_working_day(staff_member=sm, day=weekday_num)
if not is_working_day_:
Expand Down Expand Up @@ -178,6 +179,8 @@ def appointment_request(request, service_id=None, staff_member_id=None):
staff_member = None
all_staff_members = None
available_slots = []
config = Config.objects.first()
label = config.app_offered_by_label if config else _("Offered by")

if service_id:
service = get_object_or_404(Service, pk=service_id)
Expand Down Expand Up @@ -207,6 +210,7 @@ def appointment_request(request, service_id=None, staff_member_id=None):
'date_chosen': date_chosen,
'locale': get_locale(),
'timezoneTxt': get_timezone_txt(),
'label': label
}
context = get_generic_context_with_extra(request, extra_context, admin=False)
return render(request, 'appointment/appointments.html', context=context)
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Django==4.2.7
Pillow==10.1.0
phonenumbers==8.13.24
phonenumbers==8.13.25
django-phonenumber-field==7.2.0
babel==2.13.1
setuptools==68.2.2
setuptools==69.0.0
pytz~=2023.3.post1