Эх сурвалжийг харах

ClientProgram/ClientMonthProgram/ClientMonthProgramEntry cleanup

Samson Mutunga 1 жил өмнө
parent
commit
15fef57eea

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

@@ -1677,71 +1677,6 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
         return json_encode($measurements);
         return json_encode($measurements);
     }
     }
 
 
-    public function patients(Request $request, $filter = '')
-    {
-
-        $performer = $this->performer();
-        $query = $performer->pro->getAccessibleClientsQuery();
-
-        $q = trim($request->input('q'));
-        if(!empty($q)) {
-            $query = $query->where(function ($query) use ($q) {
-                $query->where('name_first', 'ILIKE', "%$q%")
-                    ->orWhere('name_last', 'ILIKE', "%$q%")
-                    ->orWhere('email_address', 'ILIKE', "%$q%")
-                    ->orWhere('tags', 'ILIKE', "%$q%");
-            });
-        }
-
-        switch ($filter) {
-            case 'not-yet-seen':
-                $query = $query
-                    ->where(function ($query) use ($performer) {
-                        $query
-                            ->where(function ($query) use ($performer) {     // own patient and primary OB visit pending
-                                $query->where('mcp_pro_id', $performer->pro->id)
-                                    ->where('has_mcp_done_onboarding_visit', '<>', 'YES');
-                            })
-                            ->orWhere(function ($query) use ($performer) {   // mcp of any client program and program OB pending
-                                $query->select(DB::raw('COUNT(id)'))
-                                    ->from('client_program')
-                                    ->whereColumn('client_id', 'client.id')
-                                    ->where('mcp_pro_id', $performer->pro->id)
-                                    ->where('has_mcp_done_onboarding_visit', '<>', 'YES');
-                            }, '>=', 1);
-                    });
-                break;
-
-            case 'having-birthday-today':
-                $query = $query
-                    ->whereRaw('EXTRACT(DAY from dob) = ?', [date('d')])
-                    ->whereRaw('EXTRACT(MONTH from dob) = ?', [date('m')]);
-                break;
-
-                // more cases can be added as needed
-            default:
-                break;
-        }
-        $patients = $query->orderBy('created_at', 'desc')->paginate(50);
-
-        // patient acquisition chart (admin only)
-        $patientAcquisitionData = null;
-        if($performer->pro->pro_type === 'ADMIN') {
-            $startDate = date_sub(date_create(), date_interval_create_from_date_string("1 month"));
-            $startDate = date_format($startDate, "Y-m-d");
-            $patientAcquisitionData = DB::select(DB::raw(
-                "SELECT count(id) as count, DATE(created_at at time zone 'utc' at time zone 'est') as date " .
-                "FROM client " .
-                "WHERE shadow_pro_id IS NULL " .
-                "GROUP BY DATE(created_at at time zone 'utc' at time zone 'est') " .
-                "ORDER BY DATE(created_at at time zone 'utc' at time zone 'est') DESC " .
-                "LIMIT 30"));
-        }
-
-        return view('app/patients', compact('patients', 'filter', 'patientAcquisitionData'));
-
-    }
-
     public function patientsSuggest(Request $request)
     public function patientsSuggest(Request $request)
     {
     {
 
 

+ 0 - 5
app/Http/Controllers/PatientController.php

@@ -437,11 +437,6 @@ class PatientController extends Controller
             compact('pros', 'patient', 'currentAppointment', 'appointments', 'appointmentPros'));
             compact('pros', 'patient', 'currentAppointment', 'appointments', 'appointmentPros'));
     }
     }
 
 
-    public function programs(Request $request, Client $patient, $filter = '') {
-        $pros = $this->pros;
-        return view('app.patient.programs', compact('patient', 'pros', 'filter'));
-    }
-
     public function flowsheets(Request $request, Client $patient, $filter = '') {
     public function flowsheets(Request $request, Client $patient, $filter = '') {
         $pros = $this->pros;
         $pros = $this->pros;
         return view('app.patient.flowsheets', compact('patient', 'pros', 'filter'));
         return view('app.patient.flowsheets', compact('patient', 'pros', 'filter'));

+ 1 - 15
app/Models/Client.php

@@ -575,12 +575,7 @@ class Client extends Model
         return $this->hasOne(McpRequest::class, 'id', 'active_mcp_request_id');
         return $this->hasOne(McpRequest::class, 'id', 'active_mcp_request_id');
     }
     }
 
 
-    public function clientPrograms()
-    {
-        return $this->hasMany(ClientProgram::class, 'client_id', 'id')
-            ->where('is_active', true)
-            ->orderBy('title', 'desc');
-    }
+  
 
 
     public function tickets()
     public function tickets()
     {
     {
@@ -696,15 +691,6 @@ class Client extends Model
             $pros[] = ["pro" => $appointment->pro->displayName(), "association" => 'Via Appointment: ' . $appointment->raw_date];
             $pros[] = ["pro" => $appointment->pro->displayName(), "association" => 'Via Appointment: ' . $appointment->raw_date];
         }
         }
 
 
-        // via client program
-        $clientPrograms = ClientProgram::where('client_id', $this->id)->where('is_active', true)->get();
-        foreach ($clientPrograms as $clientProgram) {
-            if ($clientProgram->mcp)
-                $pros[] = ["pro" => $clientProgram->mcp->displayName(), "association" => 'Program MCP: ' . $clientProgram->title];
-            if ($clientProgram->manager)
-                $pros[] = ["pro" => $clientProgram->manager->displayName(), "association" => 'Program Manager: ' . $clientProgram->title];
-        }
-
         // sort by pro name
         // sort by pro name
         $name = array_column($pros, 'pro');
         $name = array_column($pros, 'pro');
         array_multisort($name, SORT_ASC, $pros);
         array_multisort($name, SORT_ASC, $pros);

+ 0 - 26
app/Models/ClientProgram.php

@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Models;
-
-# use Illuminate\Database\Eloquent\Model;
-
-class ClientProgram extends Model
-{
-    protected $table = "client_program";
-
-    public function mcp() {
-        return $this->hasOne(Pro::class, 'id', 'mcp_pro_id');
-    }
-
-    public function manager() {
-        return $this->hasOne(Pro::class, 'id', 'manager_pro_id');
-    }
-
-    public function getProgramMonth($m, $y)
-    {
-        return ClientProgramMonth::where('client_program_id', $this->id)
-            ->where('month', $m)
-            ->where('year', $y)
-            ->first();
-    }
-}

+ 0 - 11
app/Models/ClientProgramMonth.php

@@ -1,11 +0,0 @@
-<?php
-
-namespace App\Models;
-
-# use Illuminate\Database\Eloquent\Model;
-
-class ClientProgramMonth extends Model
-{
-    protected $table = "client_program_month";
-
-}

+ 0 - 10
app/Models/ClientProgramMonthEntry.php

