Josh Kamau 5 жил өмнө
parent
commit
b74ab2cdd1

+ 2 - 1
app/Http/Controllers/clients_SINGLE_Controller.php

@@ -388,7 +388,8 @@ class clients_SINGLE_Controller extends Controller
 	// GET /clients/view/{uid}/SUB_dashboard
 	public function SUB_dashboard(Request $request, $uid) {
 		$record = Client::where("uid", $uid)->first();
-		return response()->view('pro/clients_SINGLE/SUB_dashboard', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+		$careMonth = $record->careMonth;//TODO: get caremonth selected from the UI
+		return response()->view('pro/clients_SINGLE/SUB_dashboard', compact('record', 'careMonth'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
 	}
 
 	// GET /clients/view/{uid}/SUB_detail

+ 17 - 1
app/Models/CareMonth.php

@@ -9,5 +9,21 @@ class CareMonth extends Model
 
     protected $table = "care_month";
 
-    //
+    public function cmPro(){
+        return $this->hasOne(Pro::class, 'id', 'cm_pro_id');
+    }
+
+    public function rmePro(){
+        return $this->hasOne(Pro::class, 'id', 'rme_pro_id');
+    }
+
+    public function rmmPro(){
+        return $this->hasOne(Pro::class, 'id', 'rmm_pro_id');
+    }
+
+    public function careMonthEntries()
+    {
+        return $this->hasMany(CareMonth::class, 'care_month_id', 'id');
+    }
+
 }

+ 3 - 1
app/Models/CareMonthEntry.php

@@ -9,5 +9,7 @@ class CareMonthEntry extends Model
 
     protected $table = "care_month_entry";
 
-    //
+    public function pro(){
+        return $this->hasOne(Pro::class, 'id', 'pro_id');
+    }
 }

+ 16 - 0
app/Models/Client.php

@@ -22,7 +22,23 @@ class Client extends Model
         return $this->hasOne(Pro::class, 'id', 'mcp_pro_id');
     }
 
+    public function cmPro(){
+        return $this->hasOne(Pro::class, 'id', 'cm_pro_id');
+    }
+
+    public function rmePro(){
+        return $this->hasOne(Pro::class, 'id', 'rme_pro_id');
+    }
+
+    public function rmmPro(){
+        return $this->hasOne(Pro::class, 'id', 'rmm_pro_id');
+    }
+
     public function name_display(){
         return $this->name_first . ' '.$this->name_last;
     }
+
+    public function careMonth(){
+        return $this->hasOne(CareMonth::class, 'client_id', 'id');
+    }
 }

+ 134 - 99
resources/views/pro/clients_SINGLE/SUB_dashboard.blade.php

@@ -2,7 +2,7 @@
 @extends('pro.clients.view')
 @section('content-inner')
 
-<div class="container-fluid">
+<div class="container-fluid p-2">
     <div class="row">
         <div class="col-md-12">
             <img class="img-thumbnail" src="" alt="profile picture">
@@ -10,160 +10,195 @@
             @if($record->is_duplicate)
                 <div>
                     <p> This client is a duplicate of 
-                    <a href="/clients/view/{{$record->duplicateOfClient->uid}}">{{$record->duplicateOfClient->name_display()}}</a>. 
-                    <a up-modal=".form-contents" up-width="800" up-history="false" href="/clients/view/8340f0ac-bd01-4744-af16-f5cabcce14f8/ACTION_setIsDuplicateToFalse" title="Set as not duplicate">✏️ </a></p>
+                    <a href="{{route('clients_SINGLE-SUB_dashboard', $record->duplicateOfClient->uid)}}">{{$record->duplicateOfClient->name_display()}}</a>. 
+                    <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_setIsDuplicateToFalse', $record->uid)}}" title="Set as not duplicate">✏️ </a></p>
                 </div>
+            @else
+            <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_setIsDuplicateToTrue', $record->uid)}}" title="Set as not duplicate">Mark as duplicate</a></p>
             @endif
             <hr/>
-                -------------------------------------
                 
-                
-                <Thumbnail>(1) <John Smith>(2) ✏️ @hover: full name
-                                                   ❌✅ (7)
                 <div>
