Skip to content

Commit

Permalink
Fixed discrepancy between #165 and later PR
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspd committed May 18, 2024
1 parent 45d9725 commit d957bd8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion appointment/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
__url__ = "https://github.com/adamspd/django-appointment"
__package_website__ = "https://django-appt.adamspierredavid.com/"
__package_doc_url__ = "https://django-appt-doc.adamspierredavid.com/overview.html"
__version__ = "3.5.0"
__version__ = "3.5.1"
__test_version__ = False
6 changes: 2 additions & 4 deletions appointment/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,7 @@ def handle_service_management_request(post_data, files_data=None, service_id=Non

def create_new_appointment(data, request):
service = Service.objects.get(id=data.get("service_id"))
print(f"service id {data.get('service_id')}")
print(f"Service: {service}")
staff_id = data.get("staff_id")
staff_id = data.get("staff_member")
if staff_id:
staff_member = StaffMember.objects.get(id=staff_id)
else:
Expand Down Expand Up @@ -618,7 +616,7 @@ def create_new_appointment(data, request):
def update_existing_appointment(data, request):
try:
appt = Appointment.objects.get(id=data.get("appointment_id"))
staff_id = data.get("staff_id")
staff_id = data.get("staff_member")
want_reminder = data.get("want_reminder") == 'true'
appt = save_appointment(
appt,
Expand Down
4 changes: 2 additions & 2 deletions appointment/static/js/app_admin/staff_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ async function populateStaffMembers(selectedStaffId, isEditMode = false) {

// Function to fetch services for a specific staff member
async function fetchServicesForStaffMember(staffId) {
const url = `${fetchServiceListForStaffURL}?staff_id=${staffId}`;
const url = `${fetchServiceListForStaffURL}?staff_member=${staffId}`;
try {
const response = await fetch(url);
if (!response.ok) throw new Error('Network response was not ok');
Expand Down Expand Up @@ -779,7 +779,7 @@ function collectFormDataFromModal(modal) {
};

if (staffId) {
data.staff_id = staffId;
data.staff_member = staffId;
}

inputs.forEach(input => {
Expand Down
2 changes: 1 addition & 1 deletion appointment/static/js/appointments.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function fetchNonWorkingDays(staffId, callback) {
return; // Exit the function early
}
let ajaxData = {
'staff_id': staffId,
'staff_member': staffId,
};

$.ajax({
Expand Down
6 changes: 3 additions & 3 deletions appointment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def get_available_slots_ajax(request):
"""

slot_form = SlotForm(request.GET)
error_code = 0
if not slot_form.is_valid():
custom_data = {'error': True, 'available_slots': [], 'date_chosen': ''}
if 'selected_date' in slot_form.errors:
Expand Down Expand Up @@ -114,7 +115,7 @@ def get_next_available_date_ajax(request, service_id):
:param service_id: The ID of the service.
:return: A JSON response containing the next available date.
"""
staff_id = request.GET.get('staff_id')
staff_id = request.GET.get('staff_member')

# If staff_id is not provided, you should handle it accordingly.
if staff_id and staff_id != 'none':
Expand Down Expand Up @@ -156,8 +157,7 @@ def get_next_available_date_ajax(request, service_id):


def get_non_working_days_ajax(request):
staff_id = request.GET.get('staff_id')
print(f"staff_id: {staff_id}")
staff_id = request.GET.get('staff_member')
error = False
message = _('Successfully retrieved non-working days')

Expand Down
2 changes: 1 addition & 1 deletion appointment/views_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def add_or_update_staff_info(request, user_id=None):
@require_staff_or_superuser
def fetch_service_list_for_staff(request):
appointment_id = request.GET.get('appointmentId')
staff_id = request.GET.get('staff_id')
staff_id = request.GET.get('staff_member')
if appointment_id:
# Fetch services for a specific appointment (edit mode)
if request.user.is_superuser:
Expand Down

0 comments on commit d957bd8

Please sign in to comment.