Răsfoiți Sursa

Care month: Hide CM & Show BDT device measurements

Vijayakrishnan Krishnan 4 ani în urmă
părinte
comite
ea945f75da
1 a modificat fișierele cu 70 adăugiri și 6 ștergeri
  1. 70 6
      resources/views/app/patient/care-month/dashboard.blade.php

+ 70 - 6
resources/views/app/patient/care-month/dashboard.blade.php

@@ -192,9 +192,10 @@
         }
         ?>
 
+        {{-- RM --}}
         <div class="row">
             @if($careMonth->is_client_enrolled_in_rm)
-                <div class="col-6">
+                <div class="col-8">
                     <div class="d-flex align-items-center">
                         <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">RM Time Entries</h6>
                         @if(!$activeRMBill)
@@ -327,9 +328,9 @@
                     </table>
                 </div>
             @else
-                <div class="col-6">
-                    <h6 class="mb-3 text-secondary font-weight-bold text-dark">RM Time Entries</h6>
-                    <div class="alert alert-secondary mb-0">
+                <div class="col-8">
+                    <h6 class="mb-2 text-secondary font-weight-bold text-dark lh-24px">RM Time Entries</h6>
+                    <div class="alert alert-secondary mt-2 mb-0">
                         <b>{{ $patient->displayName() }}</b> is currently not enrolled in <b>RM</b>.
                         <span moe class="">
                         <a start show class="font-weight-bold">Enroll Now</a>
@@ -346,6 +347,8 @@
                 </div>
             @endif
 
+            {{-- CM --}}
+            <?php /*
             @if($careMonth->is_tm_this_month)
                 <div class="col-6">
                     <div class="d-flex align-items-center">
@@ -520,16 +523,75 @@
                     </div>
                 @endif
             @endif
+            */ ?>
+
+            {{-- BDT Measurements --}}
+            <div class="col-4">
+                <div class="d-flex align-items-center">
+                    <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Device Measurements</h6>
+                </div>
+                <table class="table table-striped table-sm table-bordered mt-2 mb-0">
+                    @if($patient->measurements && count($patient->measurements))
+                        <thead>
+                        <tr>
+                            <th class="px-2 text-secondary">Created</th>
+                            <th class="px-2 text-secondary w-25">Category</th>
+                            <th class="px-2 text-secondary w-50">Value</th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        <?php $numMeasurementsInCareMonth = 0; ?>
+                        @foreach($patient->deviceMeasurements as $measurement)
+                            <?php
+                            $m = date("m", strtotime($measurement->created_at));
+                            $y = date("Y", strtotime($measurement->created_at));
+                            $cmM = date("m", strtotime($careMonth->start_date));
+                            $cmY = date("Y", strtotime($careMonth->start_date));
+                            if($m === $cmM && $y === $cmY) {
+                                $numMeasurementsInCareMonth++;
+                            ?>
+                                <tr>
+                                    <td class="px-2">{{ friendly_date_time($measurement->created_at) }}</td>
+                                    <td class="px-2">{{ $measurement->measurement->device_category }}</td>
+                                    <td class="px-2">
+                                        @if($measurement->measurement->device_category === 'WEIGHT')
+                                            <b>{{ round($measurement->measurement->value_weight / 1000, 1) }} Kg</b>
+                                        @elseif($measurement->measurement->device_category === 'BP')
+                                            <b>{{ $measurement->measurement->value_systolic }}/{{ $measurement->measurement->value_diastolic }} mmHg</b>
+                                        @endif
+                                    </td>
+                                </tr>
+                            <?php
+                            }
+                            ?>
+                        @endforeach
+                        @if(!$numMeasurementsInCareMonth)
+                            <tr>
+                                <td colspan="3" class="p-2">
+                                    No device measurements in {{ friendly_month($careMonth->start_date) }}
+                                </td>
+                            </tr>
+                        </tbody>
+                        @endif
+                    @else
+                        <tbody>
+                        <tr>
+                            <td class="text-secondary p-3">No device measurements for this patient</td>
+                        </tr>
+                        </tbody>
+                    @endif
+                </table>
+            </div>
         </div>
 
-        @if((!$careMonth->is_tm_this_month && $careMonth->is_client_enrolled_in_cm) || $careMonth->is_client_enrolled_in_rm)
+        @if(!$careMonth->is_tm_this_month && $careMonth->is_client_enrolled_in_rm)
         <hr class="m-negator mt-4 mb-3">
         @endif
 
         <div class="row">
 
             {{-- rm bills --}}
-            <div class="col-6">
+            <div class="col-8">
                 @if($careMonth->is_client_enrolled_in_rm)
                     <div class="d-flex align-items-center">
                         <h6 class="my-0 text-secondary font-weight-bold text-dark">RM Bill
@@ -758,6 +820,7 @@
             </div>
 
             {{-- cm bills --}}
+            <?php /*
             @if($careMonth->is_tm_this_month)
                 <div class="col-6">
                     {{-- no cm bills in tm month --}}
@@ -948,6 +1011,7 @@
                     @endif
                 </div>
             @endif
+            */ ?>
 
         </div>