-                    <img class="img-thumbnail" src="" alt="profile picture">
-                    <p>{{$record->name_display()}}</p>
+                    <i class="fa fa-phone" aria-hidden="true"></i> 
+                        {{$record->cell_number}}
+                        <a up-modal=".form-contents" up-width="800" up-history="false" 
+                            href="{{route('clients_SINGLE-ACTION_putNewCellNumber', $record->uid)}}"><i class="fa fa-edit" aria-hidden="true"></i></a>    
+                </div>
+                <div>
+                    <i class="fa fa-envelope" aria-hidden="true"></i> 
+                        {{$record->email_address}}
+                    <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putNewEmailAddress', $record->uid)}}"><i class="fa fa-edit"></i></a>
+                </div>
+                <div>
+                    <i class="fa fa-map-pin" aria-hidden="true"></i> {{$record->home_address_city}}
+                </div>
+                <div>
+                    <i class="fa fa-map-pin" aria-hidden="true"></i> {{$record->home_address_state}}
+                    <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_editAddress', $record->uid)}}"><i class="fa fa-edit"></i></a>
                 </div>
-                
-                📞 {validated_cell_number} (4) 
-                <div><i class="fa fa-phone" aria-hidden="true"></i> {{$record->cell_number}}</div>
-                    ✉️ {validated_email} (5) 📌 {home_address.city}, {home_address.state}(6)
-                <div><i class="fa fa-envelope" aria-hidden="true"></i> {{$record->email_address}}</div>
-                <div><i class="fa fa-map-pin" aria-hidden="true"></i> {{$record->home_address_city}}</div>
-                <div><i class="fa fa-map-pin" aria-hidden="true"></i> {{$record->home_address_state}}</div>
-                <small> {gender}, {age calc:dob}
                 <div>
                     {{$record->gender_identity}}, {{$record->sex}}, {{$record->dob}}, {{$record->age_in_years}}
+                    <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_editDemographics', $record->uid)}}"><i class="fa fa-edit"></i></a>
                 </div>
                 
                 <small> Currently under the care of {MCP-First MCP-Last}✏️, with us since {creation.month}, {creation.date} || '8 days'}.
                 @if($record->mcpPro)
                 <div>
-                    <p>Currently under the care of {{$record->mcpPro->name_display}}</p>
-                    <a href=""><i class="fa fa-pencil" aria-hidden="true"></i></a>    
+                    Currently under the care of {{$record->mcpPro->name_display}}
+                    <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putMcp', $record->uid)}}"><i class="fa fa-edit" aria-hidden="true"></i></a>  
+                    <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_removeMcp', $record->uid)}}"><i class="fa fa-trash" aria-hidden="true"></i></a>      
                 </div>
                 @else 
                     <div>
                         <p>No mcp pro assigned.</p>
-                        <a href=""><i class="fa fa-pencil" aria-hidden="true"></i></a>
+                        <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putMcp', $record->uid)}}"><i class="fa fa-edit" aria-hidden="true"></i></a>
                     </div>
                 @endif
 
-                { If !medicare_valid || !mcp || !onboarded }
                 @if(!$record->is_mcn_valid_number || !$record->mcpPro || !$record->has_mcp_done_onboarding_visit)
 
                     @if(!$record->is_mcn_valid_number)
                     <div>
-                        { If !medicare_valid }
-                            <_____DOB Input_____>
-                            <_____Medicare Input_____>
-                            [Validate]
-                        MCN: {{$client->mcn}}
-                        <a href=""><i class="fa fa-pencil" aria-hidden="true"></i></a>
+                        MCN: {{$record->mcn}} <i class="fa fa-close"></i>
+                        <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putMcn', $record->uid)}}"><i class="fa fa-edit" aria-hidden="true"></i></a>
                     </div>
                     @elseif($record->is_mcn_valid_number || !$record->mcpPro )
-                        { Else if medicare_valid && !mcp }
                         Please assign a MCP to this client.
-                        <_____Text or Email_____> [Invite]
-                        <Dropdown/Datalist of MCPs> [Assign]
-                        <a href="">Assign mcp pro</a>
+                        <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putMcp', $record->uid)}}">Assign mcp pro</a>
                     @elseif($record->is_mcn_number_valid && !$record->has_mcp_done_onboarding_visit)
