소스 검색

Manage appt. UI updates

Vijayakrishnan 4 년 전
부모
커밋
5e658c6a0e
1개의 변경된 파일14개의 추가작업 그리고 4개의 파일을 삭제
  1. 14 4
      resources/views/app/patient/manage-appointment.blade.php

+ 14 - 4
resources/views/app/patient/manage-appointment.blade.php

@@ -74,7 +74,13 @@
                        placeholder="(optional)">
             </div>
             <div class="mb-3">
-                <button class="btn btn-sm btn-primary d-block w-100 font-weight-bold">Set Appointment</button>
+                <button class="btn btn-sm btn-primary d-block w-100 font-weight-bold">
+                    @if($appointment && $appointment->uid)
+                        Update Appointment
+                    @else
+                        Book Appointment
+                    @endif
+                </button>
             </div>
         </form>
         <div class="appt-calendar-col pl-2 border-left border-light">
@@ -131,7 +137,7 @@
                         $('.appt-form [name="date"]').val(info.dateStr.substr(0, 10));
                     },
                     eventClassNames: function(arg) {
-                        @if($appointment)
+                        @if($appointment && $appointment->uid)
                             if(arg.event.extendedProps.appointmentUid === '{{ $appointment->uid }}') {
                                 return ['stag-current-appt'];
                             }
@@ -163,7 +169,7 @@
                     $('.appt-form [name="endTime"]').val($('.appt-form [name="endTime"]').val().substr(0, 5));
                     $.post(form.attr('action'), form.serialize(), function(_data) {
                         if(_data && _data.success) {
-                            @if($appointment)
+                            @if($appointment && $appointment->uid)
                                 toastr.success('Appointment updated successfully');
                             @else
                                 toastr.success('Appointment booked successfully');
@@ -175,7 +181,11 @@
                                 toastr.error(_data.message);
                             }
                             else {
-                                toastr.error('Unable to book appointment!');
+                                @if($appointment && $appointment->uid)
+                                    toastr.error('Unable to update appointment!');
+                                @else
+                                    toastr.error('Unable to book appointment!');
+                                @endif
                             }
                         }
                     }, 'json');