@@ -1,10 +0,0 @@
-<?php
-
-namespace App\Models;
-
-# use Illuminate\Database\Eloquent\Model;
-
-class ClientProgramMonthEntry extends Model
-{
-    protected $table = "client_program_month_entry";
-}

+ 0 - 23
app/Models/Measurement.php

@@ -23,29 +23,6 @@ class Measurement extends Model
         return $this->hasOne(ClientBDTMeasurement::class, 'id', 'client_bdt_measurement_id');
         return $this->hasOne(ClientBDTMeasurement::class, 'id', 'client_bdt_measurement_id');
     }
     }
 
 
-    public function numCPMEntries() {
-        return ClientProgramMonthEntry::where('measurement_id', $this->id)->where('is_cancelled', false)->count();
-    }
-
-    public function minutesEntered($pro) {
-        $entries = ClientProgramMonthEntry::where('measurement_id', $this->id)
-            ->where('pro_id', $pro->id)
-            ->where('is_cancelled', false)
-            ->get();
-        $minutes = 0;
-        foreach ($entries as $entry) {
-            $minutes += $entry->time_in_minutes;
-        }
-        return $minutes;
-    }
-
-    public function entriesByPro($pro) {
-        return ClientProgramMonthEntry::where('measurement_id', $this->id)
-            ->where('pro_id', $pro->id)
-            ->where('is_cancelled', false)
-            ->get();
-    }
-
     public function childMeasurements() {
     public function childMeasurements() {
         return Measurement::where('parent_measurement_id', $this->id)
         return Measurement::where('parent_measurement_id', $this->id)
             ->where('is_active', true)
             ->where('is_active', true)

+ 0 - 25
app/Models/Pro.php

@@ -859,31 +859,6 @@ WHERE
         return !!$canAccess;
         return !!$canAccess;
     }
     }
 
 
-    public function canAddCPMEntryForMeasurement(Measurement $measurement, Pro $pro)
-    {
-        // check if client has any programs where this measurement type is allowed
-        $allowed = false;
-        $client = $measurement->client;
-        $clientPrograms = $client->clientPrograms;
-
-        if($pro->pro_type !== 'ADMIN') {
-            $clientPrograms = $clientPrograms->filter(function($_clientProgram) use ($pro) {
-                return  $_clientProgram->manager_pro_id === $pro->id;
-            });
-        }
-
-        if(count($clientPrograms)) {
-            foreach ($clientPrograms as $clientProgram) {
-                if(strpos(strtolower($clientProgram->measurement_labels), '|' . strtolower($measurement->label) . '|') !== FALSE) {
-                    $allowed = true;
-                    break;
-                }
-            }
-        }
-
-        return $allowed ? $clientPrograms : FALSE;
-    }
-
     public function getUnstampedMeasurementsFromCurrentMonth($_countOnly, $skip, $limit)
     public function getUnstampedMeasurementsFromCurrentMonth($_countOnly, $skip, $limit)
     {
     {
 
 

+ 0 - 75
resources/views/app/patient/partials/measurement.blade.php

@@ -33,79 +33,4 @@
             </div>
             </div>
         </form>
         </form>
     </div>--}}
     </div>--}}
-    <div>
-        <div class="d-flex">
-            <span>{{ $measurement->label }}</span>
-            <span class="font-weight-bold ml-2">{{ $measurement->value }}</span>
-            <div moe>
-                <a href="#" class="ml-2 font-weight-normal text-nowrap" start show>+ Entry</a>
-                <form url="/api/clientProgramMonthEntry/create">
-                    <input type="hidden" name="measurementUid" value="{{ $measurement->uid }}">
-                    <input type="hidden" name="proUid" value="{{ $pro->uid }}">
-                    <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Effective Date</label>
-                        <input required type="date" class="form-control form-control-sm"
-                               name="effectiveDate" value="{{ date('Y-m-d') }}">
-                    </div>
-                    <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Time (minutes)</label>
-                        <input autofocus required type="number" class="form-control form-control-sm" name="timeInMinutes"
-                               value="">
-                    </div>
-                    <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Quick Text</label>
-                        <input type="text" class="form-control form-control-sm" name="quickText" value="">
-                    </div>
-                    <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Measurement Determination</label>
-                        <input type="text" class="form-control form-control-sm" data-option-list autocomplete="off"
-                               name="measurementDetermination" value="">
-                        <div class="data-option-list">
-                            <div>Normal</div>
-                            <div>High</div>
-                            <div>Low</div>
-                            <div>Abnormal</div>
-                        </div>
-                    </div>
-                    <div class="mb-2">
-                        <label class="text-sm mb-1 text-secondary">Measurement Memo</label>
-                        <input type="text" class="form-control form-control-sm" name="measurementMemo" value="">
-                    </div>
-                    <div class="d-flex align-items-center">
-                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                    </div>
-                </form>
-            </div>
-        </div>
-        <div>
-            <span class="font-weight-normal text-secondary text-sm">
-                {{ friendly_date_time($measurement->effective_date, false) }}
-            </span>
-        </div>
-    </div>
-    @if(!!$programMonth)
-        @if($minutes)
-            <?php $entries = $measurement->entriesByPro($pro); ?>
-            <div class="ml-auto">
-                @foreach($entries as $entry)
-                    <div class="d-flex align-items-start mb-1 pr-2">
-                        <span class="width-200px text-sm text-right pr-2 text-secondary">{{ $entry->quick_text }}</span>
-                        <span class="pr-2 text-sm">
-                            <i class="fa fa-clock text-secondary on-hover-opaque"></i>
-                            {{ minutes_to_hhmm($entry->time_in_minutes) }}
-                        </span>
-                        <span class="text-sm font-weight-bold">
-                            ${{ round($pro->hourly_rate * ($entry->time_in_minutes / 60), 1) }}
-                        </span>
-                    </div>
-                @endforeach
-            </div>
-        @else
-            <span class="ml-auto pr-2 text-secondary"><i
-                    class="fa fa-exclamation-triangle"></i>&nbsp;Entry pending</span>
-        @endif
-    @elseif($filter === '')
-        <span class="ml-auto pr-2 text-secondary">Entry pending</span>
-    @endif
 </div>
 </div>

+ 0 - 44
resources/views/app/patient/partials/programs.blade.php

