Skip to content

Commit e7f3cd0

Browse files
committed
Adapted for translation
1 parent ef03773 commit e7f3cd0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

appointment/static/js/appointments.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ body.on('click', '.btn-submit-appointment', function () {
7777
const selectedSlot = $('.djangoAppt_appointment-slot.selected').text();
7878
const selectedDate = $('.djangoAppt_date_chosen').text();
7979
if (!selectedSlot || !selectedDate) {
80-
alert('Please select a date and time');
80+
alert(selectDateAndTimeAlertTxt);
8181
return;
8282
}
8383
if (selectedSlot && selectedDate) {
@@ -102,7 +102,7 @@ body.on('click', '.btn-submit-appointment', function () {
102102
} else {
103103
const warningContainer = $('.warning-message');
104104
if (warningContainer.find('submit-warning') === 0) {
105-
warningContainer.append('<p class="submit-warning">Please select a time slot before submitting the appointment request.</p>');
105+
warningContainer.append('<p class="submit-warning">' + selectTimeSlotWarningTxt + '</p>');
106106
}
107107
}
108108
});
@@ -194,7 +194,7 @@ function getAvailableSlots(selectedDate, staffId = null) {
194194
nextAvailableDateSelector.remove();
195195

196196
// Correctly check if staffId is 'none', null, or undefined and exit the function if true
197-
// Check if staffId is 'none', null, or undefined and display an error message
197+
// Check if 'staffId' is 'none', null, or undefined and display an error message
198198
if (staffId === 'none' || staffId === null || staffId === undefined) {
199199
console.log('No staff ID provided, displaying error message.');
200200
const errorMessage = $('<p class="djangoAppt_no-availability-text">'+ noStaffMemberSelectedTxt + '</p>');
@@ -234,7 +234,7 @@ function getAvailableSlots(selectedDate, staffId = null) {
234234

235235
if (selectedD < today) {
236236
// Show an error message
237-
errorMessageContainer.append('<p class="djangoAppt_no-availability-text">Date is in the past.</p>');
237+
errorMessageContainer.append('<p class="djangoAppt_no-availability-text">' + dateInPastErrorTxt + '</p>');
238238
if (slotContainer.find('.djangoAppt_btn-request-next-slot').length === 0) {
239239
slotContainer.append(`<button class="btn btn-danger djangoAppt_btn-request-next-slot" data-service-id="${serviceId}">` + requestNonAvailableSlotBtnTxt + `</button>`);
240240
}

appointment/templates/appointment/appointments.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ <h1 class="page-title">{{ service.name }}</h1>
111111
</script>
112112
<script>
113113
const requestNonAvailableSlotBtnTxt = "{% trans 'Request next available slot' %}";
114-
const noStaffMemberSelectedTxt = "{% trans 'No staff member selected.' %}"
114+
const noStaffMemberSelectedTxt = "{% trans 'No staff member selected.' %}";
115+
const selectTimeSlotWarningTxt = "{% trans 'Please select a time slot before submitting the appointment request.' %}";
116+
const dateInPastErrorTxt = "{% trans 'Date is in the past.' %}";
117+
const selectDateAndTimeAlertTxt = {% trans 'Please select a date and time' %};
115118
</script>
116119
<script src="{% static 'js/appointments.js' %}"></script>
117120
<script src="{% static 'js/js-utils.js' %}"></script>

0 commit comments

Comments
 (0)