Browse Source

ERx CANCELLED UI

Vijayakrishnan 3 years ago
parent
commit
ba03a6bcb2

+ 2 - 2
app/Models/Client.php

@@ -106,10 +106,10 @@ class Client extends Model
     public function prescriptions()
     public function prescriptions()
     {
     {
         return $this->hasMany(Erx::class, 'client_id', 'id')
         return $this->hasMany(Erx::class, 'client_id', 'id')
-            ->where(function ($q) {
+            /*->where(function ($q) {
                 $q->whereNull('pro_declared_status')
                 $q->whereNull('pro_declared_status')
                     ->orWhere('pro_declared_status', '<>', 'CANCELLED');
                     ->orWhere('pro_declared_status', '<>', 'CANCELLED');
-            })
+            })*/
             ->orderBy('created_at', 'desc')
             ->orderBy('created_at', 'desc')
             ->orderByRaw('note_id DESC NULLS LAST');
             ->orderByRaw('note_id DESC NULLS LAST');
     }
     }

+ 47 - 14
resources/views/app/patient/prescriptions/list.blade.php

@@ -33,24 +33,30 @@
                 <tr>
                 <tr>
                     <th class="border-0 text-secondary width-150px">Created</th>
                     <th class="border-0 text-secondary width-150px">Created</th>
                     <th class="border-0 text-secondary" :class="currentPrescription ? 'width-200px' : ''">Clinical</th>
                     <th class="border-0 text-secondary" :class="currentPrescription ? 'width-200px' : ''">Clinical</th>
+                    <th v-if="!currentPrescription">Prescriber</th>
+                    <th v-if="!currentPrescription">Status</th>
+                    <th v-if="!currentPrescription">Sign</th>
+                    <th v-if="!currentPrescription">Client Status</th>
                 </tr>
                 </tr>
                 </thead>
                 </thead>
                 <tbody>
                 <tbody>
                 <tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
                 <tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
                     <td class="width-150px" :class="currentPrescription && currentPrescription.id === prescription.id ? 'row-selection-highlight' : ''">
                     <td class="width-150px" :class="currentPrescription && currentPrescription.id === prescription.id ? 'row-selection-highlight' : ''">
-                        <a href="#" v-on:click.prevent="setCurrentPrescription(prescription, '');"
-                           class="text-nowrap"
-                           :class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">
-                            @{{prescription.created_at_friendly_short}}
-                        </a>
-                        <div class="mt-1">
-                            <b class="text-sm">@{{prescription.erx_category}}</b>
-                            /
-                            <span class="text-sm">@{{prescription.hcpProDisplayName}}</span>
+                        <div :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
+                            <a href="#" v-on:click.prevent="setCurrentPrescription(prescription, '');"
+                               class="text-nowrap"
+                               :class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">
+                                @{{prescription.created_at_friendly_short}}
+                            </a>
+                            <div class="mt-1">
+                                <b class="text-sm">@{{prescription.erx_category}}</b>
+                                /
+                                <span class="text-sm">@{{prescription.hcpProDisplayName}}</span>
+                            </div>
+                            @if(@$note)
+                                <div v-if="prescription.note_id === {{$note->id}}" class="text-sm text-info mt-1 text-nowrap">* From this note</div>
+                            @endif
                         </div>
                         </div>
-                        @if(@$note)
-                            <div v-if="prescription.note_id === {{$note->id}}" class="text-sm text-info mt-1 text-nowrap">* From this note</div>
-                        @endif
                         <div v-if="prescription.pro_declared_status === 'CANCELLED'" class="text-sm text-secondary font-weight-bold mt-1 text-sm d-flex align-items-baseline">
                         <div v-if="prescription.pro_declared_status === 'CANCELLED'" class="text-sm text-secondary font-weight-bold mt-1 text-sm d-flex align-items-baseline">
                             <i class="fa fa-ban mr-1 text-sm"></i>
                             <i class="fa fa-ban mr-1 text-sm"></i>
                             CANCELLED
                             CANCELLED
@@ -62,7 +68,7 @@
                             <a v-if="!prescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
                             <a v-if="!prescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
                             <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
                             <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
                             --}}
                             --}}