@@ -1,44 +0,0 @@
-<div class="mt-0 pb-1">
-    <div class="d-flex align-items-center mb-1 pt-2 pb-1 border-top">
-        <h6 class="my-0 font-weight-bold text-secondary">Programs</h6>
-    </div>
-    <table class="table table-bordered table-sm table-striped m-0">
-        <tbody>
-        <?php $programNumber = 1; ?>
-        @foreach($patient->clientPrograms as $clientProgram)
-            <?php $program = $clientProgram; ?>
-            <tr>
-                <td class="text-black px-2 py-3">
-                    <div class="d-flex align-items-center pb-1">
-                        <span class="font-weight-bold">{{ $programNumber }}. {{ $program->title }}</span>
-                        <span class="mx-2 text-secondary ml-auto"><i class="fa fa-clock"></i></span>
-                        <?php $programMonth = $program->getProgramMonth(strtoupper(date('F')), date('Y')); ?>
-                        <b class="text-success">{{ $programMonth ? $programMonth->time_in_minutes : 0 }}</b>&nbsp;mins billed
-                        <span class="mx-2 text-secondary">|</span>
-                        <b>{{ $program->max_monthly_time_in_minutes - ($programMonth ? $programMonth->time_in_minutes : 0) }}</b>&nbsp;mins remaining
-                    </div>
-                    <?php $programNumber++; ?>
-                    <div class="mt-1 pl-3 d-flex align-items-center flex-wrap">
-                        <span class="pr-1">MCP: <b class="text-secondary">{{ $clientProgram->mcp ? $clientProgram->mcp->displayName() : '' }}</b></span>
-                        <span class="mx-2 text-secondary on-hover-opaque">|</span>
-                        <span class="pr-1">Manager: <b class="text-secondary">{{ $clientProgram->manager ? $clientProgram->manager->displayName() : '' }}</b></span>
-                    </div>
-                    <div class="mt-1 pl-3 d-flex align-items-center flex-wrap">
-                        <span class="pr-1">OB Visit: <b class="text-secondary">{{ $clientProgram->has_mcp_done_onboarding_visit }}</b></span>
-                        <span class="mx-2 text-secondary on-hover-opaque">|</span>
-                        <span class="pr-1">Setup: <b class="text-secondary">{{ $clientProgram->is_setup_complete }}</b></span>
-                    </div>
-                </td>
-            </tr>
-        @endforeach
-        </tbody>
-    </table>
-    @if(!$patient->clientPrograms || count($patient->clientPrograms) === 0)
-        <div class="p-2 border-top">
-            <span class="text-secondary">
-                No programs
-            </span>
-        </div>
-    @endif
-</div>
-

+ 0 - 559
resources/views/app/patient/programs.blade.php

