dashboard-admin.blade.php 62 KB

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