-                            <div v-if="prescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
+                            <div v-if="prescription.clinical_detail_json" class="d-inline-flex align-items-baseline" :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
                                 <div class="" v-if="prescription.erx_category === 'DRUG'">
                                 <div class="" v-if="prescription.erx_category === 'DRUG'">
                                     <div class="d-flex align-items-baseline mb-1" v-for="drug in prescription.clinical_detail_json.items">
                                     <div class="d-flex align-items-baseline mb-1" v-for="drug in prescription.clinical_detail_json.items">
                                         <span class="mr-2">@{{drug.medication ?? '-'}}</span>
                                         <span class="mr-2">@{{drug.medication ?? '-'}}</span>
@@ -96,6 +102,32 @@
                             <div v-else>-</div>
                             <div v-else>-</div>
                         </div>
                         </div>
                     </td>
                     </td>
+                    <td v-if="!currentPrescription">
+                        <div :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
+                            @{{ prescription.hcpProDisplayName }}
+                        </div>
+                    </td>
+                    <td v-if="!currentPrescription">
+                        <div :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
+                            @{{ sanitizeStatus(prescription.pro_declared_status) }}
+                        </div>
+                    </td>
+                    <td v-if="!currentPrescription">
+                        <div :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
+                            <div v-if="prescription.has_hcp_pro_signed" class="d-inline-flex align-items-baseline">
+                                <i class="text-secondary fa fa-check mr-1"></i>
+                                <span class="text-secondary">Signed</span>
+                            </div>
+                            <div v-else>
+                                -
+                            </div>
+                        </div>
+                    </td>
+                    <td v-if="!currentPrescription">
+                        <div :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
+                            @{{ sanitizeStatus(prescription.client_declared_status) }}
+                        </div>
+                    </td>
                 </tr>
                 </tr>
                 </tbody>
                 </tbody>
             </table>
             </table>
@@ -1246,6 +1278,7 @@ GROUP BY erx_category");
 
 
                     // sane display status
                     // sane display status
                     sanitizeStatus: function(_s) {
                     sanitizeStatus: function(_s) {
+                        if(!_s) return '-';
                         _s = _s.toLowerCase().replaceAll('_', ' ');
                         _s = _s.toLowerCase().replaceAll('_', ' ');
                         _s = _s[0].toUpperCase() + _s.substr(1);
                         _s = _s[0].toUpperCase() + _s.substr(1);
                         return _s;
                         return _s;
@@ -1442,7 +1475,7 @@ GROUP BY erx_category");
                         }
                         }
 
 
                         @if(@$note)
                         @if(@$note)
-                        localStorage['currentErx_{{$note->id}}'] = _prescription.id;
+                        localStorage['currentErx_{{$note->id}}'] = _prescription ? _prescription.id : -1;
                         @endif
                         @endif
                     },
                     },
                     setAddMode: function(_mode) {
                     setAddMode: function(_mode) {

+ 1 - 0
resources/views/app/patient/prescriptions/pro-status-form.blade.php

@@ -14,6 +14,7 @@
                 <option value="SENT">Sent</option>
                 <option value="SENT">Sent</option>
                 <option value="RECEIVED_BY_CLIENT">Received by client</option>
                 <option value="RECEIVED_BY_CLIENT">Received by client</option>
                 <option value="RECEIPT_CONFIRMED_BY_FACILITY">Receipt confirmed by facility</option>
                 <option value="RECEIPT_CONFIRMED_BY_FACILITY">Receipt confirmed by facility</option>
+                <option value="CANCELLED">Cancelled</option>
             </select>
             </select>
         </div>
         </div>
         <div class="mb-2">
         <div class="mb-2">