dashboard-admin.blade.php 65 KB

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