Переглянути джерело

Pro follow-up appt feature (ec-121)

Vijayakrishnan 3 роки тому
батько
коміт
bcfca8ea42

+ 5 - 0
app/Models/Note.php

@@ -38,6 +38,11 @@ class Note extends Model
         return $this->hasOne(Pro::class, 'id', 'ally_pro_id');
     }
 
+    public function followUpAppointment()
+    {
+        return $this->hasOne(Appointment::class, 'id', 'follow_up_appointment_id');
+    }
+
     public function cmSetupClaim()
     {
         return $this->hasOne(Claim::class, 'id', 'cm_setup_claim_id')

+ 33 - 0
public/css/style.css

@@ -3115,4 +3115,37 @@ body.forced-masking #mask {
     background-position: center center;
     background-size: 20px;
     z-index: 9999;
+}
+
+/* toggle checkboxes */
+.mcp-theme-1 input[type="checkbox"][toggle] {
+    position: relative;
+    appearance: none;
+    width: 28px;
+    height: 16px;
+    background: #666;
+    border-radius: 16px;
+    cursor: pointer;
+}
+.mcp-theme-1 input[type="checkbox"][toggle]:checked {
+    background: var(--primary-color);
+}
+.mcp-theme-1 input[type="checkbox"][toggle]:after {
+    content: '';
+    position: absolute;
+    background: #fff;
+    border-radius: 100%;
+    height: 12px;
+    width: 12px;
+    left: 2px;
+    top: 2px;
+    transition: left 0.1s ease;
+}
+.mcp-theme-1 input[type="checkbox"][toggle]:checked:after {
+    background: #fff;
+    left: 14px;
+}
+.mcp-theme-1 input[type="checkbox"][toggle][disabled] {
+    opacity: 0.5;
+    cursor: not-allowed;
 }

+ 19 - 0
resources/views/app/patient/appointment-calendar.blade.php

@@ -1126,11 +1126,30 @@
                             this.inProgress = true;
                             let self = this;
                             showMask();
+
+                            // force ser proUid
+                            if(!$('#addApptPro').is(':visible')) {
+                                $('#addApptPro').val($('#addApptPro option[selected]').first().attr('value'));
+                            }
+
                             $.post(form.attr('action'), form.serialize(), function(_data) {
                                 if(_data) {
                                     if(_data.success) {
                                         self.refreshEvents();
                                         closeStagPopup();
+
+                                        // if fromNoteUid, associate as follow-up appt. and close calendar popup
+                                        @if(request()->input('fromNoteUid'))
+                                            $.post('/api/note/updateFollowUpStatus', {
+                                                uid: '{{request()->input('fromNoteUid')}}',
+                                                isFollowUpNeeded: 1,
+                                                followUpAppointmentUid: _data.data
+                                            }, _data => {
+                                                if(!hasResponseError(_data)) {
+                                                    closeStagPopup();
+                                                }
+                                            }, 'json');
+                                        @endif
                                     }
                                     else {
                                         toastr.error(_data.message);

+ 7 - 0
resources/views/app/patient/note/dashboard.blade.php

@@ -2361,6 +2361,13 @@
                     @include('app/patient/note/_cancel-signed-note')
                 </div>
 
+                {{-- follow-up appt. --}}
+                <div class="screen-only">
+                    <div class="border-top p-3" data-non-segment-section="Follow-up Appointment">
+                        @include('app/patient/note/follow-up-appointment')
+                    </div>
+                </div>
+
                 </div>
 
                 @if($isVisitTemplateBased && !$note->is_signed_by_hcp)

+ 15 - 0
resources/views/app/patient/note/dashboard_script.blade.php

@@ -5,6 +5,21 @@
 
             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();
+                            openDynamicStagPopup(
+                                '{{route('patients.view.calendar', ['patient' => $patient])}}?opUid={{$note->hcpPro ? $note->hcpPro->uid : ''}}&fromNoteUid={{$note->uid}}',
+                                'patient-calendar-{{$patient->id}}',
+                                'Book follow-up appointment for {{$patient->displayName()}}',
+                                true,
+                                'medium-large'
+                            );
+                        }
+                    });
+
                 // on note-section hover, highlight the according left-tree node(s)
                 $(document)
                     .off('mouseenter', '.note-section')

+ 29 - 0
resources/views/app/patient/note/follow-up-appointment.blade.php

@@ -0,0 +1,29 @@
+<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>
+        </div>
+    @endif
+</div>

+ 1 - 1
resources/views/app/patient/note/lhs-tree.blade.php

@@ -68,5 +68,5 @@
     @if($note->is_signed_by_hcp)
         <div class="note-tree-node mb-3"><a native="" target="_top" data-non-segment-target="Addendums" href="#">Addendums</a></div>
     @endif
-
+    <div class="note-tree-node mb-3"><a native="" target="_top" data-non-segment-target="Follow-up Appointment" href="#">Follow-up Appointment</a></div>
 </div>

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

@@ -92,6 +92,13 @@
         </div>
     </div>
 
+    {{-- fu appt --}}
+    @if(is_null($note->is_follow_up_needed))
+        <div class="p-3 mt-3 border bg-aliceblue">
+        @include('app/patient/note/follow-up-appointment', ['noMinHeight' => true])
+        </div>
+    @endif
+
     {{-- get problems(plan) and medications(plan) segments --}}
     <?php
     $problemsPlan = null;