-                        { Else if medicare_valid && !onboarded }
-                         This client hasn't been onboarded yet.   
                         <div class="alert alert-info">This client hasn't been onboarded yet.</div>
                     @endif
-                @endif
-                { Else onboarded_already }
-                
-                    <main>
-                        Care Monitoring:
-                            { If !cmPro } <Dropdown/Datalist of possible CMs>
-                            {else}  <link>{cmPro}</link> ✏️
-                
-                            { If cmPro }
-                                { If !cm} Enroll this client into CM.
-                                { Else }
-                                    <small> Unenroll out of CM.
-                                        @link _____why?_____ [Unenroll]
-                
-                        Remote Monitoring:
+                @else
+                    <div>
+                        <h2>Care Monitoring:</h2>
+                            @if(!$record->cmPro)
+                                <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putCm', $record->uid)}}"><i class="fa fa-edit" aria-hidden="true"></i>Link cm pro</a>
+                            @else
+                                <p>CM Pro: <a href="">{{$record->cmPro->name_display}}</a></p>
+                            @endif
+
+                            @if($record->cmPro)
+                                @if(!$record->is_enrolled_in_cm)
+                                    <p>
+                                        Enroll this client into CM<
+                                        <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_setIsEnrollerInCmToTrue', $record->uid)}}">enroll in cm</a>
+                                    </p>
+                                @else
+                                    <p>
+                                        Unenroll this client from CM 
+                                        <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_setIsEnrolledInCmToFalse', $record->uid)}}">unenroll in cm</a>
+                                    </p>
+                                @endif
+                            @endif           
+                        <h2>Remote Monitoring:</h2>
                             { If !rmePro } <Dropdown/Datalist of possible RMEs>
-                            { Else }  <link>{rmePro}</link> ✏️
-                
-                            { If !rmmPro} <Dropdown/Datalist of possible RMMs>
-                            {else}  <link>{rmmPro}</link> ✏️
+                            @if(!$record->rmePro)
+                                <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_putRmePro', $record->uid)}}">Put RME pro</a>          
+                            @else
+                                RME Pro: <a href="">{{$record->rmePro->name_display}}</a> 
+                                <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_changeRmePro', $record->uid)}}">change rme pro</a>           
+                            @endif
                             
+                            @if(!$record->rmmPro)
+                              <a href="">Put RMM pro</a>
+                            @else
+                                {else}  
+                                <link>{rmmPro}</link> ✏️
+                                RMM Pro:<a href="">{{$record->rmmPro->name_display}}</a> 
+                                <a  up-modal=".form-contents" up-width="800" up-history="false" 
+                                    href="{{route('clients_SINGLE-ACTION_changeRmmPro', $record->uid)}}">change rmm pro</a>
+                            @endif
                             { If rmePro && rmmPro}
+                            @if(!$record->is_enrolled_in_rm)
                                 { If !rm} Enroll this client into RM.
+                                <a  up-modal=".form-contents" up-width="800" up-history="false" 
+                                    href="{{route('clients_SINGLE-ACTION_setIsClientEnrolledInRmToTrue', $record->uid)}}">Enroll in RM</a>
+                            @else
                                 {else}
                                     <small> Unenroll out of RM.
                                         @link _____why?_____ [Unenroll]
-                
+                                <a  up-modal=".form-contents" up-width="800" up-history="false" 
+                                    href="{{route('clients_SINGLE-ACTION_setIsClientEnrolledInRmToFalse', $record->uid)}}">Un enroll in RM</a>
+                            @endif
                 
                         << Prev     Care Months - Month, Year     Next >> (max, one month in future)
+                        <div>
+                            <div>Care month: $client->careMonth->start_date </div>
+                            <a href="">Prev</a>|
+                            <a href="">Next</a>
+                        </div>
+                        @if(!$record->careMonth)
                         { If !careMonth}
                             {mcp} ✏️
                             [Add a care month]
-                
+                            <div>
+                                <a href="">Add care month</a>
+                            </div>
+                        @elseif($record->is_tm_this_month)
+
                         {else if tm}
                             ⚠️ Patient recently discharged, transitional care management billable for this month.
