Răsfoiți Sursa

Merge branch 'master' of rav.triplestart.com:jmudaka/stagfe2

root 3 ani în urmă
părinte
comite
99b421b223

+ 1 - 0
app/Http/Controllers/HomeController.php

@@ -537,6 +537,7 @@ WHERE cl.shadow_pro_id IS NULL
             SELECT cs.* ,c.uid as client_uid, c.name_first as client_name_first, c.name_last as client_name_last FROM client_sms cs LEFT JOIN client c ON c.id = cs.client_id
             WHERE cs.is_reply_needed = 'YES' AND c.mcp_pro_id = :mcp_pro_id AND incoming_or_outgoing = 'INCOMING'
             AND (cs.created_at > c.last_sms_sent_to_client_at OR c.last_sms_sent_to_client_at IS NULL)
+            ORDER BY created_at DESC
         ", ['mcp_pro_id' => $performer->pro->id]);
 
         return view('app/dashboard-mcp', compact('keyNumbers', 'reimbursement', 'milliseconds',

+ 2 - 16
app/Models/Client.php

@@ -299,26 +299,12 @@ class Client extends Model
 
     public function nextMcpAppointment()
     {
-        if ($this->mcp) {
-            return Appointment::where('client_id', $this->id)
-                ->where('pro_id', $this->mcp->id)
-                ->where('start_time', '>=', date('Y-m-d'))
-                ->orderBy('start_time', 'asc')
-                ->first();
-        }
-        return false;
+        return $this->hasOne(Appointment::class, 'id', 'next_mcp_appointment_id');
     }
 
     public function lastMcpAppointment()
     {
-        if ($this->mcp) {
-            return Appointment::where('client_id', $this->id)
-                ->where('pro_id', $this->mcp->id)
-                ->where('start_time', '<', date('Y-m-d'))
-                ->orderBy('start_time', 'asc')
-                ->first();
-        }
-        return false;
+        return $this->hasOne(Appointment::class, 'id', 'previous_mcp_appointment_id');
     }
 
     public function lastMeasurementOfType($_type) {

+ 1 - 0
app/Models/Pro.php

@@ -413,6 +413,7 @@ WHERE mcp_pro_id = :pro_id
 
     function get_patients_without_appointment_query() {
         return Client::where('mcp_pro_id', $this->id)
+                    ->whereNull('today_mcp_appointment_date')
                     ->where(function($q){
                         $q->whereNull('next_mcp_appointment_id')
                         ->orWhere('next_mcp_appointment_date', '<=', DB::raw('NOW()::DATE'));

+ 3 - 3
resources/views/app/dna/patients-table.blade.php

@@ -46,9 +46,9 @@
 				{{$coverage->insuranceDisplayName()}}
 				@endif
 			</td>
-			<td>{{$patient->lastMcpAppointment() ? $patient->lastMcpAppointment()->start_date : '-'}}</td>
-			<td>{{$patient->nextMcpAppointment() ? $patient->nextMcpAppointment()->start_date : '-'}}</td>
-			<td>{{$patient->nextMcpAppointment() ? $patient->nextMcpAppointment()->status : '-'}}</td>
+			<td>{{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}</td>
+			<td>{{$patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-'}}</td>
+			<td>{{$patient->nextMcpAppointment ? $patient->nextMcpAppointment->status : '-'}}</td>
 			<td>{{$patient->is_enrolled_in_cm ? 'Yes' : 'No'}}</td>
 			<td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>
 			<td>

+ 20 - 0
resources/views/app/mcp/dashboard/messages.blade.php

@@ -16,6 +16,26 @@
                 <td class="px-1">
                     {{$msg->body}}
                 </td>
+                <td>
+                    @if($msg->is_reply_needed == 'YES')
+                        <div moe relative>
+                            <a start show class="">clear</a>
+                            <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" right>
+                                <input type="hidden" name="uid" value="{{ $msg->uid }}">
+                                <input type="hidden" name="isReplyNeeded" value="NO">
+                                <div class="mb-2">
+                                    <label for="" class="text-sm text-secondary mb-1">Are you sure?</label>
+
+                                </div>
+
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Send</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    @endif
+                </td>
             </tr>
         @endforeach
         </tbody>

+ 3 - 3
resources/views/app/mcp/patients-table.blade.php

@@ -47,9 +47,9 @@
 					@endif
 				</div>
 			</td>
-			<td>{{$patient->lastMcpAppointment() ? $patient->lastMcpAppointment()->start_date : '-'}}</td>
-			<td>{{$patient->nextMcpAppointment() ? $patient->nextMcpAppointment()->start_date : '-'}}</td>
-			<td>{{$patient->nextMcpAppointment() ? $patient->nextMcpAppointment()->status : '-'}}</td>
+			<td>{{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}</td>
+			<td>{{$patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-'}}</td>
+			<td>{{$patient->nextMcpAppointment ? $patient->nextMcpAppointment->status : '-'}}</td>
 			<td>{{$patient->is_enrolled_in_cm ? 'Yes' : 'No'}}</td>
 			<td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>
 			<td class="d-none">

+ 3 - 2
resources/views/app/patient/accounts.blade.php

@@ -161,7 +161,7 @@
                         </td>
                         <td class="px-2">
                             <div class="d-flex">
-                                @if($accountInvite->status !== 'CANCELLED')
+                                @if($accountInvite->status !== 'PENDING')
                                     <span moe class="ml-1" relative>
                                         <a class="" href="" show start>Cancel</a>
                                         <form url="/api/accountInvite/markAsCancelled" right>
@@ -173,7 +173,8 @@
                                             </div>
                                         </form>
                                     </span>
-                                @else
+                                @endif
+                                @if($accountInvite->status == 'CANCELLED')
                                     <span moe class="ml-1" relative>
                                         <a class="" href="" show start>Undo Cancel</a>
                                         <form url="/api/accountInvite/undoMarkAsCancelled" right>

+ 16 - 16
resources/views/app/patient/measurements.blade.php

@@ -47,23 +47,23 @@
                         </div>
                     </form>
                 </div>
-                @if($performer->pro->pro_type == 'ADMIN')
-                <span class="mx-2 text-secondary">|</span>
-                <div moe>
-                    <a start show class="py-0 font-weight-normal">Process Client BDT Measurements Report</a>
-                    <form url="/api/clientBdtReport/processClientBdtReport">
-                        <input type="hidden" name="uid" value="{{ $patient->uid }}">
-                        <div class="mb-2">
-                            <label for="" class="control-label">Process client bd measurements report?</label>
-                        </div>
+{{--                @if($performer->pro->pro_type == 'ADMIN')--}}
+{{--                <span class="mx-2 text-secondary">|</span>--}}
+{{--                <div moe>--}}
+{{--                    <a start show class="py-0 font-weight-normal">Process Client BDT Measurements Report</a>--}}
+{{--                    <form url="/api/clientBdtReport/processClientBdtReport">--}}
+{{--                        <input type="hidden" name="uid" value="{{ $patient->uid }}">--}}
+{{--                        <div class="mb-2">--}}
+{{--                            <label for="" class="control-label">Process client bd measurements report?</label>--}}
+{{--                        </div>--}}
 
-                        <div class="d-flex align-items-center">
-                            <button class="btn btn-sm btn-primary mr-2" submit>Yes</button>
-                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                        </div>
-                    </form>
-                </div>
-                @endif
+{{--                        <div class="d-flex align-items-center">--}}
+{{--                            <button class="btn btn-sm btn-primary mr-2" submit>Yes</button>--}}
+{{--                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>--}}
+{{--                        </div>--}}
+{{--                    </form>--}}
+{{--                </div>--}}
+{{--                @endif--}}
             </div>
             <table class="table table-striped table-sm table-bordered mt-2 mb-0">
                 <thead>

+ 1 - 1
resources/views/app/patient/sms.blade.php

@@ -46,7 +46,7 @@
                     <td class="px-2">{{ $sms->to_number }}</td>
                     <td class="px-2">{{ $sms->body }}</td>
                     <td class="px-2">
-                        @if($sms->is_reply_needed)
+                        @if($sms->is_reply_needed == 'YES')
                             <div moe relative>
                                 <a start show class="">clear</a>
                                 <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" right>