dashboard-admin.blade.php 69 KB

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