@@ -1,559 +0,0 @@
-@extends ('layouts.patient')
-@section('inner-content')
-    <?php // $pro->pro_type = 'INDIVIDUAL'; ?>
-    <link href="/select2/select2.min.css" rel="stylesheet" />
-    <script src="/select2/select2.min.js"></script>
-    <div id="programsComponent">
-        <div class="d-flex align-items-center pb-3">
-            <h4 class="font-weight-bold m-0">Programs</h4>
-            {{-- add program --}}
-            @if($pro->pro_type === 'ADMIN')
-            <span class="mx-2 text-secondary">|</span>
-            <div moe large>
-                <a start show href="#">Add</a>
-                <form url="/api/clientProgram/create">
-                    <input type="hidden" name="clientUid" value="{{$patient->uid}}">
-                    <div class="mb-2">
-                        <label class="mb-1 text-sm text-secondary">Title</label>
-                        <input type="text" name="title" value=""
-                               class="form-control form-control-sm"
-                               placeholder="Title" required>
-                    </div>
-                    <div class="mb-2">
-                        <label class="mb-1 text-sm text-secondary">Measurement Types</label>
-                        <input type="hidden" name="measurementLabels" v-model="newMeasurementLabels">
-                        <select multiple add class="form-control form-control-sm">
-                            <option value=""></option>
-                            <option value="BP">Blood Pressure</option>
-                            <option value="BS">Blood Sugar</option>
-                            <option value="WEIGHT">Weight</option>
-                        </select>
-                    </div>
-                    <div class="form-group mb-0">
-                        <button class="btn btn-primary btn-sm mr-1" submit>Submit</button>
-                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-                    </div>
-                </form>
-            </div>
-            @endif
-            <select class="ml-auto max-width-200px form-control form-control-sm"
-                    onchange="fastLoad('/patients/view/{{$patient->uid}}/programs/' + this.value, true, false, false)">
-                <option value="" {{ $filter === '' ? 'selected' : '' }}>Current Month</option>
-                <option value="all" {{ $filter === 'all' ? 'selected' : '' }}>All Time</option>
-            </select>
-        </div>
-
-        @foreach($patient->clientPrograms as $program)
-        <?php
-            $programCategories = explode('|', $program->measurement_labels);
-            $programCategories = array_filter($programCategories, function($_item) {
-                return !empty($_item);
-            });
-            $programICDs = explode('|', $program->icds);
-            $programICDs = array_filter($programICDs, function($_item) {
-                return !empty($_item);
-            });
-            $programMonth = null;
-            if($filter === '') {
-                $programMonth = $program->getProgramMonth(strtoupper(date('F')), date('Y'));
-            }
-        ?>
-        <div class="card mb-4">
-
-            <div class="card-header d-flex align-items-start px-3 py-2 border-bottom">
-                <div class="pr-2">
-                    <span class="mr-1 font-weight-bold">{{ $program->title }}</span>
-                    @if($pro->pro_type === 'ADMIN')
-                    <div moe>
-                        <a href="#" show start class="on-hover-opaque"><i class="fa fa-edit"></i></a>
-                        <form url="/api/clientProgram/updateTitle">
-                            <input type="hidden" name="uid" value="{{ $program->uid }}">
-                            <div class="mb-2">
-                                <label class="mb-1 text-sm text-secondary">Program Title</label>
-                                <input type="text" name="title"
-                                       class="form-control form-control-sm"
-                                       placeholder="Title" value="{{ $program->title }}" required>
-                            </div>
-                            <div class="form-group mb-0">
-                                <button class="btn btn-primary btn-sm" submit>Submit</button>
-                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                    @endif
-                </div>
-
-                <div class="px-2 ml-auto border-right">
-                    <div class="d-flex">
-                        <span class="mr-2"><span class="text-secondary">MCP:</span>
-                            {{ $program->mcp ? $program->mcp->displayName() : '-' }}
-                        </span>
-                        @if($pro->pro_type === 'ADMIN')
-                        <div moe relative class="ml-auto">
-                            <a href="#" show start class="on-hover-opaque"><i class="fa fa-edit"></i></a>
-                            <form url="/api/clientProgram/changeMcp" right>
-                                <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                <div class="mb-2">
-                                    <label class="mb-1 text-sm text-secondary">Program MCP</label>
-                                    <select name="newMcpProUid" class="form-control form-control-sm" provider-search >
-                                        <option value="">-- Select MCP --</option>
-                                        @foreach($pros as $iPro)
-                                            <option value="{{ $iPro->uid }}" {{ $iPro->id === $program->mcp_pro_id ? 'selected' : ''  }}>
-                                                {{ $iPro->displayName() }}
-                                            </option>
-                                        @endforeach
-                                    </select>
-                                </div>
-                                <div class="mb-0">
-                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
-                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                        @endif
-                    </div>
-                </div>
-
-                <div class="pl-2">
-                    <div class="d-flex">
-                        <span class="mr-2"><span class="text-secondary">Manager:</span>
-                            {{ $program->manager ? $program->manager->displayName() : '-' }}
-                        </span>
-                        @if($pro->pro_type === 'ADMIN')
-                        <div moe relative class="ml-auto">
-                            <a href="#" show start class="on-hover-opaque"><i class="fa fa-edit"></i></a>
-                            <form url="/api/clientProgram/changeManager" right>
-                                <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                <div class="mb-2">
-                                    <label class="mb-1 text-sm text-secondary">Program Manager</label>
-                                    <select name="newManagerProUid" class="form-control form-control-sm" provider-search >
-                                        <option value="">-- Select Manager --</option>
-                                        @foreach($pros as $iPro)
-                                            <option value="{{ $iPro->uid }}" {{ $iPro->id === $program->manager_pro_id ? 'selected' : ''  }}>
-                                                {{ $iPro->displayName() }}
-                                            </option>
-                                        @endforeach
-                                    </select>
-                                </div>
-                                <div class="mb-0">
-                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
-                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                        @endif
-                    </div>
-                </div>
-            </div>
-
-            <div class="card-body p-0">
-
-                <div class="row">
-                    <div class="col-4 pr-0 border-right">
-                        <div class="">
-                            {{-- setup --}}
-                            <div class="border-bottom py-1 px-3">
-                                <span class="mr-1 text-secondary">Setup</span>
-                                @if($program->is_setup_complete === 'YES')
-                                    <i class="fa fa-check text-success"></i>
-                                @else
-                                    <i class="fa fa-exclamation-triangle text-warning"></i>
-                                @endif
-                                @if($pro->pro_type === 'ADMIN')
-                                <div moe relative class="ml-1">
-                                    <a start show class="py-0 font-weight-normal on-hover-opaque"><i class="fa fa-edit"></i></a>
-                                    <form url="/api/clientProgram/editSetupInfo">
-                                        <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Setup Status</label>
-                                            <select class="form-control form-control-sm bg-light" name="isSetupComplete" required>
-                                                <option value="">-- select --</option>
-                                                <option value="YES" {{ $program->is_setup_complete === 'YES' ? 'selected' : '' }}>Yes</option>
-                                                <option value="NO" {{ $program->is_setup_complete === 'NO' ? 'selected' : '' }}>No</option>
-                                                <option value="UNKNOWN" {{ $program->is_setup_complete === 'UNKNOWN' ? 'selected' : '' }}>Unknown</option>
-                                            </select>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Setup Status Memo</label>
-                                            <textarea class="form-control form-control-sm" rows="2" name="setupStatusMemo" value="{{ $program->setup_status_memo }}" placeholder="Memo"></textarea>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Setup Detail</label>
-                                            <textarea class="form-control form-control-sm" rows="2" name="setupDetail" value="{{ $program->setup_detail }}" placeholder="Detail"></textarea>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Device Identifier</label>
-                                            <input type="text" class="form-control form-control-sm" name="deviceIdentifier" value="{{ $program->device_identifier }}" placeholder="Device ID">
-                                        </div>
-                                        <div class="d-flex align-items-center">
-                                            <button class="btn btn-sm btn-primary mr-2" submit>Ok</button>
-                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
-                                @endif
-                            </div>
-
-                            {{-- onboarding --}}
-                            <div class="border-bottom py-1 px-3">
-                                <span class="mr-1 text-secondary">Onboarding</span>
-                                @if($program->has_mcp_done_onboarding_visit === 'YES')
-                                    <i class="fa fa-check text-success"></i>
-                                @else
-                                    <i class="fa fa-exclamation-triangle text-warning"></i>
-                                @endif
-                                @if($pro->pro_type === 'ADMIN')
-                                <div moe relative class="ml-1">
-                                    <a start show class="py-0 font-weight-normal on-hover-opaque"><i class="fa fa-edit"></i></a>
-                                    <form url="/api/clientProgram/editMcpOnboardingVisitInfo">
-                                        <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">OB Visit Done?</label>
-                                            <select class="form-control form-control-sm bg-light" name="hasMcpDoneOnboardingVisit" required>
-                                                <option value="">-- select --</option>
-                                                <option value="YES" {{ $program->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>Yes</option>
-                                                <option value="NO" {{ $program->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>No</option>
-                                                <option value="UNKNOWN" {{ $program->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>Unknown</option>
-                                            </select>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label class="text-sm mb-1 text-secondary">Date</label>
-                                            <input type="date" class="form-control form-control-sm" name="mcpOnboardingVisitDate" value="{{ $program->mcp_onboarding_visit_date }}" placeholder="">
-                                        </div>
-                                        <div class="d-flex align-items-center">
-                                            <button class="btn btn-sm btn-primary mr-2" submit>Ok</button>
-                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
-                                @endif
-                            </div>
-
-                            {{-- measurement labels --}}
-                            <div class="border-bottom py-1 px-3">
-                                <div class="d-flex">
-                                    <span class="mr-2 text-secondary">Measurement Types: </span>
-                                    <?php
-                                    $labels = '-';
-                                    if ($programCategories && count($programCategories)) {
-                                        $labels = implode(", ", $programCategories);
-                                    }
-                                    ?>
-                                    <span class="mr-2">{{ $labels }}</span>
-                                    @if($pro->pro_type === 'ADMIN')
-                                    <div moe large>
-                                        <a href="#" show start class="on-hover-opaque"><i class="fa fa-edit"></i></a>
-                                        <form url="/api/clientProgram/updateCategories">
-                                            <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                            <div class="mb-2">
-                                                <label class="mb-1 text-sm text-secondary">Measurement Types</label>
-                                                <input type="hidden" name="measurementLabels" v-model="existingMeasurementLabels['{{ $program->uid }}']">
-                                                <select multiple edit class="form-control form-control-sm" data-uid="{{ $program->uid }}">
-                                                    <option value=""></option>
-                                                    <option value="BP" {{ strpos($program->measurement_labels, "|BP|") !== FALSE ? 'selected' : '' }}>Blood Pressure</option>
-                                                    <option value="BS" {{ strpos($program->measurement_labels, "|BS|") !== FALSE ? 'selected' : '' }}>Blood Sugar</option>
-                                                    <option value="WEIGHT" {{ strpos($program->measurement_labels, "|WEIGHT|") !== FALSE ? 'selected' : '' }}>Weight</option>
-                                                </select>
-                                            </div>
-                                            <div class="mb-0">
-                                                <button class="btn btn-primary btn-sm" submit="">Submit</button>
-                                                <button class="btn btn-default border btn-sm" cancel="">Cancel</button>
-                                            </div>
-                                        </form>
-                                    </div>
-                                    @endif
-                                </div>
-                            </div>
-
-                            {{-- icds --}}
-                            <div class="border-bottom py-1 px-3">
-                                <div class="d-flex">
-                                    <span class="mr-2 text-secondary">ICDs: </span>
-                                    <?php
-                                    $labels = '-';
-                                    if ($programICDs && count($programICDs)) {
-                                        $labels = implode(", ", $programICDs);
-                                    }
-                                    ?>
-                                    <span class="mr-2">{{ $labels }}</span>
-                                    @if($pro->pro_type === 'ADMIN')
-                                    <div moe large>
-                                        <a href="#" show start class="on-hover-opaque"><i class="fa fa-edit"></i></a>
-                                        <form url="/api/clientProgram/updateIcds">
-                                            <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                            <input type="hidden" name="icds" v-model="existingICDsFlattened['{{ $program->uid }}']">
-                                            <div class="mb-2">
-                                                <label class="mb-1 text-sm text-secondary">ICDs
-                                                    <a href="#" class="ml-3"
-                                                       v-on:click.prevent="addICDItem('{{ $program->uid }}')">+ Add</a>
-                                                </label>
-                                                <div v-for="(icd, index) in existingICDs['{{ $program->uid }}']" class="d-flex align-items-center mb-2">
-                                                    <input required type="text"
-                                                           data-field="icd" data-program="{{ $program->uid }}" :data-index="index"
-                                                           v-model="existingICDs['{{ $program->uid }}'][index]"
-                                                           class="form-control form-control-sm flex-grow-1">
-                                                    <a v-if="existingICDs['{{ $program->uid }}'].length > 1"
-                                                       class="on-hover-opaque text-danger ml-2"
-                                                       v-on:click.prevent="existingICDs['{{ $program->uid }}'].splice(index, 1)">
-                                                        <i class="fa fa-trash-alt"></i>
-                                                    </a>
-                                                </div>
-                                            </div>
-                                            <div class="mb-0">
-                                                <button class="btn btn-primary btn-sm" submit="">Submit</button>
-                                                <button class="btn btn-default border btn-sm" cancel="">Cancel</button>
-                                            </div>
-                                        </form>
-                                    </div>
-                                    @endif
-                                </div>
-                            </div>
-
-                            {{-- work spec --}}
-                            <div class="py-1 px-3">
-                                <div class="d-flex">
-                                    <span class="mr-2 text-secondary">Work Spec: </span>
-                                    <span class="mr-2 font-weight-bold">{{ $program->min_monthly_time_in_minutes }}m - {{ $program->max_monthly_time_in_minutes }}m</span>
-                                    @if($pro->pro_type === 'ADMIN')
-                                    <div moe>
-                                        <a start show class="py-0 font-weight-normal on-hover-opaque"><i class="fa fa-edit"></i></a>
-                                        <form url="/api/clientProgram/editWorkSpec">
-                                            <input type="hidden" name="uid" value="{{ $program->uid }}">
-                                            <div class="mb-2">
-                                                <label class="text-sm mb-1 text-secondary">Min Monthly Time (minutes)</label>
-                                                <input type="number" class="form-control form-control-sm" name="minMonthlyTimeInMinutes" value="{{ $program->min_monthly_time_in_minutes }}" placeholder="">
-                                            </div>
-                                            <div class="mb-2">
-                                                <label class="text-sm mb-1 text-secondary">Max Monthly Time (minutes)</label>
-                                                <input type="number" class="form-control form-control-sm" name="maxMonthlyTimeInMinutes" value="{{ $program->max_monthly_time_in_minutes }}" placeholder="">
-                                            </div>
-                                            <div class="mb-2">
-                                                <label class="text-sm mb-1 text-secondary">Time In Minutes Memo</label>
-                                                <textarea class="form-control form-control-sm" rows="2" name="timeInMinutesMemo" value="{{ $program->time_in_minutes_memo }}" placeholder=""></textarea>
-                                            </div>
-                                            <div class="mb-2">
-                                                <label class="text-sm mb-1 text-secondary">Goal</label>
-                                                <textarea class="form-control form-control-sm" rows="2" name="goal" value="{{ $program->goal }}" placeholder=""></textarea>
-                                            </div>
-                                            <div class="mb-2">
-                                                <label class="text-sm mb-1 text-secondary">Sticky Note</label>
-                                                <textarea class="form-control form-control-sm" rows="2" name="stickyNote" value="{{ $program->sticky_note }}" placeholder=""></textarea>
-                                            </div>
-                                            <div class="mb-2">
-                                                <label class="mb-1 text-secondary d-flex align-items-center">
-                                                    <span class="mr-2">Change Current Month</span>
-                                                    <input type="checkbox" name="changeCurrentMonth">
-                                                </label>
-                                            </div>
-                                            <div class="d-flex align-items-center">
-                                                <button class="btn btn-sm btn-primary mr-2" submit>Ok</button>
-                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                            </div>
-                                        </form>
-                                    </div>
-                                    @endif
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                    <div class="col-8 pl-0">
-                        <div class="border-bottom py-1 px-2 bg-light d-flex">
-                            <span class="font-weight-bold">Measurements</span>
-                            @if($programCategories && count($programCategories))
-                                <div class="d-inline-flex">
-                                @foreach($programCategories as $category)
-                                    <span class="mx-2 text-secondary">|</span>
-                                    <div moe relative>
-                                        <a href="#" start show>+ {{ $category }}</a>
-                                        <form url="/api/measurement/create">
-                                            <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                                            <input type="hidden" name="label" value="{{ $category }}">
-                                            <div class="mb-2">
-                                                <label class="text-sm text-secondary mb-1 font-weight-bold">{{ $category }}</label>
-                                                <input required autofocus type="text" class="form-control form-control-sm"
-                                                       name="value" placeholder="Value">
-                                            </div>
-                                            <div class="mb-2">
-                                                <input required type="date" class="form-control form-control-sm"
-                                                       name="effectiveDate" max="{{ date('Y-m-d') }}" value="{{ date('Y-m-d') }}">
-                                            </div>
-                                            <div class="d-flex align-items-center">
-                                                <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                            </div>
-                                        </form>
-                                    </div>
-                                @endforeach
-                                </div>
-                            @endif
-                            @if(!!$programMonth)
-                                <div class="ml-auto pr-2">
-                                    <b>{{ minutes_to_hhmm($programMonth->time_in_minutes) }}</b> billed,
-                                    <b>{{ minutes_to_hhmm($program->max_monthly_time_in_minutes - $programMonth->time_in_minutes) }}</b> remaining
-                                </div>
-                            @endif
-                        </div>
-                        <?php
-                        $programMeasurements = [];
-                        foreach($patient->allMeasurements as $measurement) {
-                            $measurementED = strtotime($measurement->effective_date);
-                            if(in_array($measurement->label, $programCategories) !== FALSE) {
-                                if($filter === 'all' ||
-                                    (date('Y') === date('Y', $measurementED) && date('m') === date('m', $measurementED))) {
-                                    $programMeasurements[] = $measurement;
-                                }
-                            }
-                        }
-                        ?>
-                        @foreach($programMeasurements as $measurement)
-                            <?php $minutes = $measurement->minutesEntered($pro); ?>
-                            @include('app/patient/partials/measurement', ['measurement' => $measurement, 'child' => false])
-                            @foreach($measurement->childMeasurements() as $childMeasurement)
-                                @include('app/patient/partials/measurement', ['measurement' => $childMeasurement, 'child' => true])
-                            @endforeach
-                        @endforeach
-                        @if(!count($programMeasurements))
-                            <div class="text-secondary py-1 px-2 border-0">
-                                No measurements to show
-                            </div>
-                        @endif
-                    </div>
-                </div>
-
-            </div>
-
-        </div>
-        @endforeach
-
-    </div>
-
-    <script>
-        <?php
-            $measurementLabels = [];
-            foreach($patient->clientPrograms as $program) {
-                $measurementLabels[$program->uid] = $program->measurement_labels;
-            }
-            $icds = [];
-            $icdsFlattened = [];
-            foreach($patient->clientPrograms as $program) {
-                $icds[$program->uid] = array_values(array_filter(explode("|", $program->icds), function($_item) {
-                    return !empty($_item);
-                }));
-                $icdsFlattened[$program->uid] = $program->icds;
-            }
-        ?>
-        (function() {
-            function init() {
-                window.programsComponent = new Vue({
-                    el: '#programsComponent',
-                    delimiters: ['@{{', '}}'],
-                    data: {
-                        newMeasurementLabels: '',
-                        existingMeasurementLabels: <?= json_encode($measurementLabels) ?>,
-                        existingICDs: <?= json_encode($icds) ?>,
-                        existingICDsFlattened: <?= json_encode($icdsFlattened) ?>,
-                    },
-                    methods: {
-                        combine: function(_array) {
-                            if(!_array || !_array.length) return '';
-                            let valid = _array.filter(function(_x) {
-                                return !!_x;
-                            });
-                            if(!valid || !valid.length) return '';
-                            return '|' + valid.join('|') + '|';
-                        },
-                        addICDItem: function(_programUid) {
-                            this.existingICDs[_programUid].push('');
-                            let self = this;
-                            Vue.nextTick(function() {
-                                self.initICDAutoSuggest();
-                            });
-                        },
-                        initICDAutoSuggest: function() {
-                            let self = this;
-                            $('#programsComponent input[type="text"][data-field="icd"]:not([ac-initialized])').each(function() {
-                                var elem = this,
-                                    dynID = 'icd-' + Math.ceil(Math.random() * 1000000),
-                                    vueIndex = $(this).attr('data-index');
-                                $(elem).attr('id', dynID);
-                                new window.Def.Autocompleter.Search(dynID,
-                                    'https://clinicaltables.nlm.nih.gov/api/icd10cm/v3/search?sf=code,name&ef=name', {
-                                        tableFormat: true,
-                                        valueCols: [0],
-                                        colHeaders: ['Code', 'Name'],
-                                    }
-                                );
-                                window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
-                                    let autocomp = elem.autocomp, acData = autocomp.getSelectedItemData();
-                                    self.existingICDs[$(elem).attr('data-program')][+$(elem).attr('data-index')] = acData[0].code;
-                                    self.existingICDsFlattened[$(elem).attr('data-program')] = self.combine(self.existingICDs[$(elem).attr('data-program')]);
-                                    return false;
-                                });
-                                $(elem).attr('ac-initialized', 1);
-                            });
-                        },
-                    },
-                    watch: {
-                        existingICDs: {
-                            handler: function(val, oldVal) {
-                                let self = this;
-                                for(let x in this.existingICDs) {
-                                    if(this.existingICDs.hasOwnProperty(x)) {
-                                        this.existingICDsFlattened[x] = this.combine(this.existingICDs[x]);
-                                    }
-                                }
-                            },
-                            deep: true
-                        }
-                    },
-                    mounted: function() {
-                        let self = this;
-                        $('#programsComponent [moe][initialized]').removeAttr('initialized');
-                        initMoes();
-                        $('select[multiple][add]')
-                            .select2({
-                                width: '100%',
-                                placeholder: '-- select --'
-                            })
-                            .on('change', function() {
-                                if($(this).val() && $(this).val().length) {
-                                    self.newMeasurementLabels = '|' + $(this).val().join('|') + '|';
-                                }
-                                else {
-                                    self.newMeasurementLabels = '';
-                                }
-                            });
-                        $('select[multiple][edit]')
-                            .select2({
-                                width: '100%',
-                                placeholder: '-- select --'
-                            })
-                            .on('change', function() {
-                                if($(this).val() && $(this).val().length) {
-                                    self.existingMeasurementLabels[$(this).attr('data-uid')] = '|' + $(this).val().join('|') + '|';
-                                }
-                                else {
-                                    self.existingMeasurementLabels[$(this).attr('data-uid')] = '';
-                                }
-                            });
-
-                        // give 1 row min for editing
-                        for(let x in this.existingICDs) {
-                            if(this.existingICDs.hasOwnProperty(x)) {
-                                if(!this.existingICDs[x] || !this.existingICDs[x].length || !Array.isArray(this.existingICDs[x])) {
-                                    this.existingICDs[x] = [''];
-                                }
-                            }
-                        }
-
-                        Vue.nextTick(function() {
-                            self.initICDAutoSuggest();
-                        });
-
-                    }
-                });
-            }
-            addMCInitializer('programs', init, '#programsComponent');
-        })();
-    </script>
-@endsection

+ 0 - 327
resources/views/app/patients.blade.php

@@ -1,327 +0,0 @@
-@extends ('layouts/template')
-
-@section('content')
-
-    <?php
-    $showProgramsColumn = false;
-    foreach($patients as $patient) {
-        if(count($patient->clientPrograms)) {
-            if($pro->pro_type === 'ADMIN') {
-                $showProgramsColumn = true;
-                break;
-            }
-            else {
-                foreach($patient->clientPrograms as $clientProgram) {
-                    if(in_array($pro->id, [$clientProgram->mcp_pro_id, $clientProgram->manager_pro_id])) {
-                        $showProgramsColumn = true;
-                        break;
-                    }
-                }
-                if($showProgramsColumn) break;
-            }
-        }
-    }
-    ?>
-
-    <div class="p-3 mcp-theme-1" id="patients-list">
-    <div class="card">
-
-        <div class="card-header px-3 py-2 d-flex align-items-center">
-            <strong class="mr-4">
-                <i class="fas fa-user"></i>
-                Patients
-            </strong>
-            <div class="ml-auto d-flex align-items-center search-form">
-                <form action="" method="get" class="mr-2" id="patients-search">
-                    <input type="text" name="q" value="{{request()->input('q')}}" class="form-control form-control-sm"
-                           placeholder="Name / Email / Tags">
-                </form>
-                <select class="ml-auto max-width-300px form-control form-control-sm"
-                        id="patients-filter">
-                    <option value="" {{ $filter === '' ? 'selected' : '' }}>All patients</option>
-                    <option value="not-yet-seen" {{ $filter === 'not-yet-seen' ? 'selected' : '' }}>Patients I have not seen yet</option>
-                    <option value="having-birthday-today" {{ $filter === 'having-birthday-today' ? 'selected' : '' }}>Patients having birthday today</option>
-                </select>
-            </div>
-        </div>
-
-        <div class="card-body p-0">
-            <table class="table table-sm table-bordered p-0 m-0">
-                <thead class="bg-light">
-                <tr>
-                    @if($pro->pro_type === 'ADMIN')
-                        <th class="border-0"></th>
-                    @endif
-                    <th class="px-3 border-0">Chart #</th>
-                    <th class="border-0">Patient</th>
-                    @if($pro->isDefaultNA() || $pro->pro_type === 'ADMIN')
-                        <th class="border-0">Source</th>
-                    @endif
-                    <th class="border-0 px-1">OB</th>
-                    <th class="border-0">Signed<br>Notes</th>
-                    <th class="border-0">CM<br>Setup</th>
-                    <th class="border-0">Created At</th>
-                    <th class="border-0">Address</th>
-                    @if($showProgramsColumn)
-                        <th class="border-0">Program(s)</th>@endif
-                    <th class="border-0">MCN</th>
-                    <th class="border-0">PCP</th>
-                    <th class="border-0"><span class="text-nowrap">Recent Notes</span><br>(overall)</th>
-                    <th class="border-0"><span class="text-nowrap">Recent Notes</span><br>(me)</th>
-                    <th class="border-0">Appointments</th>
-                    <th class="border-0">Account</th>
-                    <th class="border-0">Tags</th>
-
-
-
-                </tr>
-                </thead>
-                <tbody>
-                @foreach($patients as $patient)
-                    <tr>
-                        @if($pro->pro_type === 'ADMIN')
-                        <td>{{$loop->index + 1}}</td>
-                        @endif
-                        <td class="px-3">
-                            <a href="{{route('patients.view.dashboard', $patient)}}">
-                                {{$patient->chart_number}}
-                            </a>
-                        </td>
-                        <td>
-                            {{$patient->displayName()}}
-                            <div>{{ friendly_date_time($patient->dob, false) }}{{ $patient->sex === 'M' ? ', Male' : ($patient->sex === ', F' ? 'Female' : '') }}</div>
-                        </td>
-                        @if($pro->isDefaultNA() || $pro->pro_type === 'ADMIN')
-                            <td>
-                                @if($patient->has_system_source)
-                                    @if($patient->system_source_category === 'PRO_TEAM' && $patient->systemSourceProTeam)
-                                        <div class="text-nowrap">Via team profile</div>
-                                        <a native target="_blank" href="{{config('app.stagfe6_url')}}/{{$patient->systemSourceProTeam->slug}}">{{$patient->systemSourceProTeam->slug}}</a>
-                                    @elseif($patient->system_source_category === 'PRO' && $patient->systemSourcePro)
-                                        <div class="text-nowrap">Via pro profile</div>
-                                        <a native target="_blank" href="{{config('app.stagfe6_url')}}/{{$patient->systemSourcePro->slug}}">{{$patient->systemSourcePro->slug}}</a>
-                                    @endif
-                                @endif
-                            </td>
-                        @endif
-                        <td class="px-1">
-                            @if($patient->has_mcp_done_onboarding_visit !== 'YES')
-                                <span title="MCP Onboarding Visit Pending"><i class="fa fa-exclamation-triangle"></i></span>
-                            @else
-                                <i class="fa fa-check text-secondary on-hover-opaque"></i>
-                            @endif
-                        </td>
-                        <td>
-                            <?php $numSignedNotes = $patient->numSignedNotes(); ?>
-                            <span class="{{$numSignedNotes && $patient->has_mcp_done_onboarding_visit !== 'YES' ? 'font-weight-bold text-warning-mellow' : 'text-secondary'}}">
-                                {{$numSignedNotes ? $numSignedNotes :'-'}}
-                            </span>
-                        </td>
-                        <td>
-                            @if($patient->has_cm_setup_been_performed && $patient->cmSetupNote)
-                                <i class="fa fa-check text-secondary on-hover-opaque"></i>
-                                <br>
-                                <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $patient->cmSetupNote])}}">Note</a>
-                            @else
-                                -
-                            @endif
-                        </td>
-                        <td>
-                            {{ friendly_date_time_short_with_tz($patient->created_at, true, 'EASTERN') }}
-                            <hr>
-                            @if($pro->pro_type === 'ADMIN')
-                                {{ $patient->initiative }}
-                            @endif
-                        </td>
-                        <td>
-                            <?php
-                            $addressParts = [];
-                            if (!!$patient->mailing_address_line1) $addressParts[] = $patient->mailing_address_line1;
-                            if (!!$patient->mailing_address_line2) $addressParts[] = $patient->mailing_address_line2;
-                            $addressParts = implode(", ", $addressParts) . "<br/>";
-                            $addressPart2 = [];
-                            if (!!$patient->mailing_address_city) $addressPart2[] = $patient->mailing_address_city;
-                            if (!!$patient->mailing_address_state) $addressPart2[] = $patient->mailing_address_state;
-                            $addressParts .= implode(", ", $addressPart2);
-                            echo $addressParts;
-                            ?>
-                        </td>
-                        @if($showProgramsColumn)
-                        <td>
-                            <?php $programNumber = 0; ?>
-                            @foreach($patient->clientPrograms as $clientProgram)
-                                <?php
-                                    if($pro->pro_type === 'ADMIN' ||
-                                        in_array($pro->id, [$clientProgram->mcp_pro_id, $clientProgram->manager_pro_id])
-                                    ) {
-                                        // $program = $clientProgram->program;
-                                        $programNumber++;
-                                ?>
-                                <div class="mb-1 text-nowrap">
-                                    {{ $programNumber }}. {{ $clientProgram->title }}
-                                    @if($clientProgram->has_mcp_done_onboarding_visit !== 'YES')
-                                        <span title="Onboarding Pending" class="ml-1"><i class="fa fa-exclamation-triangle"></i></span>
-                                    @else
-                                        <span title="Onboarding Complete" class="ml-1 text-secondary"><i class="fa fa-check"></i></span>
-                                    @endif
-                                </div>
-                                <?php } ?>
-                            @endforeach
-                        </td>
-                        @endif
-                        <td>
-                            @include('app.patient.coverage_column_renderer', ['patient'=>$patient])
-                        </td>
-                        <td>
-                            {{ $patient->mcp ? $patient->mcp->displayName() : '-' }}
-                        </td>
-                        <td class="p-0">
-                            <?php $allNotes = $patient->recentNotes(); ?>
-                            <table class="table table-sm table-condensed table-bordered m-0 width-200px">
-                                <tbody>
-                                @foreach($allNotes as $note)
-                                    <tr>
-                                        <td>
-                                            <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}"><b class="text-nowrap">{{friendlier_date($note->effective_dateest)}}</b></a>
-                                            <br>
-                                            <span class="text-nowrap">{{$note->hcpPro->displayName()}}</span>
-                                        </td>
-                                        <td>{{$note->new_or_fu_or_na}}</td>
-                                    </tr>
-                                @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td class="py-0 pl-2">
-                            <?php $myNotes = $patient->recentNotes($pro); ?>
-                            <table class="table table-sm table-condensed table-bordered m-0 width-200px">
-                                <tbody>
-                                @foreach($myNotes as $note)
-                                    <tr>
-                                        <td>
-                                            <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}"><b class="text-nowrap">{{friendlier_date($note->effective_dateest)}}</b></a>
-                                        </td>
-                                        <td>{{$note->new_or_fu_or_na}}</td>
-                                    </tr>
-                                @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td>
-                            <table class="table table-sm border-0 my-0">
-                                <tbody>
-                                <?php $numAppts = 0; ?>
-                                @foreach($patient->upcomingAppointments as $appointment)
-                                    @if($appointment->status !== 'CANCELLED' && $appointment->status !== 'ABANDONED')
-                                    <tr>
-                                        <td class="text-black p-0 border-0">
-                                            <div class="pb-0">
-                                                {{ friendly_date_time($appointment->start_time, false) }}, {{ friendly_time($appointment->raw_start_time) }}
-                                                <span class="d-inline-block text-secondary text-sm">({{ $appointment->timezone }})</span>
-                                                <br>
-                                                <b class="mr-1">{{$appointment->pro->displayName()}}</b>
-                                                <span class="text-secondary text-sm">({{ $appointment->status }})</span>
-                                            </div>
-                                        </td>
-                                    </tr>
-                                    <?php $numAppts++; ?>
-                                    @endif
-                                @endforeach
-                                @if(!$numAppts)
-                                    <tr>
-                                        <td class="text-secondary p-0 border-0">
-                                            No upcoming appointments
-                                        </td>
-                                    </tr>
-                                @endif
-                                </tbody>
-                            </table>
-                        </td>
-                        <td>
-                            @if($patient->linkedAccounts && count($patient->linkedAccounts))
-                                <span class="font-weight-bold text-info"><i class="fa fa-check"></i></span>
-                            @else
-                                <span class="text-secondary">-</span>
-                            @endif
-                        </td>
-                        <td>
-                            @if($patient->tags)
-                                <?php
-                                $tags = explode("|", $patient->tags);
-                                $tags = array_filter($tags, function($_x) {
-                                    return !empty($_x);
-                                });
-                                $tags = implode(", ", $tags);
-                                ?>
-                                {{ $tags }}
-                            @endif
-                        </td>
-                    </tr>
-                @endforeach
-                </tbody>
-
-            </table>
-            <div class="ml-2 mt-2">
-             {{$patients->links()}}
-            </div>
-        </div>
-    </div>
-    </div>
-
-    <script>
-        (function() {
-            function init() {
-                function submit() {
-                    let url = '/patients' +
-                        ($('#patients-filter').val() ? '/' + $('#patients-filter').val() : '') +
-                        ($('#patients-search input').val() ? '?q=' + encodeURIComponent($('#patients-search input').val()) : '');
-                    fastLoad(url);
-                    return false;
-                }
-                $('#patients-search').off('submit').on('submit', submit);
-                $('#patients-filter').off('change').on('change', submit);
-
-                @if($pro->id === 1 || $pro->id === 16)
-                    patientAcquisitionChart();
-                @endif
-            }
-
-            @if($pro->pro_type === 'ADMIN')
-            <?php
-            $dates = [];
-            $acquisitions = [];
-            for ($i = count($patientAcquisitionData) - 1; $i >= 0; $i--) {
-                $dates[] = $patientAcquisitionData[$i]->date;
-                $acquisitions[] = $patientAcquisitionData[$i]->count;
-            }
-            ?>
-            function patientAcquisitionChart() {
-                var chart = c3.generate({
-                    bindto: '#patientAcquisitionChart',
-                    data: {
-                        x: 'x',
-                        // xFormat: '%Y%m%d', // 'xFormat' can be used as custom format of 'x'
-                        columns: [
-                            ['x', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $dates)) ?>],
-                            ['New Patients', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $acquisitions)) ?>],
-                        ]
-                    },
-                    axis: {
-                        x: {
-                            type: 'timeseries',
-                            tick: {
-                                format: '%Y-%m-%d',
-                                multiline: true,
-                                fit: true,
-                                rotate: -45
-                            },
-                        },
-                    }
-                });
-            }
-            @endif
-
-            addMCInitializer('patients-list', init, '#patients-list');
-        }).call(window);
-    </script>
-@endsection

