Browse Source

Merge branch 'dev-vj' of rav.triplestart.com:TigerPHP/stagfe into dev-vj

Josh Kamau 5 years ago
parent
commit
1f51a4ebc5

+ 10 - 0
app/Helpers/Helper.php

@@ -86,3 +86,13 @@ if(!function_exists('friendly_date_time')) {
         }
     }
 }
+
+
+
+function zFormalName($person){
+    return zImplode(', ', [$person->name_last, $person->name_first]);
+}
+
+function zImplode($glue, $pieces){
+    return implode($glue, array_filter($pieces));
+}

+ 8 - 0
app/Models/Client.php

@@ -41,4 +41,12 @@ class Client extends Model
     public function careMonth(){
         return $this->hasOne(CareMonth::class, 'client_id', 'id');
     }
+
+    public function medicareStatus(){
+        // $this->mcn_reject_reason_code = 'not part b';
+        return true ? true : (
+        // return $this->is_mcn_valid_number ? true : (
+            $this->mcn_reject_reason_code ? false : null
+        );
+    }
 }

+ 2 - 0
resources/views/layouts/pro-logged-in.blade.php

@@ -14,6 +14,8 @@
     <!-- overlayScrollbars -->
     <link rel="stylesheet" href="/AdminLTE-3.0.5/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
 
