Pārlūkot izejas kodu

Pro follow-up appt feature logic updates

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
a615cddde8

+ 27 - 4
resources/views/app/patient/note/dashboard_script.blade.php

@@ -6,10 +6,12 @@
             function init() {
 
                 $(document)
-                    .off('change.check-book-fu-appt', '.check-book-fu-appt')
-                    .on('change.check-book-fu-appt', '.check-book-fu-appt', function() {
-                        if(this.checked) {
-                            $('.no-fu-memo-form').hide();
+                    .off('change.check-book-fu-appt', '.fu-appt-container [name="is_follow_up_needed"]')
+                    .on('change.check-book-fu-appt', '.fu-appt-container [name="is_follow_up_needed"]', function() {
+                        let parent = $(this).closest('.fu-appt-container');
+                        let choice = +(parent.find('[name="is_follow_up_needed"]:checked').val());
+                        if(choice) {
+                            parent.find('.no-fu-memo-form').addClass('d-none');
                             openDynamicStagPopup(
                                 '{{route('patients.view.calendar', ['patient' => $patient])}}?opUid={{$note->hcpPro ? $note->hcpPro->uid : ''}}&fromNoteUid={{$note->uid}}',
                                 'patient-calendar-{{$patient->id}}',
@@ -18,6 +20,27 @@
                                 'medium-large'
                             );
                         }
+                        else {
+                            parent.find('.no-fu-memo-form').removeClass('d-none');
+                            parent.find('.no-fu-memo-form textarea').first().focus();
+                        }
+                    });
+
+                $(document)
+                    .off('click.cancel-fu-appt-form', '.fu-appt-container .cancel-fu-appt-form')
+                    .on('click.cancel-fu-appt-form', '.fu-appt-container .cancel-fu-appt-form', function() {
+                        let parent = $(this).closest('.fu-appt-container');
+                        parent.find('.no-fu-memo-form').addClass('d-none');
+                        parent.find('[name="is_follow_up_needed"]').prop('checked', false);
+                        return false;
+                    });
+
+                $(document)
+                    .off('click.update-fu-appt-status', '.fu-appt-container .update-fu-appt-status')
+                    .on('click.update-fu-appt-status', '.fu-appt-container .update-fu-appt-status', function() {
+                        let parent = $(this).closest('.fu-appt-container');
+                        parent.find('.fu-appt-choices').removeClass('d-none').addClass('d-flex');
+                        return false;
                     });
 
                 // on note-section hover, highlight the according left-tree node(s)

+ 47 - 25
resources/views/app/patient/note/follow-up-appointment.blade.php

@@ -1,29 +1,51 @@
 <div class="{{ !@$noMinHeight ? 'min-height-300px' : ''}} fu-appt-container">
-    <div class="d-flex align-items-center mb-2">
-        <p class="font-weight-bold text-secondary my-0 mr-2">Would you like to book a follow-up Appointment?</p>
-        <input type="checkbox" toggle class="check-book-fu-appt" {{$note->is_follow_up_needed ? 'checked disabled' : ''}} {{is_null($note->is_follow_up_needed) ? 'not-set' : '' }}>
-    </div>
-    @if($note->is_follow_up_needed === true)
-        @if(!$note->follow_up_appointment_id)
-            Follow up appointment marked as needed but <b>not booked yet!</b>
-        @else
-            Follow up appointment on <b>{{$note->followUpAppointment ? friendly_date($note->followUpAppointment->raw_date) : '-'}}</b>
-            <span class="text-sm">(Status: {{$note->followUpAppointment ? $note->followUpAppointment->status : '-'}})</span>
-        @endif
-    @else
-        <div moe class="no-fu-memo-form">
-            <form show url="/api/note/updateFollowUpStatus" class="d-block">
-                <input type="hidden" name="uid" value="{{$note->uid}}">
-                <input type="hidden" name="isFollowUpNeeded" value="0">
-                <div class="d-flex align-items-baseline mb-2">
-                    <span class="text-nowrap mr-2">Reason for not booking:</span>
-                    <input type="text" class="form-control form-control-sm width-300px no-fu-memo" name="followUpNotNeededMemo" value="{{$note->follow_up_not_needed_memo}}" required>
-                </div>
-                <div class="mb-0">
-                    <button class="btn btn-primary btn-sm mr-1">Submit</button>
-                    <button class="btn btn-default border bg-white btn-sm">Reset</button>
-                </div>
-            </form>
+
+    @if(!is_null($note->is_follow_up_needed))
+        <div class="mb-3 d-flex align-items-baseline">
+            <div>
+                @if($note->is_follow_up_needed === true)
+                    @if(!$note->follow_up_appointment_id)
+                        {{-- this will/should never happen! --}}
+                        Follow up appointment marked as needed but <b>not booked yet!</b>
+                    @else
+                        Follow up appointment on
+                        <b>{{$note->followUpAppointment ? friendly_date($note->followUpAppointment->raw_date) : '-'}}</b>
+                        <span class="text-sm">(Status: {{$note->followUpAppointment ? $note->followUpAppointment->status : '-'}})</span>
+                    @endif
+                @else
+                    Follow up appointment not needed. Reason: <b>{{$note->follow_up_not_needed_memo}}</b>
+                @endif
+            </div>
+            <a href="#" class="ml-3 update-fu-appt-status"><i class="fa fa-edit"></i></a>
         </div>
     @endif
+
+    <div class="align-items-baseline mb-3 fu-appt-choices {{!is_null($note->is_follow_up_needed) ? 'd-none' : 'd-flex'}}">
+        <p class="font-weight-bold text-secondary my-0 mr-3">Would you like to book a follow-up appointment?</p>
+        <label class="d-inline-flex align-items-center mr-3">
+            <input type="radio" name="is_follow_up_needed" value="1">
+            <span class="ml-1">Yes</span>
+        </label>
+        <label class="d-inline-flex align-items-center mr-3">
+            <input type="radio" name="is_follow_up_needed" value="0">
+            <span class="ml-1 mr-3">No</span>
+        </label>
+    </div>
+
+    <div moe class="no-fu-memo-form mb-3 d-none">
+        <form show url="/api/note/updateFollowUpStatus">
+            <input type="hidden" name="uid" value="{{$note->uid}}">
+            <input type="hidden" name="isFollowUpNeeded" value="0">
+            <div class="d-flex align-items-start mb-3">
+                <span class="text-nowrap mr-2">Please indicate why follow-up<br>appointment is not needed:</span>
+                <textarea class="form-control form-control-sm width-300px no-fu-memo"
+                         rows="2" name="followUpNotNeededMemo" required>{{$note->follow_up_not_needed_memo}}</textarea>
+            </div>
+            <div class="mb-0">
+                <button class="btn btn-primary btn-sm mr-1" submit>Submit</button>
+                <button class="btn btn-default bg-white border btn-sm mr-1 cancel-fu-appt-form">Cancel</button>
+            </div>
+        </form>
+    </div>
+
 </div>

+ 10 - 10
resources/views/app/patient/note/sign-confirmation.blade.php

@@ -93,11 +93,9 @@
     </div>
 
     {{-- fu appt --}}
-    @if(is_null($note->is_follow_up_needed))
-        <div class="p-3 mt-3 border bg-aliceblue">
+    <div class="px-3 pt-3 mt-3 border bg-aliceblue">
         @include('app/patient/note/follow-up-appointment', ['noMinHeight' => true])
-        </div>
-    @endif
+    </div>
 
     {{-- get problems(plan) and medications(plan) segments --}}
     <?php
@@ -128,13 +126,15 @@
         </div>
     @endif
 
-    <hr class="m-neg-3">
-    <p class="my-3">After signing - you will not be able to modify content. You may only add addendums.</p>
+    @if(!is_null($note->is_follow_up_needed))
+        <hr class="m-neg-3">
+        <p class="my-3">After signing - you will not be able to modify content. You may only add addendums.</p>
 
-    <div class="d-flex align-items-center justify-content-center">
-        <button class="btn btn-success btn-sm font-weight-bold px-3 btn-sign">Sign</button>
-        <button class="ml-3 btn btn-default border btn-sm px-3" onclick="return closeStagPopup()">Close</button>
-    </div>
+        <div class="d-flex align-items-center justify-content-center">
+            <button class="btn btn-success btn-sm font-weight-bold px-3 btn-sign">Sign</button>
+            <button class="ml-3 btn btn-default border btn-sm px-3" onclick="return closeStagPopup()">Close</button>
+        </div>
+    @endif
 
 </div>