dashboard-admin.blade.php 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. @extends ('layouts.template')
  2. @section('content')
  3. <style>
  4. tr.thin th, tr.thin td {
  5. padding: 0.25em;
  6. }
  7. </style>
  8. <div class="p-3">
  9. <div class="">
  10. <div class="row mcp-theme-1" id="pro-dashboard-container" v-cloak>
  11. <div class="col-md-3 mcp-theme-1">
  12. <div class="mb-4" v-show="tab==='appointments'">
  13. <div class="pro-dashboard-inline-calendar"></div>
  14. </div>
  15. <div class="card mb-4">
  16. <div class="card-header pl-2">
  17. <strong>
  18. Key Numbers
  19. </strong>
  20. </div>
  21. <div class="card-body p-0">
  22. <table class="table mb-0 dashboard-stats-table">
  23. <tbody>
  24. <tr>
  25. <th class="px-2 text-center">{{$pro->get_patients_count_as_admin()}}</th>
  26. <th class="pl-2">Patients</th>
  27. </tr>
  28. <tr>
  29. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_admin()}}</th>
  30. <th class="pl-2">New Patients Awaiting Visit</th>
  31. </tr>
  32. <tr>
  33. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_admin()}}</th>
  34. <th class="pl-2">Notes Pending Signature</th>
  35. </tr>
  36. <tr>
  37. <th class="px-2 text-center">{{$pro->get_notes_pending_summary_suggestion_count_as_admin()}}</th>
  38. <th class="pl-2">
  39. <a href="{{ route('admin.notes_pending_summary_suggestion') }}"
  40. native target="_blank"
  41. open-in-stag-popup
  42. popup-style="tall stag-popup-md"
  43. title="Notes With Pending Summary Suggestion">
  44. Notes With Pending Summary Suggestion
  45. </a>
  46. </th>
  47. </tr>
  48. <tr>
  49. <th class="px-2 text-center">{{$pro->get_notes_rejected_summary_suggestion_count_as_admin()}}</th>
  50. <th class="pl-2">
  51. <a href="{{ route('admin.notes_rejected_summary_suggestion') }}"
  52. native target="_blank"
  53. open-in-stag-popup
  54. popup-style="tall"
  55. title="Notes With Rejected Summary Suggestion">
  56. Notes With Rejected Summary Suggestion
  57. </a>
  58. </th>
  59. </tr>
  60. <tr>
  61. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_admin()}}</th>
  62. <th class="pl-2">Notes Pending Billing</th>
  63. </tr>
  64. <tr>
  65. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_admin()}}</th>
  66. <th class="pl-2">Reports Pending Signature</th>
  67. </tr>
  68. <tr>
  69. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_admin()}}</th>
  70. <th class="pl-2">Patients w/o Appointments</th>
  71. </tr>
  72. <tr>
  73. <th class="px-2 text-center">{{$pro->get_patients_not_seen_in_45_days_count_as_mcp()}}</th>
  74. <th class="pl-2">Patients Not Seen in 45 Days</th>
  75. </tr>
  76. <tr>
  77. <th class="px-2 text-center">{{$pro->get_cancelled_appointments_pending_acknowledgement_count_as_mcp()}}</th>
  78. <th class="pl-2">Cancelled Appts. Pending Review</th>
  79. </tr>
  80. <tr>
  81. <th class="px-2 text-center">{{$pro->get_cancelled_bills_awaiting_review_count_as_mcp()}}</th>
  82. <th class="pl-2">Cancelled Bills Pending Review</th>
  83. </tr>
  84. <tr>
  85. <th class="px-2 text-center">{{$pro->get_cancelled_supply_orders_awaiting_review_count_as_mcp()}}</th>
  86. <th class="pl-2">Cancelled Supply Orders</th>
  87. </tr>
  88. <tr>
  89. <th class="px-2 text-center">{{$pro->get_erx_and_orders_awaiting_signature_count_as_mcp()}}</th>
  90. <th class="pl-2">ERx & Orders Pending Signature</th>
  91. </tr>
  92. <tr>
  93. <th class="px-2 text-center">{{$pro->get_supply_orders_awaiting_signature_count_as_mcp()}}</th>
  94. <th class="pl-2">Supply Orders Pending Signature</th>
  95. </tr>
  96. <tr>
  97. <th class="px-2 text-center">{{$pro->get_open_tickets_count_as_mcp()}}</th>
  98. <th class="pl-2">
  99. <a href="{{ route('practice-management.myTickets') }}">
  100. Open Ticket{{$pro->get_open_tickets_count_as_mcp() !== 1 ? 's' : ''}}
  101. </a>
  102. </th>
  103. </tr>
  104. <tr>
  105. <th class="px-2 text-center">{{ $pro->myNotesPendingSupervisorPhysicianStamping() }}</th>
  106. <th class="pl-2">
  107. <a href="{{ route('practice-management.notes-pending-physician-supervisor-stamping', ['hideTitle' => true]) }}"
  108. native target="_blank"
  109. open-in-stag-popup
  110. popup-style="tall stag-popup-md"
  111. title="Notes Pending Physician Supervisor Stamping">
  112. Notes Pending Physician Supervisor Stamping
  113. </a>
  114. </th>
  115. </tr>
  116. </tbody>
  117. </table>
  118. </div>
  119. </div>
  120. <div class="card mb-4">
  121. <div class="card-header pl-2">
  122. <strong>
  123. Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
  124. </strong>
  125. </div>
  126. <div class="card-body p-0">
  127. <table class="table mb-0 dashboard-stats-table">
  128. <tbody>
  129. <tr>
  130. <th class="px-2 text-center">{{$pro->get_measurements_awaiting_review_count_as_mcp() ?? '-'}}</th>
  131. <th class="pl-2">Measurements Pending Review</th>
  132. </tr>
  133. <tr>
  134. <th class="px-2 text-center">{{$pro->get_patients_without_remote_measurement_in_48_hours_count_as_mcp() ?? '-'}}</th>
  135. <th class="pl-2">Patients w/o Measurement in 48 hrs.</th>
  136. </tr>
  137. </tbody>
  138. </table>
  139. </div>
  140. </div>
  141. <div class="card mb-4">
  142. <div class="card-header pl-2">
  143. <strong>
  144. Practice Management
  145. </strong>
  146. </div>
  147. <div class="card-body p-0">
  148. <table class="table mb-0 dashboard-stats-table">
  149. <tbody>
  150. <tr>
  151. <th colspan="2">Revenue Cycle Management</th>
  152. </tr>
  153. <tr class="thin">
  154. <th class="font-weight-normal px-2 pl-4">
  155. ${{friendly_money($reimbursement['currentBalance'])}}</th>
  156. <th class="font-weight-normal pl-2 w-100"><a
  157. href="/practice-management/financial-transactions">Current balance</a></th>
  158. </tr>
  159. <!-- <tr>
  160. <th class="px-2">{{friendly_date_time($reimbursement['nextPaymentDate'], false)}}</th>
  161. <th class="pl-2">Next Payment Date</th>
  162. </tr> -->
  163. <tr class="thin">
  164. <th class="font-weight-normal px-2 pl-4">${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  165. <th class="font-weight-normal pl-2"><a
  166. href="/practice-management/bills-under-processing">Processing</a></th>
  167. </tr>
  168. <tr class="thin">
  169. <th class="font-weight-normal px-2 pl-5">${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  170. <th class="font-weight-normal pl-2"><a
  171. href="/practice-management/bills-under-processing">Treatment Services</a></th>
  172. </tr>
  173. <tr class="thin">
  174. <th class="font-weight-normal px-2 pl-5">${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  175. <th class="font-weight-normal pl-2"><a
  176. href="/practice-management/bills-under-processing">Remote Monitoring</a></th>
  177. </tr>
  178. <tr class="thin">
  179. <th class="font-weight-normal px-2 pl-5">${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  180. <th class="font-weight-normal pl-2"><a
  181. href="/practice-management/bills-under-processing">Other Services</a></th>
  182. </tr>
  183. {{--
  184. <tr>
  185. <th class="px-2">{{$reimbursement['lastPayment']}}</th>
  186. <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment</a></th>
  187. </tr>
  188. <tr>
  189. <th class="px-2">{{friendly_date_time($reimbursement['lastPaymentDate'], false)}}</th>
  190. <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment date</a></th>
  191. </tr>
  192. --}}
  193. </tbody>
  194. </table>
  195. </div>
  196. </div>
  197. @if($pro->pro_type === 'ADMIN')
  198. <div class="card mb-4">
  199. <div class="card-header pl-2">
  200. <strong>
  201. Bills &amp; Claims
  202. </strong>
  203. </div>
  204. <div class="card-body p-0">
  205. <table class="table mb-0 dashboard-stats-table">
  206. <tbody>
  207. <tr>
  208. <th class="border-top-1 px-2 text-center">{{$businessNumbers['notesWithBillsToResolve']}}</th>
  209. <th class="border-top-1 pl-2">
  210. <a href="/practice-management/billing-manager">Notes with bills to
  211. resolve</a>
  212. </th>
  213. </tr>
  214. <tr>
  215. <th class="border-top-1 px-2 text-center">{{$businessNumbers['notesPendingBillingClosure']}}</th>
  216. <th class="border-top-1 pl-2">
  217. <a href="/practice-management/billing-manager">Notes pending billing
  218. closure</a>
  219. </th>
  220. </tr>
  221. </tbody>
  222. </table>
  223. </div>
  224. </div>
  225. @endif
  226. </div>
  227. <div class="col-md-9">
  228. <ul class="nav nav-tabs">
  229. <li class="nav-item">
  230. <a native data-tab="appointments" class="nav-link"
  231. :class="tab == 'appointments' ? 'active' : ''" href="#"
  232. v-on:click.prevent="tab='appointments'; initLoadAppointments();">
  233. Appointments
  234. </a>
  235. </li>
  236. <li class="nav-item">
  237. <a native data-tab="rpm" class="nav-link"
  238. :class="tab == 'rpm' ? 'active' : ''" href="#"
  239. v-on:click.prevent="tab='rpm';">
  240. RPM
  241. </a>
  242. </li>
  243. <li class="nav-item">
  244. <a native data-tab="measurements" class="nav-link"
  245. :class="tab == 'measurements' ? 'active' : ''" href="#"
  246. v-on:click.prevent="tab='measurements'; loadMeasurements();">
  247. Measurements
  248. </a>
  249. </li>
  250. <li class="nav-item">
  251. <a native data-tab="incoming_reports"
  252. class="nav-link {{count($incomingReports) ? 'text-danger font-weight-bold' : ''}}"
  253. :class="tab == 'incoming_reports' ? 'active' : ''" href="#"
  254. v-on:click.prevent="tab='incoming_reports'">
  255. Incoming Reports ({{count($incomingReports)}})
  256. </a>
  257. </li>
  258. <li class="nav-item">
  259. <a native data-tab="erx" class="nav-link {{$numERx ? 'text-danger font-weight-bold' : ''}}"
  260. :class="tab == 'erx' ? 'active' : ''" href="#"
  261. v-on:click.prevent="tab='erx'">
  262. ERx ({{$numERx}})
  263. </a>
  264. </li>
  265. <li class="nav-item">
  266. <a native data-tab="labs"
  267. class="nav-link {{$numLabs ? 'text-danger font-weight-bold' : ''}}"
  268. :class="tab == 'labs' ? 'active' : ''" href="#"
  269. v-on:click.prevent="tab='labs'">
  270. Labs ({{$numLabs}})
  271. </a>
  272. </li>
  273. <li class="nav-item">
  274. <a native data-tab="imaging"
  275. class="nav-link {{$numImaging ? 'text-danger font-weight-bold' : ''}}"
  276. :class="tab == 'imaging' ? 'active' : ''" href="#"
  277. v-on:click.prevent="tab='imaging'">
  278. Imaging ({{$numImaging}})
  279. </a>
  280. </li>
  281. <li class="nav-item">
  282. <a native data-tab="supply_orders"
  283. class="nav-link {{$numSupplyOrders ? 'text-danger font-weight-bold' : ''}}"
  284. :class="tab == 'supply_orders' ? 'active' : ''" href="#"
  285. v-on:click.prevent="tab='supply_orders'">
  286. Supply Orders ({{$numSupplyOrders}})
  287. </a>
  288. </li>
  289. </ul>
  290. <div class="border-left border-right border-bottom p-3">
  291. <div v-show="tab==='appointments'" class="appointments-tab">
  292. <div v-show="selectedDate">
  293. <div class="d-flex align-items-baseline mb-3">
  294. <b class="large"><span class="text-secondary">Today:</span> @{{ selectedDate }}</b>
  295. <div v-if="events && events.length" class="d-inline-flex align-items-baseline flex-grow-1">
  296. <label class="my-0 ml-4 mr-1">Pro:</label>
  297. <select v-if="events && events.length" class="form-control form-control-sm max-width-300px" v-model="filterPro">
  298. <option value="">All</option>
  299. <option v-for="(p, uid) in appointmentCountsByPro" :value="uid">@{{ p.name + ' (' + p.appointments + '/' + numEventsForDate + ')' }}</option>
  300. </select>
  301. <div class="ml-auto d-inline-flex align-items-center">
  302. <label class="text-secondary mr-2 my-0 text-nowrap">Filter by status:</label>
  303. <select v-model="filterStatus"
  304. class="form-control form-control-sm">
  305. <option value="">All</option>
  306. <option value="PENDING">Pending</option>
  307. <option value="CONFIRMED">Confirmed</option>
  308. <option value="CANCELLED">Cancelled</option>
  309. <option value="COMPLETED">Completed</option>
  310. </select>
  311. </div>
  312. </div>
  313. </div>
  314. <div v-for="event in events" class="align-items-end p-3 border rounded mb-3"
  315. v-if="!filterPro || filterPro === event.proUid"
  316. :class="(event.dateYMD === selectedDate && (filterStatus === '' || filterStatus === event.status) ? 'd-flex' : 'd-none') + ' ' + (event.isClientShadowOfPro ? 'training-event' : '')">
  317. <div class="patient-avatar mr-3 align-self-center">
  318. <i v-if="event.isClientShadowOfPro" class="fa fa-graduation-cap training-icon"
  319. :title="event.proInitials"></i>
  320. <span v-else class="">@{{ event.proInitials }}</span>
  321. </div>
  322. <div>
  323. <div class="pb-1">
  324. <b class="text-info">@{{ event.proName }}</b>
  325. &nbsp;/&nbsp;
  326. @{{ event.friendlyStartTime }} - @{{ event.friendlyEndTime }} <span
  327. class="text-secondary">@{{ event.timezone }}</span>
  328. &nbsp;/&nbsp;
  329. <span class="d-inline-block ml- 2 text-secondary font-weight-bold">@{{ event.title }}</span>
  330. </div>
  331. <div class="pb-1">
  332. <a :href="'/patients/view/' + event.clientUid" class="font-weight-bold">@{{
  333. event.clientName }}</a>
  334. <span class="small d-inline-block pl-2 text-secondary font-weight-normal">@{{ event.clientSummary }}</span>
  335. </div>
  336. <div class="d-flex align-items-baseline">
  337. <div v-if="event.status === 'PENDING'"
  338. class="text-warning-mellow font-weight-bold">
  339. <i class="fa fa-exclamation-triangle"></i>
  340. Confirmation pending
  341. </div>
  342. <div v-else-if="event.status === 'CONFIRMED'"
  343. class="text-success font-weight-bold">
  344. <i class="fa fa-check"></i>
  345. Confirmed by the patient
  346. </div>
  347. <div v-else class="text-secondary">
  348. Status: <b>@{{ event.status }}</b>
  349. </div>
  350. <span class="mx-2 text-secondary">|</span>
  351. <a :href="'/patients/view/' + event.clientUid + '/calendar/' + event.uid">
  352. <i class="fa fa-edit"></i>
  353. Edit Appointment
  354. </a>
  355. </div>
  356. <div class="mt-1"
  357. :class="event.coverage !== 'YES' ? (event.coverage === 'NO' ? 'text-danger' : 'text-warning-mellow') : 'text-success'">
  358. Coverage Status: <b>@{{ event.coverage }}</b>
  359. </div>
  360. </div>
  361. <div class="ml-auto">
  362. <select v-model="event.newStatus"
  363. class="form-control form-control-sm bg-light"
  364. v-on:change="updateStatus(event)">
  365. <option value="PENDING">PENDING</option>
  366. <option value="CONFIRMED">CONFIRMED</option>
  367. <option value="CANCELLED">CANCELLED</option>
  368. <option value="COMPLETED">COMPLETED</option>
  369. </select>
  370. <div v-if="selectedDate === '{{ date('Y-m-d') }}'"
  371. class="pt-1 text-right"
  372. :class="event.started ? 'text-danger': 'text-secondary'">
  373. @{{ event.inHowManyHours }}
  374. </div>
  375. </div>
  376. </div>
  377. <div v-if="numEventsForDate === 0" class="bg-light p-3 text-secondary border bounded">
  378. <span
  379. v-if="filterStatus === ''">You have no appointments on <b>@{{ selectedDate }}</b></span>
  380. <span
  381. v-if="filterStatus !== ''">You have no appointments on <b>@{{ selectedDate }}</b> with status <b>@{{ filterStatus }}</b></span>
  382. </div>
  383. </div>
  384. <div v-show="!selectedDate" class="bg-light p-3 text-secondary border bounded">
  385. Please select a date from the calendar on the left
  386. </div>
  387. </div>
  388. <div v-show="tab==='rpm'">
  389. <div id="rpm-tab">
  390. <div class="card mb-4">
  391. <div class="card-header pl-2">
  392. <strong>
  393. Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
  394. </strong>
  395. </div>
  396. <div class="card-body p-1">
  397. @include('app.practice-management.remote-monitoring-admin-tree')
  398. </div>
  399. </div>
  400. </div>
  401. </div>
  402. <div v-show="tab==='measurements'">
  403. <div id="measurements-tab">Loading...</div>
  404. </div>
  405. <div v-show="tab==='incoming_reports'">
  406. @include('app.dashboard.incoming_reports')
  407. </div>
  408. <div v-show="tab==='erx'">
  409. @include('app.dashboard.erx')
  410. </div>
  411. <div v-show="tab==='labs'">
  412. @include('app.dashboard.labs')
  413. </div>
  414. <div v-show="tab==='imaging'">
  415. @include('app.dashboard.imaging')
  416. </div>
  417. <div v-show="tab==='supply_orders'">
  418. @include('app.dashboard.supply_orders')
  419. </div>
  420. </div>
  421. <div class="row mt-3">
  422. <div class="col-6">
  423. <div class="mb-3">
  424. <p class="mb-2 font-weight-bold text-secondary">Follow ups scheduled for today</p>
  425. <?php $fus = $pro->followupsScheduledForToday(); ?>
  426. @if(count($fus))
  427. <table class="table table-sm table-striped">
  428. <thead>
  429. <tr>
  430. <th>Client</th>
  431. <th>Assigned To</th>
  432. <th>Reason</th>
  433. <th>Status</th>
  434. </tr>
  435. </thead>
  436. <tbody>
  437. @foreach($fus as $fu)
  438. <tr>
  439. <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
  440. <td>{{$fu->pro_first_name}} {{$fu->pro_last_name}}</td>
  441. <td>{{$fu->next_follow_up_reason}}</td>
  442. <td>{{$fu->status}}</td>
  443. </tr>
  444. @endforeach
  445. </tbody>
  446. </table>
  447. @else
  448. <span class="text-secondary">No follow ups scheduled for today!</span>
  449. @endif
  450. </div>
  451. </div>
  452. <div class="col-6">
  453. @if(request()->input('mcpas'))
  454. @if(count($newMCPAssociations))
  455. <div class="mb-3 border rounded px-3 py-2 ack-container">
  456. <div class="d-flex align-items-baseline pt-1 mb-2">
  457. <p class=""><b>New Patients</b></p>
  458. <a href="/" class="ml-auto">Close</a>
  459. </div>
  460. @foreach($newMCPAssociations as $assoc)
  461. <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
  462. <div class="flex-grow-1">
  463. You are now the MCP for
  464. <a href="/patients/view/{{$assoc->patient->uid}}"
  465. class="">{{$assoc->patient->displayName()}}</a>
  466. <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
  467. @if($nextAppt)
  468. <div class="font-size-11">
  469. <span class="text-secondary font-size-11">Appt.</span>
  470. {{$nextAppt->pro->displayName()}}
  471. <span class="text-secondary font-size-11">on</span>
  472. {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
  473. </div>
  474. @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
  475. <div
  476. class="text-warning-mellow font-weight-bold font-size-11 mt-1">
  477. <i class="fa fa-exclamation-triangle"></i>
  478. Confirmation pending
  479. </div>
  480. @endif
  481. @if($nextAppt->status === 'CONFIRMED')
  482. <div class="text-success font-weight-bold font-size-11 mt-1">
  483. <i class="fa fa-check"></i>
  484. Confirmed by the patient
  485. </div>
  486. @endif
  487. @if($nextAppt->status === 'CANCELLED')
  488. <div class="text-danger font-weight-bold font-size-11 mt-1">
  489. <i class="fa fa-stop"></i>
  490. Cancelled
  491. </div>
  492. @endif
  493. @endif
  494. </div>
  495. <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Ack.</a>
  496. </div>
  497. @endforeach
  498. </div>
  499. @endif
  500. @else
  501. @if(!!$newMCPAssociations)
  502. <a href="/?mcpas=1" class="d-block mb-2">You have <b>{{$newMCPAssociations}}</b> new MCP association{{$newMCPAssociations === 1 ? '' : 's'}}</a>
  503. @endif
  504. @endif
  505. @if(request()->input('naas'))
  506. @if(count($newNAAssociations))
  507. <div class="mb-3 border rounded px-3 py-2 ack-container">
  508. <div class="d-flex align-items-baseline pt-1 mb-2">
  509. <p class=""><b>New Patients</b></p>
  510. <a href="/" class="ml-auto">Close</a>
  511. </div>
  512. @foreach($newNAAssociations as $assoc)
  513. <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
  514. <div class="flex-grow-1">
  515. You are now the Care Coordinator for
  516. <a href="/patients/view/{{$assoc->patient->uid}}"
  517. class="">{{$assoc->patient->displayName()}}</a>
  518. <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
  519. @if($nextAppt)
  520. <div class="font-size-11">
  521. <span class="text-secondary font-size-11">Appt.</span>
  522. {{$nextAppt->pro->displayName()}}
  523. <span class="text-secondary font-size-11">on</span>
  524. {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
  525. </div>
  526. @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
  527. <div
  528. class="text-warning-mellow font-weight-bold font-size-11 mt-1">
  529. <i class="fa fa-exclamation-triangle"></i>
  530. Confirmation pending
  531. </div>
  532. @endif
  533. @if($nextAppt->status === 'CONFIRMED')
  534. <div class="text-success font-weight-bold font-size-11 mt-1">
  535. <i class="fa fa-check"></i>
  536. Confirmed by the patient
  537. </div>
  538. @endif
  539. @if($nextAppt->status === 'CANCELLED')
  540. <div class="text-danger font-weight-bold font-size-11 mt-1">
  541. <i class="fa fa-stop"></i>
  542. Cancelled
  543. </div>
  544. @endif
  545. @endif
  546. </div>
  547. <a href="#" class="ack-client-pro-change"
  548. data-uid="{{$assoc->uid}}">Ack.</a>
  549. </div>
  550. @endforeach
  551. </div>
  552. @endif
  553. @else
  554. @if(!!$newNAAssociations)
  555. <a href="/?naas=1" class="d-block">You have <b>{{$newNAAssociations}}</b> new NA association{{$newNAAssociations === 1 ? '' : 's'}}</a>
  556. @endif
  557. @endif
  558. @if(request()->input('mcpcm'))
  559. @if(count($mcpClientMemos))
  560. <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">
  561. <div class="d-flex align-items-baseline pt-1 mb-2">
  562. <p class=""><b>New Patients Memos (MCP)</b></p>
  563. <a href="/" class="ml-auto">Close</a>
  564. </div>
  565. <table class="table table-sm table-hover table-striped table-bordered">
  566. <thead class="bg-light">
  567. <tr>
  568. <th class="border-bottom-0">Patient</th>
  569. <th class="border-bottom-0">Memo</th>
  570. <th class="border-bottom-0">Created</th>
  571. <th class="border-bottom-0"></th>
  572. </tr>
  573. </thead>
  574. <tbody>
  575. @foreach($mcpClientMemos as $memo)
  576. <tr>
  577. <td class="">
  578. <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
  579. </td>
  580. <td>{!! $memo->content !!}</td>
  581. <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
  582. <td><a href="#" class="ack-client-memo"
  583. data-uid="{{$memo->uid}}">Ack.</a></td>
  584. </tr>
  585. @endforeach
  586. </tbody>
  587. </table>
  588. </div>
  589. @endif
  590. @else
  591. @if($mcpClientMemos[0]->count)
  592. <a href="/?mcpcm=1" class="d-block mb-2">You have <b>{{$mcpClientMemos[0]->count}}</b> new MCP client memo{{$mcpClientMemos[0]->count === 1 ? '' : 's'}}</a>
  593. @endif
  594. @endif
  595. @if(request()->input('nacm'))
  596. @if(count($naClientMemos))
  597. <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">
  598. <div class="d-flex align-items-baseline pt-1 mb-2">
  599. <p class=""><b>New Patients Memos (NA)</b></p>
  600. <a href="/" class="ml-auto">Close</a>
  601. </div>
  602. <table class="table table-sm table-hover table-striped table-bordered">
  603. <thead class="bg-light">
  604. <tr>
  605. <th class="border-bottom-0">Patient</th>
  606. <th class="border-bottom-0">Memo</th>
  607. <th class="border-bottom-0">Created</th>
  608. <th class="border-bottom-0"></th>
  609. </tr>
  610. </thead>
  611. <tbody>
  612. @foreach($naClientMemos as $memo)
  613. <tr>
  614. <td class="">
  615. <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
  616. </td>
  617. <td>{!! $memo->content !!}</td>
  618. <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
  619. <td><a href="#" class="ack-client-memo"
  620. data-uid="{{$memo->uid}}">Ack.</a></td>
  621. </tr>
  622. @endforeach
  623. </tbody>
  624. </table>
  625. </div>
  626. @endif
  627. @else
  628. @if($naClientMemos[0]->count)
  629. <a href="/?nacm=1" class="d-block mb-2">You have <b>{{$naClientMemos[0]->count}}</b> new MCP client memo{{$naClientMemos[0]->count === 1 ? '' : 's'}}</a>
  630. @endif
  631. @endif
  632. </div>
  633. </div>
  634. </div>
  635. </div>
  636. </div>
  637. </div>
  638. <div class="stag-popup stag-popup-md ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
  639. <script>
  640. (function () {
  641. function init() {
  642. window.apapp = new Vue({
  643. el: '#pro-dashboard-container',
  644. delimiters: ['@{{', '}}'],
  645. data: {
  646. tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
  647. datesWithEvents: [],
  648. selectedDate: '{{ date('Y-m-d') }}',
  649. selectedStatus: 'PENDING',
  650. events: [],
  651. numEventsForDate: 0,
  652. filterStatus: '',
  653. calendarElem: null,
  654. currentMonth: null,
  655. currentYear: null,
  656. measurementFilterStatus: 'ALL',
  657. measurements: {!! $pro->pro_type === 'ADMIN' ? '[]' : json_encode($pro->getMeasurements()) !!},
  658. appointmentsLoaded: false,
  659. appointmentCountsByPro: [],
  660. filterPro: '',
  661. },
  662. methods: {
  663. formatDate: function (date) {
  664. let d = new Date(date),
  665. month = '' + (d.getMonth() + 1),
  666. day = '' + d.getDate(),
  667. year = d.getFullYear();
  668. if (month.length < 2)
  669. month = '0' + month;
  670. if (day.length < 2)
  671. day = '0' + day;
  672. return [year, month, day].join('-');
  673. },
  674. onDateChange: function (_newDate) {
  675. let self = this;
  676. window.setTimeout(() => {
  677. // let dayValue = $('.pro-dashboard-inline-calendar td.day.active').first().text();
  678. // if(dayValue.length === 1) dayValue = '0' + dayValue;
  679. // self.selectedDate = _newDate.substr(0, 8) + dayValue;
  680. self.selectedDate = _newDate;
  681. showMask();
  682. self.loadEvents(self.selectedDate, function () {
  683. hideMask();
  684. Vue.nextTick(() => {
  685. // self.highlightDatesWithEvents(self.datesWithEvents);
  686. initFastLoad($('.appointments-tab'));
  687. });
  688. });
  689. }, 25);
  690. },
  691. selectToday: function () {
  692. $('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
  693. $('.pro-dashboard-inline-calendar table td[data-date="{{ $milliseconds }}"]')
  694. .addClass('active');
  695. // this.onDateChange('{{ date('Y-m-d') }}');
  696. },
  697. highlightDatesWithEvents: function (_dates) {
  698. $('.pro-dashboard-inline-calendar table td[data-date]').removeAttr('has-events');
  699. for (let i = 0; i < _dates.length; i++) {
  700. $('.pro-dashboard-inline-calendar table td[data-date="' + _dates[i] + '"]')
  701. .attr('has-events', 1);
  702. }
  703. },
  704. updateStatus: function (_event) {
  705. $.post('/api/appointment/updateStatus', {
  706. uid: _event.uid,
  707. status: _event.newStatus
  708. }, function (_data) {
  709. if (!_data) {
  710. toastr.error('Unable to update appointment status!');
  711. } else {
  712. if (!_data.success) {
  713. toastr.error(_data.message);
  714. } else {
  715. _event.status = _event.newStatus;
  716. toastr.success('The appointment has been updated');
  717. }
  718. }
  719. }, 'json')
  720. },
  721. showEditForm: function (_trigger) {
  722. let form = $(_trigger).closest('[moe]').find('form').first();
  723. showMoeFormMask();
  724. form.show();
  725. setTimeout(function () {
  726. initPrimaryForm(form);
  727. }, 0);
  728. },
  729. submitEditForm: function (_trigger) {
  730. let form = $(_trigger).closest('[moe]').find('form').first();
  731. if (!form[0].checkValidity()) {
  732. form[0].reportValidity();
  733. return;
  734. }
  735. $.post(form.attr('url'), form.serialize(), function (_data) {
  736. if (_data && _data.success) {
  737. fastReload();
  738. } else {
  739. if (_data.message) {
  740. toastr.error(_data.message);
  741. } else {
  742. toastr.error('Unable to update the appointment');
  743. }
  744. }
  745. });
  746. },
  747. cancelEditForm: function (_trigger) {
  748. let form = $(_trigger).closest('[moe]').find('form').first();
  749. hideMoeFormMask();
  750. form.hide();
  751. },
  752. loadEventDates: function (_refDate = false) {
  753. let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
  754. firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
  755. lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  756. this.selectedDate = null;
  757. $('td.day.active').removeClass('active');
  758. $.get('/pro-dashboard-event-dates/' +
  759. this.formatDate(firstOfMonth) + '/' +
  760. this.formatDate(lastOfMonth), (_data) => {
  761. this.datesWithEvents = _data;
  762. console.log(this.datesWithEvents);
  763. this.calendarElem.datepicker('refresh');
  764. // this.highlightDatesWithEvents(this.datesWithEvents);
  765. this.currentMonth = firstOfMonth.getMonth();
  766. this.currentYear = firstOfMonth.getFullYear();
  767. if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
  768. $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
  769. }
  770. this.appointmentsLoaded = true;
  771. }, 'json');
  772. },
  773. loadEvents: function (_date, _callback) {
  774. let self = this;
  775. $.get('/pro-dashboard-events/' + _date + '/' + _date, function (_data) {
  776. self.events = _data;
  777. self.numEventsForDate = (_data && _data.length) ? _data.length : 0;
  778. // fill appointmentCountsByPro
  779. self.appointmentCountsByPro = {};
  780. if(_data && _data.length) {
  781. for (let i = 0; i < _data.length; i++) {
  782. if(!self.appointmentCountsByPro[_data[i].proUid]) {
  783. self.appointmentCountsByPro[_data[i].proUid] = {
  784. name: _data[i].proName,
  785. appointments: 1
  786. };
  787. }
  788. else {
  789. self.appointmentCountsByPro[_data[i].proUid].appointments++;
  790. }
  791. }
  792. }
  793. _callback.call(self);
  794. }, 'json');
  795. },
  796. updateMeasurements: function () {
  797. $.get('/pro-dashboard-measurements/' + this.measurementFilterStatus, (_data) => {
  798. this.measurements = _data;
  799. Vue.nextTick(() => {
  800. // this.initCMRTE();
  801. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  802. initMoes();
  803. });
  804. }, 'json');
  805. },
  806. setMeasurementStatus: function (_uid, _status) {
  807. $.post('/api/measurement/updateStatus', {
  808. uid: _uid,
  809. status: _status
  810. }, (_data) => {
  811. this.updateMeasurements();
  812. }, 'json');
  813. },
  814. initCMRTE: function () {
  815. $('#pro-dashboard-container [cm-rte]').each(function () {
  816. $(this).wrap(
  817. $('<div class="border-left border-right rte-holder"/>')
  818. .attr('data-shortcuts', '')
  819. );
  820. // give a unique id to this editor instance
  821. var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
  822. var el = this;
  823. var existingContent = $(el).attr('data-content');
  824. var quill = new Quill(el, {
  825. theme: 'snow',
  826. modules: stagQuillConfig
  827. });
  828. var toolbar = $(quill.container).prev('.ql-toolbar');
  829. // add button for new shortcut
  830. var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
  831. 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
  832. toolbar.append(newSCButton);
  833. quill.root.innerHTML = existingContent;
  834. $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
  835. quill.on('text-change', function (delta, oldDelta, source) {
  836. $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
  837. });
  838. $(quill.container)
  839. .find('.ql-editor[contenteditable]')
  840. .attr('data-field', fieldName)
  841. .attr('data-editor-id', editorID)
  842. .attr('with-shortcuts', 1);
  843. })
  844. },
  845. initLoadAppointments: function () {
  846. if (this.appointmentsLoaded) return false;
  847. this.loadEventDates();
  848. },
  849. loadMeasurements: function () {
  850. $('#measurements-tab').load('/pro-dashboard-measurements-tab', () => {
  851. initMoes();
  852. initFastLoad($('#measurements-tab'));
  853. });
  854. }
  855. },
  856. mounted: function () {
  857. let self = this;
  858. this.calendarElem = $('.pro-dashboard-inline-calendar');
  859. this.calendarElem.datepicker({
  860. dateFormat: 'yy-mm-dd',
  861. onSelect: function (_date) {
  862. self.onDateChange(_date);
  863. },
  864. onChangeMonthYear: function (_year, _month) {
  865. let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
  866. self.loadEventDates(date);
  867. },
  868. beforeShowDay: function (d) {
  869. if (self.datesWithEvents && self.datesWithEvents.indexOf(self.formatDate(d)) !== -1) {
  870. return [true, 'has-events'];
  871. }
  872. return [true, 'no-events'];
  873. }
  874. });
  875. // this.calendarElem
  876. // .on('changeDate', function () {
  877. // self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
  878. // })
  879. // .on('changeMonth', function () {
  880. // window.setTimeout(function() {
  881. // let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
  882. // if(ts) {
  883. // self.loadEventDates(ts);
  884. // }
  885. // }, 10);
  886. // });
  887. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  888. initMoes();
  889. // init fast load
  890. initFastLoad($('#pro-dashboard-container'));
  891. $(document)
  892. .off('click', '.dashboard-measurements.pagination a.page-link')
  893. .on('click', '.dashboard-measurements.pagination a.page-link', function () {
  894. $('#measurements-tab').text('Loading...').load('/pro-dashboard-measurements-tab/' + $(this).attr('data-target-page'), () => {
  895. initMoes();
  896. initFastLoad($('#measurements-tab'));
  897. });
  898. return false;
  899. });
  900. this.loadMeasurements();
  901. }
  902. });
  903. /*// refresh once ticket popup is closed
  904. $('body').off('stag-popup-closed')
  905. $('body').on('stag-popup-closed', function() {
  906. if($('#pro-dashboard-container').length) {
  907. let activeTab = $('.nav-link.active[data-tab]').attr('data-tab');
  908. if(activeTab) {
  909. fastLoad('/?tab=' + activeTab);
  910. }
  911. }
  912. });*/
  913. // ticket-popup
  914. $(document)
  915. .off('click', '.ticket-popup-trigger')
  916. .on('click', '.ticket-popup-trigger', function () {
  917. showMask();
  918. window.noMc = true;
  919. $.get(this.href, (_data) => {
  920. $('.ticket-popup').html(_data);
  921. showStagPopup('ticket-popup');
  922. $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
  923. runMCInitializer('patient-tickets'); // run specific mc initer
  924. hideMask();
  925. });
  926. return false;
  927. });
  928. $(document)
  929. .off('click', '.ack-client-pro-change')
  930. .on('click', '.ack-client-pro-change', function () {
  931. let trigger = $(this).text('…');
  932. $.post('/api/clientProChange/accept', {
  933. uid: $(this).attr('data-uid')
  934. }, _data => {
  935. if (!hasResponseError(_data)) {
  936. trigger.hide();
  937. let doneElem = $('<i class="text-success fa fa-check"></i>');
  938. doneElem.insertAfter(trigger);
  939. setTimeout(() => {
  940. let ackContainer = trigger.closest('.ack-container');
  941. trigger.closest('div').slideUp('fast', function () {
  942. $(this).remove();
  943. if (!ackContainer.find('>div').length) {
  944. ackContainer.remove();
  945. }
  946. });
  947. }, 500);
  948. }
  949. }, 'json');
  950. return false;
  951. });
  952. $(document)
  953. .off('click', '.ack-client-memo')
  954. .on('click', '.ack-client-memo', function () {
  955. let trigger = $(this).text('…');
  956. $.post('/api/clientMemo/stamp', {
  957. uid: $(this).attr('data-uid')
  958. }, _data => {
  959. if (!hasResponseError(_data)) {
  960. trigger.hide();
  961. let doneElem = $('<i class="text-success fa fa-check"></i>');
  962. doneElem.insertAfter(trigger);
  963. setTimeout(() => {
  964. let tbody = trigger.closest('tbody');
  965. trigger.closest('tr').remove();
  966. if (!tbody.find('>tr').length) {
  967. tbody.closest('.ack-container').remove();
  968. }
  969. }, 500);
  970. }
  971. }, 'json');
  972. return false;
  973. });
  974. $(document)
  975. .off('click', '.ack-pro-appt-update')
  976. .on('click', '.ack-pro-appt-update', function () {
  977. let trigger = $(this).text('…');
  978. $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
  979. uid: $(this).attr('data-uid')
  980. }, _data => {
  981. if (!hasResponseError(_data)) {
  982. trigger.hide();
  983. let doneElem = $('<i class="text-success fa fa-check"></i>');
  984. doneElem.insertAfter(trigger);
  985. setTimeout(() => {
  986. let ackContainer = trigger.closest('tbody');
  987. trigger.closest('tr').slideUp('fast', function () {
  988. $(this).remove();
  989. if (!ackContainer.find('>tr').length) {
  990. ackContainer.remove();
  991. }
  992. });
  993. }, 500);
  994. }
  995. }, 'json');
  996. return false;
  997. });
  998. $(document)
  999. .off('click', '.ack-na-appt-update')
  1000. .on('click', '.ack-na-appt-update', function () {
  1001. let trigger = $(this).text('…');
  1002. $.post('/api/appointmentConfirmationDecision/acknowledgeAsClientDefaultNa', {
  1003. uid: $(this).attr('data-uid')
  1004. }, _data => {
  1005. if (!hasResponseError(_data)) {
  1006. trigger.hide();
  1007. let doneElem = $('<i class="text-success fa fa-check"></i>');
  1008. doneElem.insertAfter(trigger);
  1009. setTimeout(() => {
  1010. let ackContainer = trigger.closest('tbody');
  1011. trigger.closest('tr').slideUp('fast', function () {
  1012. $(this).remove();
  1013. if (!ackContainer.find('>tr').length) {
  1014. ackContainer.remove();
  1015. }
  1016. });
  1017. }, 500);
  1018. }
  1019. }, 'json');
  1020. return false;
  1021. });
  1022. }
  1023. addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
  1024. })();
  1025. </script>
  1026. @endsection