dashboard-admin.blade.php 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  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. @if(request()->input('mcpas'))
  424. @if(count($newMCPAssociations))
  425. <div class="mb-3 border rounded px-3 py-2 ack-container">
  426. <div class="d-flex align-items-baseline pt-1 mb-2">
  427. <p class=""><b>New Patients</b></p>
  428. <a href="/" class="ml-auto">Close</a>
  429. </div>
  430. @foreach($newMCPAssociations as $assoc)
  431. <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
  432. <div class="flex-grow-1">
  433. You are now the MCP for
  434. <a href="/patients/view/{{$assoc->patient->uid}}"
  435. class="">{{$assoc->patient->displayName()}}</a>
  436. <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
  437. @if($nextAppt)
  438. <div class="font-size-11">
  439. <span class="text-secondary font-size-11">Appt.</span>
  440. {{$nextAppt->pro->displayName()}}
  441. <span class="text-secondary font-size-11">on</span>
  442. {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
  443. </div>
  444. @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
  445. <div
  446. class="text-warning-mellow font-weight-bold font-size-11 mt-1">
  447. <i class="fa fa-exclamation-triangle"></i>
  448. Confirmation pending
  449. </div>
  450. @endif
  451. @if($nextAppt->status === 'CONFIRMED')
  452. <div class="text-success font-weight-bold font-size-11 mt-1">
  453. <i class="fa fa-check"></i>
  454. Confirmed by the patient
  455. </div>
  456. @endif
  457. @if($nextAppt->status === 'CANCELLED')
  458. <div class="text-danger font-weight-bold font-size-11 mt-1">
  459. <i class="fa fa-stop"></i>
  460. Cancelled
  461. </div>
  462. @endif
  463. @endif
  464. </div>
  465. <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Ack.</a>
  466. </div>
  467. @endforeach
  468. </div>
  469. @endif
  470. @else
  471. @if(!!$newMCPAssociations)
  472. <a href="/?mcpas=1" class="d-block mb-2">You have <b>{{$newMCPAssociations}}</b> new MCP association{{$newMCPAssociations === 1 ? '' : 's'}}</a>
  473. @endif
  474. @endif
  475. @if(request()->input('naas'))
  476. @if(count($newNAAssociations))
  477. <div class="mb-3 border rounded px-3 py-2 ack-container">
  478. <div class="d-flex align-items-baseline pt-1 mb-2">
  479. <p class=""><b>New Patients</b></p>
  480. <a href="/" class="ml-auto">Close</a>
  481. </div>
  482. @foreach($newNAAssociations as $assoc)
  483. <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
  484. <div class="flex-grow-1">
  485. You are now the Care Coordinator for
  486. <a href="/patients/view/{{$assoc->patient->uid}}"
  487. class="">{{$assoc->patient->displayName()}}</a>
  488. <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
  489. @if($nextAppt)
  490. <div class="font-size-11">
  491. <span class="text-secondary font-size-11">Appt.</span>
  492. {{$nextAppt->pro->displayName()}}
  493. <span class="text-secondary font-size-11">on</span>
  494. {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
  495. </div>
  496. @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
  497. <div
  498. class="text-warning-mellow font-weight-bold font-size-11 mt-1">
  499. <i class="fa fa-exclamation-triangle"></i>
  500. Confirmation pending
  501. </div>
  502. @endif
  503. @if($nextAppt->status === 'CONFIRMED')
  504. <div class="text-success font-weight-bold font-size-11 mt-1">
  505. <i class="fa fa-check"></i>
  506. Confirmed by the patient
  507. </div>
  508. @endif
  509. @if($nextAppt->status === 'CANCELLED')
  510. <div class="text-danger font-weight-bold font-size-11 mt-1">
  511. <i class="fa fa-stop"></i>
  512. Cancelled
  513. </div>
  514. @endif
  515. @endif
  516. </div>
  517. <a href="#" class="ack-client-pro-change"
  518. data-uid="{{$assoc->uid}}">Ack.</a>
  519. </div>
  520. @endforeach
  521. </div>
  522. @endif
  523. @else
  524. @if(!!$newNAAssociations)
  525. <a href="/?naas=1" class="d-block">You have <b>{{$newNAAssociations}}</b> new NA association{{$newNAAssociations === 1 ? '' : 's'}}</a>
  526. @endif
  527. @endif
  528. </div>
  529. <div class="col-6">
  530. @if(request()->input('mcpcm'))
  531. @if(count($mcpClientMemos))
  532. <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">
  533. <div class="d-flex align-items-baseline pt-1 mb-2">
  534. <p class=""><b>New Patients Memos (MCP)</b></p>
  535. <a href="/" class="ml-auto">Close</a>
  536. </div>
  537. <table class="table table-sm table-hover table-striped table-bordered">
  538. <thead class="bg-light">
  539. <tr>
  540. <th class="border-bottom-0">Patient</th>
  541. <th class="border-bottom-0">Memo</th>
  542. <th class="border-bottom-0">Created</th>
  543. <th class="border-bottom-0"></th>
  544. </tr>
  545. </thead>
  546. <tbody>
  547. @foreach($mcpClientMemos as $memo)
  548. <tr>
  549. <td class="">
  550. <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
  551. </td>
  552. <td>{!! $memo->content !!}</td>
  553. <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
  554. <td><a href="#" class="ack-client-memo"
  555. data-uid="{{$memo->uid}}">Ack.</a></td>
  556. </tr>
  557. @endforeach
  558. </tbody>
  559. </table>
  560. </div>
  561. @endif
  562. @else
  563. @if($mcpClientMemos[0]->count)
  564. <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>
  565. @endif
  566. @endif
  567. @if(request()->input('nacm'))
  568. @if(count($naClientMemos))
  569. <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">
  570. <div class="d-flex align-items-baseline pt-1 mb-2">
  571. <p class=""><b>New Patients Memos (NA)</b></p>
  572. <a href="/" class="ml-auto">Close</a>
  573. </div>
  574. <table class="table table-sm table-hover table-striped table-bordered">
  575. <thead class="bg-light">
  576. <tr>
  577. <th class="border-bottom-0">Patient</th>
  578. <th class="border-bottom-0">Memo</th>
  579. <th class="border-bottom-0">Created</th>
  580. <th class="border-bottom-0"></th>
  581. </tr>
  582. </thead>
  583. <tbody>
  584. @foreach($naClientMemos as $memo)
  585. <tr>
  586. <td class="">
  587. <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
  588. </td>
  589. <td>{!! $memo->content !!}</td>
  590. <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
  591. <td><a href="#" class="ack-client-memo"
  592. data-uid="{{$memo->uid}}">Ack.</a></td>
  593. </tr>
  594. @endforeach
  595. </tbody>
  596. </table>
  597. </div>
  598. @endif
  599. @else
  600. @if($naClientMemos[0]->count)
  601. <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>
  602. @endif
  603. @endif
  604. </div>
  605. </div>
  606. </div>
  607. </div>
  608. </div>
  609. </div>
  610. <div class="stag-popup stag-popup-md ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
  611. <script>
  612. (function () {
  613. function init() {
  614. window.apapp = new Vue({
  615. el: '#pro-dashboard-container',
  616. delimiters: ['@{{', '}}'],
  617. data: {
  618. tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
  619. datesWithEvents: [],
  620. selectedDate: '{{ date('Y-m-d') }}',
  621. selectedStatus: 'PENDING',
  622. events: [],
  623. numEventsForDate: 0,
  624. filterStatus: '',
  625. calendarElem: null,
  626. currentMonth: null,
  627. currentYear: null,
  628. measurementFilterStatus: 'ALL',
  629. measurements: {!! $pro->pro_type === 'ADMIN' ? '[]' : json_encode($pro->getMeasurements()) !!},
  630. appointmentsLoaded: false,
  631. appointmentCountsByPro: [],
  632. filterPro: '',
  633. },
  634. methods: {
  635. formatDate: function (date) {
  636. let d = new Date(date),
  637. month = '' + (d.getMonth() + 1),
  638. day = '' + d.getDate(),
  639. year = d.getFullYear();
  640. if (month.length < 2)
  641. month = '0' + month;
  642. if (day.length < 2)
  643. day = '0' + day;
  644. return [year, month, day].join('-');
  645. },
  646. onDateChange: function (_newDate) {
  647. let self = this;
  648. window.setTimeout(() => {
  649. // let dayValue = $('.pro-dashboard-inline-calendar td.day.active').first().text();
  650. // if(dayValue.length === 1) dayValue = '0' + dayValue;
  651. // self.selectedDate = _newDate.substr(0, 8) + dayValue;
  652. self.selectedDate = _newDate;
  653. showMask();
  654. self.loadEvents(self.selectedDate, function () {
  655. hideMask();
  656. Vue.nextTick(() => {
  657. // self.highlightDatesWithEvents(self.datesWithEvents);
  658. initFastLoad($('.appointments-tab'));
  659. });
  660. });
  661. }, 25);
  662. },
  663. selectToday: function () {
  664. $('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
  665. $('.pro-dashboard-inline-calendar table td[data-date="{{ $milliseconds }}"]')
  666. .addClass('active');
  667. // this.onDateChange('{{ date('Y-m-d') }}');
  668. },
  669. highlightDatesWithEvents: function (_dates) {
  670. $('.pro-dashboard-inline-calendar table td[data-date]').removeAttr('has-events');
  671. for (let i = 0; i < _dates.length; i++) {
  672. $('.pro-dashboard-inline-calendar table td[data-date="' + _dates[i] + '"]')
  673. .attr('has-events', 1);
  674. }
  675. },
  676. updateStatus: function (_event) {
  677. $.post('/api/appointment/updateStatus', {
  678. uid: _event.uid,
  679. status: _event.newStatus
  680. }, function (_data) {
  681. if (!_data) {
  682. toastr.error('Unable to update appointment status!');
  683. } else {
  684. if (!_data.success) {
  685. toastr.error(_data.message);
  686. } else {
  687. _event.status = _event.newStatus;
  688. toastr.success('The appointment has been updated');
  689. }
  690. }
  691. }, 'json')
  692. },
  693. showEditForm: function (_trigger) {
  694. let form = $(_trigger).closest('[moe]').find('form').first();
  695. showMoeFormMask();
  696. form.show();
  697. setTimeout(function () {
  698. initPrimaryForm(form);
  699. }, 0);
  700. },
  701. submitEditForm: function (_trigger) {
  702. let form = $(_trigger).closest('[moe]').find('form').first();
  703. if (!form[0].checkValidity()) {
  704. form[0].reportValidity();
  705. return;
  706. }
  707. $.post(form.attr('url'), form.serialize(), function (_data) {
  708. if (_data && _data.success) {
  709. fastReload();
  710. } else {
  711. if (_data.message) {
  712. toastr.error(_data.message);
  713. } else {
  714. toastr.error('Unable to update the appointment');
  715. }
  716. }
  717. });
  718. },
  719. cancelEditForm: function (_trigger) {
  720. let form = $(_trigger).closest('[moe]').find('form').first();
  721. hideMoeFormMask();
  722. form.hide();
  723. },
  724. loadEventDates: function (_refDate = false) {
  725. let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
  726. firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
  727. lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  728. this.selectedDate = null;
  729. $('td.day.active').removeClass('active');
  730. $.get('/pro-dashboard-event-dates/' +
  731. this.formatDate(firstOfMonth) + '/' +
  732. this.formatDate(lastOfMonth), (_data) => {
  733. this.datesWithEvents = _data;
  734. console.log(this.datesWithEvents);
  735. this.calendarElem.datepicker('refresh');
  736. // this.highlightDatesWithEvents(this.datesWithEvents);
  737. this.currentMonth = firstOfMonth.getMonth();
  738. this.currentYear = firstOfMonth.getFullYear();
  739. if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
  740. $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
  741. }
  742. this.appointmentsLoaded = true;
  743. }, 'json');
  744. },
  745. loadEvents: function (_date, _callback) {
  746. let self = this;
  747. $.get('/pro-dashboard-events/' + _date + '/' + _date, function (_data) {
  748. self.events = _data;
  749. self.numEventsForDate = (_data && _data.length) ? _data.length : 0;
  750. // fill appointmentCountsByPro
  751. self.appointmentCountsByPro = {};
  752. if(_data && _data.length) {
  753. for (let i = 0; i < _data.length; i++) {
  754. if(!self.appointmentCountsByPro[_data[i].proUid]) {
  755. self.appointmentCountsByPro[_data[i].proUid] = {
  756. name: _data[i].proName,
  757. appointments: 1
  758. };
  759. }
  760. else {
  761. self.appointmentCountsByPro[_data[i].proUid].appointments++;
  762. }
  763. }
  764. }
  765. _callback.call(self);
  766. }, 'json');
  767. },
  768. updateMeasurements: function () {
  769. $.get('/pro-dashboard-measurements/' + this.measurementFilterStatus, (_data) => {
  770. this.measurements = _data;
  771. Vue.nextTick(() => {
  772. // this.initCMRTE();
  773. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  774. initMoes();
  775. });
  776. }, 'json');
  777. },
  778. setMeasurementStatus: function (_uid, _status) {
  779. $.post('/api/measurement/updateStatus', {
  780. uid: _uid,
  781. status: _status
  782. }, (_data) => {
  783. this.updateMeasurements();
  784. }, 'json');
  785. },
  786. initCMRTE: function () {
  787. $('#pro-dashboard-container [cm-rte]').each(function () {
  788. $(this).wrap(
  789. $('<div class="border-left border-right rte-holder"/>')
  790. .attr('data-shortcuts', '')
  791. );
  792. // give a unique id to this editor instance
  793. var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
  794. var el = this;
  795. var existingContent = $(el).attr('data-content');
  796. var quill = new Quill(el, {
  797. theme: 'snow',
  798. modules: stagQuillConfig
  799. });
  800. var toolbar = $(quill.container).prev('.ql-toolbar');
  801. // add button for new shortcut
  802. var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
  803. 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
  804. toolbar.append(newSCButton);
  805. quill.root.innerHTML = existingContent;
  806. $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
  807. quill.on('text-change', function (delta, oldDelta, source) {
  808. $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
  809. });
  810. $(quill.container)
  811. .find('.ql-editor[contenteditable]')
  812. .attr('data-field', fieldName)
  813. .attr('data-editor-id', editorID)
  814. .attr('with-shortcuts', 1);
  815. })
  816. },
  817. initLoadAppointments: function () {
  818. if (this.appointmentsLoaded) return false;
  819. this.loadEventDates();
  820. },
  821. loadMeasurements: function () {
  822. $('#measurements-tab').load('/pro-dashboard-measurements-tab', () => {
  823. initMoes();
  824. initFastLoad($('#measurements-tab'));
  825. });
  826. }
  827. },
  828. mounted: function () {
  829. let self = this;
  830. this.calendarElem = $('.pro-dashboard-inline-calendar');
  831. this.calendarElem.datepicker({
  832. dateFormat: 'yy-mm-dd',
  833. onSelect: function (_date) {
  834. self.onDateChange(_date);
  835. },
  836. onChangeMonthYear: function (_year, _month) {
  837. let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
  838. self.loadEventDates(date);
  839. },
  840. beforeShowDay: function (d) {
  841. if (self.datesWithEvents && self.datesWithEvents.indexOf(self.formatDate(d)) !== -1) {
  842. return [true, 'has-events'];
  843. }
  844. return [true, 'no-events'];
  845. }
  846. });
  847. // this.calendarElem
  848. // .on('changeDate', function () {
  849. // self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
  850. // })
  851. // .on('changeMonth', function () {
  852. // window.setTimeout(function() {
  853. // let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
  854. // if(ts) {
  855. // self.loadEventDates(ts);
  856. // }
  857. // }, 10);
  858. // });
  859. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  860. initMoes();
  861. // init fast load
  862. initFastLoad($('#pro-dashboard-container'));
  863. $(document)
  864. .off('click', '.dashboard-measurements.pagination a.page-link')
  865. .on('click', '.dashboard-measurements.pagination a.page-link', function () {
  866. $('#measurements-tab').text('Loading...').load('/pro-dashboard-measurements-tab/' + $(this).attr('data-target-page'), () => {
  867. initMoes();
  868. initFastLoad($('#measurements-tab'));
  869. });
  870. return false;
  871. });
  872. this.loadMeasurements();
  873. }
  874. });
  875. /*// refresh once ticket popup is closed
  876. $('body').off('stag-popup-closed')
  877. $('body').on('stag-popup-closed', function() {
  878. if($('#pro-dashboard-container').length) {
  879. let activeTab = $('.nav-link.active[data-tab]').attr('data-tab');
  880. if(activeTab) {
  881. fastLoad('/?tab=' + activeTab);
  882. }
  883. }
  884. });*/
  885. // ticket-popup
  886. $(document)
  887. .off('click', '.ticket-popup-trigger')
  888. .on('click', '.ticket-popup-trigger', function () {
  889. showMask();
  890. window.noMc = true;
  891. $.get(this.href, (_data) => {
  892. $('.ticket-popup').html(_data);
  893. showStagPopup('ticket-popup');
  894. $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
  895. runMCInitializer('patient-tickets'); // run specific mc initer
  896. hideMask();
  897. });
  898. return false;
  899. });
  900. $(document)
  901. .off('click', '.ack-client-pro-change')
  902. .on('click', '.ack-client-pro-change', function () {
  903. let trigger = $(this).text('…');
  904. $.post('/api/clientProChange/accept', {
  905. uid: $(this).attr('data-uid')
  906. }, _data => {
  907. if (!hasResponseError(_data)) {
  908. trigger.hide();
  909. let doneElem = $('<i class="text-success fa fa-check"></i>');
  910. doneElem.insertAfter(trigger);
  911. setTimeout(() => {
  912. let ackContainer = trigger.closest('.ack-container');
  913. trigger.closest('div').slideUp('fast', function () {
  914. $(this).remove();
  915. if (!ackContainer.find('>div').length) {
  916. ackContainer.remove();
  917. }
  918. });
  919. }, 500);
  920. }
  921. }, 'json');
  922. return false;
  923. });
  924. $(document)
  925. .off('click', '.ack-client-memo')
  926. .on('click', '.ack-client-memo', function () {
  927. let trigger = $(this).text('…');
  928. $.post('/api/clientMemo/stamp', {
  929. uid: $(this).attr('data-uid')
  930. }, _data => {
  931. if (!hasResponseError(_data)) {
  932. trigger.hide();
  933. let doneElem = $('<i class="text-success fa fa-check"></i>');
  934. doneElem.insertAfter(trigger);
  935. setTimeout(() => {
  936. let tbody = trigger.closest('tbody');
  937. trigger.closest('tr').remove();
  938. if (!tbody.find('>tr').length) {
  939. tbody.closest('.ack-container').remove();
  940. }
  941. }, 500);
  942. }
  943. }, 'json');
  944. return false;
  945. });
  946. $(document)
  947. .off('click', '.ack-pro-appt-update')
  948. .on('click', '.ack-pro-appt-update', function () {
  949. let trigger = $(this).text('…');
  950. $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
  951. uid: $(this).attr('data-uid')
  952. }, _data => {
  953. if (!hasResponseError(_data)) {
  954. trigger.hide();
  955. let doneElem = $('<i class="text-success fa fa-check"></i>');
  956. doneElem.insertAfter(trigger);
  957. setTimeout(() => {
  958. let ackContainer = trigger.closest('tbody');
  959. trigger.closest('tr').slideUp('fast', function () {
  960. $(this).remove();
  961. if (!ackContainer.find('>tr').length) {
  962. ackContainer.remove();
  963. }
  964. });
  965. }, 500);
  966. }
  967. }, 'json');
  968. return false;
  969. });
  970. $(document)
  971. .off('click', '.ack-na-appt-update')
  972. .on('click', '.ack-na-appt-update', function () {
  973. let trigger = $(this).text('…');
  974. $.post('/api/appointmentConfirmationDecision/acknowledgeAsClientDefaultNa', {
  975. uid: $(this).attr('data-uid')
  976. }, _data => {
  977. if (!hasResponseError(_data)) {
  978. trigger.hide();
  979. let doneElem = $('<i class="text-success fa fa-check"></i>');
  980. doneElem.insertAfter(trigger);
  981. setTimeout(() => {
  982. let ackContainer = trigger.closest('tbody');
  983. trigger.closest('tr').slideUp('fast', function () {
  984. $(this).remove();
  985. if (!ackContainer.find('>tr').length) {
  986. ackContainer.remove();
  987. }
  988. });
  989. }, 500);
  990. }
  991. }, 'json');
  992. return false;
  993. });
  994. }
  995. addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
  996. })();
  997. </script>
  998. @endsection