+ 0 - 5
routes/web.php

@@ -71,8 +71,6 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/new-patient', 'HomeController@newPatient')->name('new-patient');
     Route::get('/new-patient', 'HomeController@newPatient')->name('new-patient');
     Route::get('/new-non-mcn-patient', 'HomeController@newNonMcnPatient')->name('new-non-mcn-patient');
     Route::get('/new-non-mcn-patient', 'HomeController@newNonMcnPatient')->name('new-non-mcn-patient');
 
 
-    Route::get('/patients/{filter?}', 'HomeController@patients')->name('patients');
-
     Route::get('/unmapped-sms/{filter?}', 'HomeController@unmappedSMS')->name('unmapped-sms');
     Route::get('/unmapped-sms/{filter?}', 'HomeController@unmappedSMS')->name('unmapped-sms');
 
 
     Route::get('/can-access-patient/{uid}', 'HomeController@canAccessPatient')->name('can-access-patient');
     Route::get('/can-access-patient/{uid}', 'HomeController@canAccessPatient')->name('can-access-patient');
@@ -579,9 +577,6 @@ Route::middleware('pro.auth')->group(function () {
             // appointment calendar
             // appointment calendar
             Route::get('calendar/{currentAppointment?}', 'PatientController@calendar')->name('calendar');
             Route::get('calendar/{currentAppointment?}', 'PatientController@calendar')->name('calendar');
 
 
-            // programs
-            Route::get('programs/{filter?}', 'PatientController@programs')->name('programs');
-
             // flowsheets
             // flowsheets
             Route::get('flowsheets/{filter?}', 'PatientController@flowsheets')->name('flowsheets');
             Route::get('flowsheets/{filter?}', 'PatientController@flowsheets')->name('flowsheets');