+    <link href=/css/z.css rel=stylesheet>
+
     <style>
         .loading-rotate {
             -webkit-animation:spin 0.3s linear infinite;

+ 81 - 6
resources/views/pro/clients/info.blade.php

@@ -1,12 +1,87 @@
-<h4 class="d-flex my-3 px-3 stag-heading stag-heading-info">
+<?
+    $client = $record;
+    $thumbnail = $client->profile_picture_base64;
+    $initials = !$thumbnail ? substr($client->name_first, 0, 1).substr($client->name_last, 0, 1) : '';
+    $fullName = zImplode(', ', [
+        zImplode(' ', [$client->name_prefix, $client->name_first, $client->name_middle, $client->name_last, $client->name_suffix]),
+        $client->name_credential
+    ]);
+
+    $sex = str_replace(['F', 'M'], ['Female', 'Male'], $client->sex);
+    $gender = $sex
+            ? $sex.($client->gender_identity ? " ($client->gender_identity)" : '')
+            : $client->gender_identity;
+    $age = date_diff(date_create($client->dob), date_create('today'))->y ?: $client->age_in_years;
+    $birthplace = zImplode(', ', [$client->birth_city, $client->birth_state, $client->birth_country]);
+
+    $confirmedCell = $client->is_cell_number_confirmed ? $client->cell_number : null;
+    $confirmedEmail = $client->is_email_address_confirmed ? $client->email_address : null;
+    $location = zImplode(', ', [$client->home_address_city, $client->home_address_state])
+        ?: zImplode(', ', [$client->mailing_address_city, $client->mailing_address_state])
+        ?: zImplode(', ', [$client->secondary_home_address_city, $client->secondary_home_address_state])
+        ?: zImplode(', ', [$client->secondary_mailing_address_city, $client->secondary_mailing_address_state])
+        ?: $birthplace
+        ?: null;
+
+    $memberSince = date_diff(date_create($client->created_at), date_create('now'))->days;
+    if ($memberSince > 30) $memberSince = date('F, Y', strtotime($client->created_at));
+    else if ($memberSince > 1) $memberSince .= ' days ago';
+    else if ($memberSince === 1) $memberSince = 'yesterday';
+    else if ($memberSince === 0) $memberSince = 'today';
+
+    $medicareStatus = [
+        'true' => 'medicare-valid',
+        'false' => 'medicare-invalid',
+        'NULL' => null
+    ][var_export($client->medicareStatus(), true)];
+
+    // print_r($client); exit;
+?>
+
+<section class=z><a href=SUB_detail>
+<header class=hbox>
+    <div class="dp <?=$medicareStatus?>" style="background-image:<?=$thumbnail?>"><?=$initials?></div>
     <div>
-        Clients: [<?= $record->name_display() ?>]
-        @if($record->is_duplicate)
+        <div class=name title="<?=$fullName?>"><?=zFormalName($client)?></div>
+        <div class=separators title="<?=date('jS F Y', strtotime($client->dob))?>">
+            <span><?=$gender?></span>
+            <span><?=$age ? ($gender ? $age : "$age years old") : null?></span>
+            <span><?=$birthplace ? "Hails from $birthplace" : null?></span>
+        </div>
+        <ul class=hbox>
+            <li>
+                <i class="fa fa-phone-alt" aria-hidden="true"></i>
+                <span class=contact><?=$confirmedCell ?? 'Edit'?></span>
+            </li>
+            <li>
+                <i class="fa fa-envelope" aria-hidden="true"></i>
+                <span class=contact><?=$confirmedEmail ?? 'Edit'?></span>
+            </li>
+            <li>
+                <i class="fa fa-map-marker-alt" aria-hidden="true"></i>
+                <?=$location ?? 'Add location'?>
+            </li>
+        </ul>
+        <div class=separators>
+            <span>
+                <span>Joined <?=$memberSince?></span>
+                <span title="<?=$client->source_memo?>"><?=$client->source ? " via $client->source" : null?></span>
+            </span>
+            <span><?=$client->mcp_pro_id ? 'Currently under c/o '.zFormalName($client->mcpPro) : null?></span>
+        </div>
+    </div>
+</header>
+</a></section>
+
+<!-- <h4 class="d-flex my-3 px-3 stag-heading stag-heading-info">
+    <div>
+        Clients: [<?= $client->name_display() ?>]
+        @if($client->is_duplicate)
             <div>
                 <p> This client is a duplicate of 
-                <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>
+                <a href="{{route('clients_SINGLE-SUB_dashboard', $client->duplicateOfClient->uid)}}">{{$client->duplicateOfClient->name_display()}}</a>. 
+                <a up-modal=".form-contents" up-width="800" up-history="false" href="{{route('clients_SINGLE-ACTION_setIsDuplicateToFalse', $client->uid)}}" title="Set as not duplicate">✏️ </a></p>
             </div>
         @endif
     </div>
-</h4>
+</h4> -->

+ 43 - 2
resources/views/pro/clients_SINGLE/SUB_dashboard.blade.php

@@ -2,7 +2,48 @@
 @extends('pro.clients.view')
 @section('content-inner')
 
-<div class="container-fluid p-2">
+<?
+    $client = $record;
+    $isMedicareNotGood = $client->medicareStatus() !== true;
+    $isBlocked = $isMedicareNotGood || !$client->mcp_pro_id || $client->has_mcp_done_onboarding_visit === 'UNKNOWN';
+?>
+
+<section class=z><a href=SUB_detail>
+<? if(!$isBlocked): ?>
+    <main>
+        
+    </main>
+<? else: ?>
+    <main class="blocked">
+        <h5>
+            <span>⚠️</span>
+            <? if($isMedicareNotGood): ?>
+                Need a functional medicare number.
+            <? elseif(!$client->mcp_pro_id): ?>
+                Hasn't been assigned a MCP yet.
+            <? elseif($client->has_mcp_done_onboarding_visit === 'UNKNOWN'): ?>
+                MCP hasn't done a onboarding visit.
+            <? endif ?>
+        </h5>
+    </main>
+<? endif ?>
+</section>
+
+<style>
+    .z main {
+        display: flex;
+        flex-direction: column;
+        min-height: 300px;
+        padding: 20px 0;
+    }
+
+    .z .blocked {
+        align-items: center;
+        justify-content: center;
+    }
+</style>
+
+<!-- <div class="container-fluid p-2">
     <div class="row">
         <div class="col-md-12">
             <p>{{$record->name_display()}}</p>
@@ -219,6 +260,6 @@
 
         </div>
     </div>
-</div>
+</div> -->
 
 @endsection