-                
+                        @elseif(!$careMonth->is_tm_this_month && ($careMonth->is_client_enrolled_in_cm || $careMonth->is_client_enrolled_in_rm))
                         {else !tm && (cm || rm)}
                             Eligible for CM_20/30_HCP/90. RM_20/30/90. {calc: careMonth.totalTimeCM / careMonth.totalTimeRM}
                             Total time billed this month: {careMonth.totalTimeCM} minutes in CM, {careMonth.totalTimeRM} minutes in RM.
-                
+                            <div>
+                                Total time billed this month: 
+                                {{$careMonth->rm_total_time_in_seconds/60}} minutes in CM, {{$careMonth->cm_total_time_in_seconds/60}} minutes in RM.
+                            </div>
+                            @if($careMonth->is_client_enrolled_in_cm)
                             { If cm}
                                 {cmPro} ✏️
-                
+                                <div>
+                                    CM Pro: <a href="">{{$careMonth->cmPro->name_display}}</a>
+                                    <a href="">Change CM pro</a>
+                                </div>
+                            @endif
+                            @if($careMonth->is_client_enrolled_in_rm)
                             { If rm}
                                 {rmePro} ✏️
                                 {rmmPro} ✏️
-                
+                                <div>
+                                    RME Pro: <a href="">{{$careMonth->rmePro->name_display}}</a>
+                                    <a href="">Change RME pro</a>
+                                </div>
+                                <div>
+                                    RMM Pro: <a href="">{{$careMonth->rmmPro->name_display}}</a>
+                                    <a href="">Change RMM pro</a>
+                                </div>
+                            @endif
                             [Add an entry]
+                            <a href="">Add an entry</a>
                             {Loop entries recent}
                                 Created | Type (rm/cm) | Duration | Content | Pro
                             {/Loop entries}
-                    </main>
-                
-                
-                
-                
-                (6) @click: modal ✏️
-                    _____home.address.line1_____
-                    _____home.address.line2_____
-                    _____home.address.zip_____
-                    {Try to geocode zip}
-                    _____home.address.city_____
-                    _____home.address.state_____
-                    _____home.address.lat_____
-                    _____home.address.long_____
-                
-                    { If !mailing}
-                        [✔️] Use the home address.
-                        [Add a mailing address]
-                            _____mailing.address.line1_____
-                            _____mailing.address.line2_____
-                            _____mailing.address.zip_____
-                            {Try to geocode zip}
-                            _____mailing.address.city_____
-                            _____mailing.address.state_____
-                            _____mailing.address.lat_____
-                            _____mailing.address.long_____
-                
-                    { If !secondary}
-                        _____secondary_address.reason_____
-                        _____secondary_address.when_____
-                        [Add secondary]
-                
-                        <Use the same template as above>
-                
-                
-                (7) Medicare number can either be invalid, or empty, something which can't be validated: don't show anything.
-                    Or, it can be a valid medicare number, but for some reason is NO GOOD for us: show red cross.
-                    Or, it can be a valid medicare number, which is GOOD for us: show green tick.
-                
-                
-                (9) @click: modal
+                            
+                            <table class="table table-condensed table-striped">
+                                <thead>
+                                    <tr>
+                                        <th>Created</th>
+                                        <th>Type (rm/cm)</th>
+                                        <th>Duration</th>
+                                        <th>Content</th>
+                                        <th>Pro</th>
+                                    </tr>
+                                </thead>     
+                                <tbody>
+                                    @foreach ($careMonth->careMonthEntries as $careMonthEntry)
+                                    <tr>
+                                        <td>{{$careMonthEntry->created_at}}</td>
+                                        <td>{{$careMonthEntry->cm_or_rm}}</td>
+                                        <td>{{$careMonthEntry->time_in_seconds}}</td>
+                                        <td>{{$careMonthEntry->content_text}}</td>
+                                        <td>{{$careMonthEntry->pro->name_display}}</td>
+                                    </tr>
+                                    @endforeach
+                                </tbody>
+                            </table>   
+                         
+                        @endif
+                        </div>
+                @endif
                 
         </div>
     </div>