dashboard-mcp.blade.php 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312
  1. @extends ('layouts.template')
  2. @section('content')
  3. <style>
  4. tr.thin th, tr.thin td, .dashboard-stats-table tr td, .dashboard-stats-table tr th {
  5. padding: 0.25em;
  6. font-weight: normal;
  7. }
  8. table.appointments tr td {
  9. vertical-align: middle;
  10. }
  11. </style>
  12. <div class="p-3">
  13. <div class="">
  14. <div class="row mcp-theme-1" id="pro-dashboard-container" v-cloak>
  15. <div class="col-md-3 mcp-theme-1">
  16. <div class="mb-4">
  17. <div class="pro-dashboard-inline-calendar"></div>
  18. </div>
  19. <div class="card mb-4">
  20. <div class="card-header pl-2">
  21. <strong>
  22. Key Numbers
  23. </strong>
  24. </div>
  25. <div class="card-body p-0">
  26. <table class="table table-sm mb-0 dashboard-stats-table">
  27. <tbody>
  28. <tr>
  29. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  30. <th class="pl-2">
  31. <a href="{{ route('mcp.patients') }}">Patients</a>
  32. </th>
  33. </tr>
  34. <tr>
  35. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  36. <th class="pl-2">
  37. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">
  38. New Patients Awaiting Visit
  39. </a>
  40. </th>
  41. </tr>
  42. <tr>
  43. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  44. <th class="pl-2">
  45. <a href="{{ route('mcp.notes_pending_signature') }}">
  46. Notes Pending Signature
  47. </a>
  48. </th>
  49. </tr>
  50. <tr>
  51. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  52. <th class="pl-2">
  53. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending Billing</a>
  54. </th>
  55. </tr>
  56. <tr>
  57. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  58. <th class="pl-2">
  59. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  60. Signature</a>
  61. </th>
  62. </tr>
  63. <tr>
  64. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  65. <th class="pl-2">
  66. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  67. Appointments</a>
  68. </th>
  69. </tr>
  70. <tr>
  71. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  72. <th class="pl-2">
  73. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for Visit</a>
  74. </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">
  79. <a href="{{ route('mcp.cancelled_appointments_pending_review') }}">Cancelled
  80. Appts. Pending Review</a>
  81. </th>
  82. </tr>
  83. <tr>
  84. <th class="px-2 text-center">{{$pro->get_cancelled_bills_awaiting_review_count_as_mcp()}}</th>
  85. <th class="pl-2">
  86. <a href="{{ route('mcp.cancelled_bills_pending_review') }}">Cancelled Bills
  87. Pending Review</a>
  88. </th>
  89. </tr>
  90. <tr>
  91. <th class="px-2 text-center">{{$pro->get_cancelled_supply_orders_awaiting_review_count_as_mcp()}}</th>
  92. <th class="pl-2">
  93. <a href="{{ route('mcp.cancelled_supply_orders_pending_review') }}">Cancelled
  94. Supply Orders Pending Review</a>
  95. </th>
  96. </tr>
  97. <tr>
  98. <th class="px-2 text-center">{{$pro->get_erx_and_orders_awaiting_signature_count_as_mcp()}}</th>
  99. <th class="pl-2">
  100. <a href="{{ route('mcp.erx_and_orders_pending_signature') }}">ERx & Orders
  101. Pending Signature</a>
  102. </th>
  103. </tr>
  104. <tr>
  105. <th class="px-2 text-center">{{$pro->get_supply_orders_awaiting_signature_count_as_mcp()}}</th>
  106. <th class="pl-2">
  107. <a href="{{ route('mcp.supply_orders_pending_signature') }}">Supply Orders
  108. Pending Signature</a>
  109. </th>
  110. </tr>
  111. </tbody>
  112. </table>
  113. </div>
  114. </div>
  115. <div class="card mb-4">
  116. <div class="card-header pl-2">
  117. <strong>
  118. Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
  119. </strong>
  120. </div>
  121. <div class="card-body p-0">
  122. <table class="table mb-0 dashboard-stats-table">
  123. <tbody>
  124. <tr class="thin">
  125. <th class="px-2 text-center">{{$pro->get_measurements_awaiting_review_count_as_mcp() ?? '-'}}</th>
  126. <th class="pl-2">Measurements Pending Review</th>
  127. </tr>
  128. <tr class="thin">
  129. <th class="px-2 text-center">{{$pro->get_patients_without_remote_measurement_in_48_hours_count_as_mcp() ?? '-'}}</th>
  130. <th class="pl-2">Patients w/o Measurement in 48 hrs.</th>
  131. </tr>
  132. </tbody>
  133. </table>
  134. </div>
  135. </div>
  136. <div class="card mb-4">
  137. <div class="card-header pl-2">
  138. <strong>
  139. Practice Management
  140. </strong>
  141. </div>
  142. <div class="card-body p-0">
  143. <table class="table mb-0 dashboard-stats-table">
  144. <tbody>
  145. <tr class="thin">
  146. <th colspan="2" class="font-weight-normal px-2 pl-2">Billing & Reimbursement</th>
  147. </tr>
  148. <tr class="thin">
  149. <th class="font-weight-normal px-2 pl-4">{{friendly_date_time($reimbursement['nextPaymentDate'], false)}}</th>
  150. <th class="font-weight-normal pl-2">Next Payment Date</th>
  151. </tr>
  152. <tr class="thin">
  153. <th class="font-weight-normal px-2 pl-4">
  154. ${{friendly_money($reimbursement['currentBalance'])}}</th>
  155. <th class="font-weight-normal pl-2 w-100"><a
  156. href="/practice-management/financial-transactions">Current balance</a></th>
  157. </tr>
  158. <tr class="thin">
  159. <th class="font-weight-normal px-2 pl-4">
  160. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  161. <th class="font-weight-normal pl-2"><a
  162. href="/practice-management/bills-under-processing">Processing</a></th>
  163. </tr>
  164. <tr class="thin">
  165. <th class="font-weight-normal px-2 pl-5">
  166. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  167. <th class="font-weight-normal pl-2"><a
  168. href="/practice-management/bills-under-processing">Treatment Services</a>
  169. </th>
  170. </tr>
  171. <tr class="thin">
  172. <th class="font-weight-normal px-2 pl-5">
  173. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  174. <th class="font-weight-normal pl-2"><a
  175. href="/practice-management/bills-under-processing">Remote Monitoring</a>
  176. </th>
  177. </tr>
  178. <tr class="thin">
  179. <th class="font-weight-normal px-2 pl-5">
  180. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  181. <th class="font-weight-normal pl-2"><a
  182. href="/practice-management/bills-under-processing">Other Services</a></th>
  183. </tr>
  184. {{--
  185. <tr>
  186. <th class="px-2">{{$reimbursement['lastPayment']}}</th>
  187. <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment</a></th>
  188. </tr>
  189. <tr>
  190. <th class="px-2">{{friendly_date_time($reimbursement['lastPaymentDate'], false)}}</th>
  191. <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment date</a></th>
  192. </tr>
  193. --}}
  194. </tbody>
  195. </table>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="col-md-9">
  200. <div class="row">
  201. <div class="col-6">
  202. <!-- Appointment Updates -->
  203. @if(false && count($proApptUpdates))
  204. <div class="card mb-4 ack-container">
  205. <div class="card-header pl-2">
  206. <strong>
  207. Appointment Updates
  208. </strong>
  209. </div>
  210. <div class="card-body p-0">
  211. <table class="table table-sm mb-0 table-bordered">
  212. <tbody>
  213. <tr>
  214. <th>Client</th>
  215. <th>Appt. Date/Time</th>
  216. <th>Status</th>
  217. <th></th>
  218. </tr>
  219. </thead>
  220. <tbody>
  221. @foreach($proApptUpdates as $update)
  222. <tr>
  223. <td>{{$update->name_first}} {{$update->name_last}}</td>
  224. <td>{{friendlier_date_time($update->start_time)}}</td>
  225. <td>{{$update->status}}</td>
  226. <td>
  227. <a href="#" class="ack-pro-appt-update"
  228. data-uid="{{$update->uid}}">Acknowledge</a>
  229. </td>
  230. </tr>
  231. @endforeach
  232. </tbody>
  233. </table>
  234. </div>
  235. </div>
  236. @endif
  237. <!-- new associations -->
  238. @if(count($newMCPAssociations))
  239. <div class="mb-3 border rounded px-3 py-2 ack-container">
  240. <p class="pt-1 mb-2"><b>New Patients</b></p>
  241. @foreach($newMCPAssociations as $assoc)
  242. <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
  243. <div class="flex-grow-1">
  244. New Patients
  245. <a href="/patients/view/{{$assoc->patient->uid}}"
  246. class="">{{$assoc->patient->displayName()}}</a>
  247. <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
  248. @if($nextAppt)
  249. <div class="font-size-11">
  250. <span class="text-secondary font-size-11">Appt.</span>
  251. {{$nextAppt->pro->displayName()}}
  252. <span class="text-secondary font-size-11">on</span>
  253. {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
  254. </div>
  255. @if($nextAppt->status === 'CREATED')
  256. <div
  257. class="text-warning-mellow font-weight-bold font-size-11 mt-1">
  258. <i class="fa fa-exclamation-triangle"></i>
  259. Confirmation pending
  260. </div>
  261. @endif
  262. @if($nextAppt->status === 'CONFIRMED')
  263. <div class="text-success font-weight-bold font-size-11 mt-1">
  264. <i class="fa fa-check"></i>
  265. Confirmed by the patient
  266. </div>
  267. @endif
  268. @if($nextAppt->status === 'REJECTED')
  269. <div class="text-danger font-weight-bold font-size-11 mt-1">
  270. <i class="fa fa-stop"></i>
  271. Rejected by the patient
  272. </div>
  273. @endif
  274. @endif
  275. </div>
  276. <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Stamp</a>
  277. </div>
  278. @endforeach
  279. </div>
  280. @endif
  281. </div>
  282. </div>
  283. <div class="row mcp-theme-1" id="pro-dashboard-container" v-cloak>
  284. <div class="col-md-6 mcp-theme-1">
  285. <div class="card mb-4">
  286. <div class="card-header pl-2">
  287. <strong>
  288. Appointments @{{ formatDate(selectedDate) }}
  289. </strong>
  290. </div>
  291. <div class="card-body p-0">
  292. <table v-if="events.length > 0" class="table table-sm table-bordered appointments">
  293. <tr v-for="event in events" class="">
  294. <td>
  295. <a :href="'/patients/view/' + event.clientUid" class="font-weight-bold">@{{
  296. event.clientName }}</a>
  297. &nbsp;&nbsp;
  298. {{-- <span class="small d-inline-block text-secondary font-weight-normal"> (@{{ event.clientAge }} y.o. @{{event.clientSex}})</span>--}}
  299. @{{ event.friendlyStartTime }} - @{{ event.friendlyEndTime }} <span
  300. class="text-secondary">@{{ event.timezone }}</span>
  301. <span v-if="event.title"
  302. class="d-inline-block ml- 2 text-secondary font-weight-bold">
  303. &nbsp;/&nbsp;
  304. @{{ event.title }}
  305. </span>
  306. <a :href="'/patients/view/' + event.clientUid + '/calendar/' + event.uid">
  307. <i class="fa fa-edit"></i>
  308. </a>
  309. <div class="d-flex align-items-baseline">
  310. <div v-if="event.status === 'CREATED'"
  311. class="text-warning-mellow font-weight-bold">
  312. <i class="fa fa-exclamation-triangle"></i>
  313. Confirmation pending
  314. </div>
  315. <div v-else-if="event.status === 'CONFIRMED'"
  316. class="text-success font-weight-bold">
  317. <i class="fa fa-check"></i>
  318. Confirmed by the patient
  319. </div>
  320. <div v-else-if="event.status === 'REJECTED'"
  321. class="text-danger font-weight-bold">
  322. <i class="fa fa-stop"></i>
  323. Rejected by the patient
  324. </div>
  325. <div v-else class="text-secondary">
  326. Status: <b>@{{ event.status }}</b>
  327. </div>
  328. </div>
  329. <div>
  330. <div class=""
  331. :class="event.coverage !== 'YES' ? (event.coverage === 'NO' ? 'text-danger' : 'text-warning-mellow') : 'text-success'">
  332. Coverage Status: <b>@{{ event.coverage }}</b>
  333. </div>
  334. </div>
  335. <div class="ml-auto">
  336. <select v-model="event.newStatus"
  337. class="form-control form-control-sm bg-light"
  338. v-on:change="updateStatus(event)">
  339. <option value="CREATED">CREATED</option>
  340. <option value="CONFIRMED">CONFIRMED</option>
  341. <option value="CANCELLED">CANCELLED</option>
  342. <option value="COMPLETED">COMPLETED</option>
  343. <option value="ABANDONED">ABANDONED</option>
  344. </select>
  345. <div v-if="selectedDate === '{{ date('Y-m-d') }}'"
  346. class="pt-1 text-right"
  347. :class="event.started ? 'text-danger': 'text-secondary'">
  348. @{{ event.inHowManyHours }}
  349. </div>
  350. </div>
  351. </td>
  352. </tr>
  353. </table>
  354. <div v-if="numEventsForDate === 0"
  355. class="bg-light p-3 text-secondary border bounded">
  356. <span v-if="filterStatus === ''">You have no appointments on <b>@{{ formatDate(selectedDate) }}</b></span>
  357. <span v-if="filterStatus !== ''">You have no appointments on <b>@{{ formatDate(selectedDate) }}</b> with status <b>@{{ filterStatus }}</b></span>
  358. </div>
  359. <div v-show="!selectedDate" class="bg-light p-3 text-secondary border bounded">
  360. Please select a date from the calendar on the left
  361. </div>
  362. </div>
  363. </div>
  364. <div class="card mb-4">
  365. <div class="card-header pl-2">
  366. <strong>
  367. Measurements
  368. </strong>
  369. </div>
  370. <div class="card-body p-0">
  371. <table class="table table-sm mb-0 dashboard-stats-table">
  372. <tbody>
  373. <tr>
  374. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  375. <th class="pl-2">
  376. <a href="{{ route('mcp.patients') }}">Patients</a>
  377. </th>
  378. </tr>
  379. <tr>
  380. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  381. <th class="pl-2">
  382. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">New Patients
  383. Awaiting
  384. Visit</a>
  385. </th>
  386. </tr>
  387. <tr>
  388. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  389. <th class="pl-2">
  390. <a href="{{ route('mcp.notes_pending_signature') }}">Notes Pending
  391. Signature</a>
  392. </th>
  393. </tr>
  394. <tr>
  395. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  396. <th class="pl-2">
  397. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending
  398. Billing</a>
  399. </th>
  400. </tr>
  401. <tr>
  402. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  403. <th class="pl-2">
  404. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  405. Signature</a>
  406. </th>
  407. </tr>
  408. <tr>
  409. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  410. <th class="pl-2">
  411. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  412. Appointments</a>
  413. </th>
  414. </tr>
  415. <tr>
  416. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  417. <th class="pl-2">
  418. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for
  419. Visit</a>
  420. </th>
  421. </tr>
  422. </tbody>
  423. </table>
  424. </div>
  425. </div>
  426. <div class="card mb-4">
  427. <div class="card-header pl-2">
  428. <strong>
  429. ERx & Orders
  430. </strong>
  431. </div>
  432. <div class="card-body p-0">
  433. <table class="table table-sm mb-0 dashboard-stats-table">
  434. <tbody>
  435. <tr>
  436. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  437. <th class="pl-2">
  438. <a href="{{ route('mcp.patients') }}">Patients</a>
  439. </th>
  440. </tr>
  441. <tr>
  442. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  443. <th class="pl-2">
  444. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">New Patients
  445. Awaiting
  446. Visit</a>
  447. </th>
  448. </tr>
  449. <tr>
  450. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  451. <th class="pl-2">
  452. <a href="{{ route('mcp.notes_pending_signature') }}">Notes Pending
  453. Signature</a>
  454. </th>
  455. </tr>
  456. <tr>
  457. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  458. <th class="pl-2">
  459. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending
  460. Billing</a>
  461. </th>
  462. </tr>
  463. <tr>
  464. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  465. <th class="pl-2">
  466. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  467. Signature</a>
  468. </th>
  469. </tr>
  470. <tr>
  471. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  472. <th class="pl-2">
  473. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  474. Appointments</a>
  475. </th>
  476. </tr>
  477. <tr>
  478. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  479. <th class="pl-2">
  480. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for
  481. Visit</a>
  482. </th>
  483. </tr>
  484. </tbody>
  485. </table>
  486. </div>
  487. </div>
  488. <div class="card mb-4">
  489. <div class="card-header pl-2">
  490. <strong>
  491. Supply Orders
  492. </strong>
  493. </div>
  494. <div class="card-body p-0">
  495. <table class="table table-sm mb-0 dashboard-stats-table">
  496. <tbody>
  497. <tr>
  498. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  499. <th class="pl-2">
  500. <a href="{{ route('mcp.patients') }}">Patients</a>
  501. </th>
  502. </tr>
  503. <tr>
  504. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  505. <th class="pl-2">
  506. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">New Patients
  507. Awaiting
  508. Visit</a>
  509. </th>
  510. </tr>
  511. <tr>
  512. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  513. <th class="pl-2">
  514. <a href="{{ route('mcp.notes_pending_signature') }}">Notes Pending
  515. Signature</a>
  516. </th>
  517. </tr>
  518. <tr>
  519. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  520. <th class="pl-2">
  521. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending
  522. Billing</a>
  523. </th>
  524. </tr>
  525. <tr>
  526. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  527. <th class="pl-2">
  528. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  529. Signature</a>
  530. </th>
  531. </tr>
  532. <tr>
  533. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  534. <th class="pl-2">
  535. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  536. Appointments</a>
  537. </th>
  538. </tr>
  539. <tr>
  540. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  541. <th class="pl-2">
  542. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for
  543. Visit</a>
  544. </th>
  545. </tr>
  546. </tbody>
  547. </table>
  548. </div>
  549. </div>
  550. </div>
  551. <div class="col-md-6 mcp-theme-1">
  552. <div class="card mb-4">
  553. <div class="card-header pl-2">
  554. <strong>
  555. Notifications
  556. </strong>
  557. </div>
  558. <div class="card-body p-0">
  559. <table class="table table-sm mb-0 dashboard-stats-table">
  560. <tbody>
  561. <tr>
  562. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  563. <th class="pl-2">
  564. <a href="{{ route('mcp.patients') }}">Patients</a>
  565. </th>
  566. </tr>
  567. <tr>
  568. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  569. <th class="pl-2">
  570. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">New Patients
  571. Awaiting
  572. Visit</a>
  573. </th>
  574. </tr>
  575. <tr>
  576. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  577. <th class="pl-2">
  578. <a href="{{ route('mcp.notes_pending_signature') }}">Notes Pending
  579. Signature</a>
  580. </th>
  581. </tr>
  582. <tr>
  583. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  584. <th class="pl-2">
  585. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending
  586. Billing</a>
  587. </th>
  588. </tr>
  589. <tr>
  590. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  591. <th class="pl-2">
  592. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  593. Signature</a>
  594. </th>
  595. </tr>
  596. <tr>
  597. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  598. <th class="pl-2">
  599. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  600. Appointments</a>
  601. </th>
  602. </tr>
  603. <tr>
  604. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  605. <th class="pl-2">
  606. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for
  607. Visit</a>
  608. </th>
  609. </tr>
  610. </tbody>
  611. </table>
  612. </div>
  613. </div>
  614. <div class="card mb-4">
  615. <div class="card-header pl-2">
  616. <strong>
  617. Messages
  618. </strong>
  619. </div>
  620. <div class="card-body p-0">
  621. <table class="table table-sm mb-0 dashboard-stats-table">
  622. <tbody>
  623. <tr>
  624. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  625. <th class="pl-2">
  626. <a href="{{ route('mcp.patients') }}">Patients</a>
  627. </th>
  628. </tr>
  629. <tr>
  630. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  631. <th class="pl-2">
  632. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">New Patients
  633. Awaiting
  634. Visit</a>
  635. </th>
  636. </tr>
  637. <tr>
  638. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  639. <th class="pl-2">
  640. <a href="{{ route('mcp.notes_pending_signature') }}">Notes Pending
  641. Signature</a>
  642. </th>
  643. </tr>
  644. <tr>
  645. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  646. <th class="pl-2">
  647. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending
  648. Billing</a>
  649. </th>
  650. </tr>
  651. <tr>
  652. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  653. <th class="pl-2">
  654. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  655. Signature</a>
  656. </th>
  657. </tr>
  658. <tr>
  659. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  660. <th class="pl-2">
  661. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  662. Appointments</a>
  663. </th>
  664. </tr>
  665. <tr>
  666. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  667. <th class="pl-2">
  668. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for
  669. Visit</a>
  670. </th>
  671. </tr>
  672. </tbody>
  673. </table>
  674. </div>
  675. </div>
  676. <div class="card mb-4">
  677. <div class="card-header pl-2">
  678. <strong>
  679. Phone Calls & Memos
  680. </strong>
  681. </div>
  682. <div class="card-body p-0">
  683. <table class="table table-sm mb-0 dashboard-stats-table">
  684. <tbody>
  685. <tr>
  686. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  687. <th class="pl-2">
  688. <a href="{{ route('mcp.patients') }}">Patients</a>
  689. </th>
  690. </tr>
  691. <tr>
  692. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  693. <th class="pl-2">
  694. <a href="{{ route('mcp.new_patients_awaiting_visit') }}">New Patients
  695. Awaiting
  696. Visit</a>
  697. </th>
  698. </tr>
  699. <tr>
  700. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  701. <th class="pl-2">
  702. <a href="{{ route('mcp.notes_pending_signature') }}">Notes Pending
  703. Signature</a>
  704. </th>
  705. </tr>
  706. <tr>
  707. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  708. <th class="pl-2">
  709. <a href="{{ route('mcp.notes_pending_billing') }}">Notes Pending
  710. Billing</a>
  711. </th>
  712. </tr>
  713. <tr>
  714. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  715. <th class="pl-2">
  716. <a href="{{ route('mcp.reports_pending_signature') }}">Reports Pending
  717. Signature</a>
  718. </th>
  719. </tr>
  720. <tr>
  721. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  722. <th class="pl-2">
  723. <a href="{{ route('mcp.patients_without_appointments') }}">Patients w/o
  724. Appointments</a>
  725. </th>
  726. </tr>
  727. <tr>
  728. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  729. <th class="pl-2">
  730. <a href="{{ route('mcp.patients_overdue_for_visit') }}">Patients Overdue for
  731. Visit</a>
  732. </th>
  733. </tr>
  734. </tbody>
  735. </table>
  736. </div>
  737. </div>
  738. </div>
  739. </div>
  740. <div style="">
  741. <ul class="nav nav-tabs">
  742. <li class="nav-item">
  743. <a native data-tab="appointments" class="nav-link"
  744. :class="tab == 'appointments' ? 'active' : ''" href="#"
  745. v-on:click.prevent="tab='appointments'; initLoadAppointments();">
  746. Appointments
  747. </a>
  748. </li>
  749. <li class="nav-item">
  750. <a native data-tab="measurements" class="nav-link"
  751. :class="tab == 'measurements' ? 'active' : ''" href="#"
  752. v-on:click.prevent="tab='measurements'; loadMeasurements();">
  753. Measurements
  754. </a>
  755. </li>
  756. <li class="nav-item">
  757. <a native data-tab="incoming_reports"
  758. class="nav-link {{count($incomingReports) ? 'text-danger font-weight-bold' : ''}}"
  759. :class="tab == 'incoming_reports' ? 'active' : ''" href="#"
  760. v-on:click.prevent="tab='incoming_reports'">
  761. Reports ({{count($incomingReports)}})
  762. </a>
  763. </li>
  764. <li class="nav-item">
  765. <a native data-tab="erx"
  766. class="nav-link {{$numERx ? 'text-danger font-weight-bold' : ''}}"
  767. :class="tab == 'erx' ? 'active' : ''" href="#"
  768. v-on:click.prevent="tab='erx'">
  769. ERx & Orders ({{$numERx}})
  770. </a>
  771. </li>
  772. <li class="nav-item">
  773. <a native data-tab="supply_orders"
  774. class="nav-link {{$numSupplyOrders ? 'text-danger font-weight-bold' : ''}}"
  775. :class="tab == 'supply_orders' ? 'active' : ''" href="#"
  776. v-on:click.prevent="tab='supply_orders'">
  777. Supply Orders ({{$numSupplyOrders}})
  778. </a>
  779. </li>
  780. </ul>
  781. <div class="border-left border-right border-bottom p-3">
  782. <div v-show="tab==='appointments'" class="appointments-tab">
  783. <div v-show="selectedDate">
  784. <div class="d-flex align-items-end mb-3">
  785. <b class="large"><span class="text-secondary"></span>@{{ selectedDate }}</b>
  786. <div class="ml-auto d-inline-flex align-items-center">
  787. <label class="text-secondary mr-2 my-0 text-nowrap">Filter by
  788. status:</label>
  789. <select v-model="filterStatus"
  790. class="form-control form-control-sm">
  791. <option value="">All</option>
  792. <option value="CREATED">Created</option>
  793. <option value="CONFIRMED">Confirmed</option>
  794. <option value="CANCELLED">Cancelled</option>
  795. <option value="COMPLETED">Completed</option>
  796. <option value="ABANDONED">Abandoned</option>
  797. </select>
  798. </div>
  799. </div>
  800. <table class="table table-sm table-bordered appointments">
  801. <tr v-for="event in events" class="">
  802. <td>
  803. <a :href="'/patients/view/' + event.clientUid" class="font-weight-bold">@{{
  804. event.clientName }}</a>
  805. <span class="small d-inline-block text-secondary font-weight-normal"> (@{{ event.clientAge }} y.o. @{{event.clientSex}})</span>
  806. </td>
  807. <td>
  808. @{{ event.friendlyStartTime }} - @{{ event.friendlyEndTime }} <span
  809. class="text-secondary">@{{ event.timezone }}</span>
  810. <span v-if="event.title"
  811. class="d-inline-block ml- 2 text-secondary font-weight-bold">
  812. &nbsp;/&nbsp;
  813. @{{ event.title }}
  814. </span>
  815. <a :href="'/patients/view/' + event.clientUid + '/calendar/' + event.uid">
  816. <i class="fa fa-edit"></i>
  817. Edit
  818. </a>
  819. </td>
  820. <td>
  821. <div class="d-flex align-items-baseline">
  822. <div v-if="event.status === 'CREATED'"
  823. class="text-warning-mellow font-weight-bold">
  824. <i class="fa fa-exclamation-triangle"></i>
  825. Confirmation pending
  826. </div>
  827. <div v-else-if="event.status === 'CONFIRMED'"
  828. class="text-success font-weight-bold">
  829. <i class="fa fa-check"></i>
  830. Confirmed by the patient
  831. </div>
  832. <div v-else-if="event.status === 'REJECTED'"
  833. class="text-danger font-weight-bold">
  834. <i class="fa fa-stop"></i>
  835. Rejected by the patient
  836. </div>
  837. <div v-else class="text-secondary">
  838. Status: <b>@{{ event.status }}</b>
  839. </div>
  840. </div>
  841. </td>
  842. <td>
  843. <div>
  844. <div class="mt-1"
  845. :class="event.coverage !== 'YES' ? (event.coverage === 'NO' ? 'text-danger' : 'text-warning-mellow') : 'text-success'">
  846. Coverage Status: <b>@{{ event.coverage }}</b>
  847. </div>
  848. </div>
  849. </td>
  850. <td>
  851. <div class="ml-auto">
  852. <select v-model="event.newStatus"
  853. class="form-control form-control-sm bg-light"
  854. v-on:change="updateStatus(event)">
  855. <option value="CREATED">CREATED</option>
  856. <option value="CONFIRMED">CONFIRMED</option>
  857. <option value="CANCELLED">CANCELLED</option>
  858. <option value="COMPLETED">COMPLETED</option>
  859. <option value="ABANDONED">ABANDONED</option>
  860. </select>
  861. <div v-if="selectedDate === '{{ date('Y-m-d') }}'"
  862. class="pt-1 text-right"
  863. :class="event.started ? 'text-danger': 'text-secondary'">
  864. @{{ event.inHowManyHours }}
  865. </div>
  866. </div>
  867. </td>
  868. </tr>
  869. </table>
  870. <div v-if="numEventsForDate === 0"
  871. class="bg-light p-3 text-secondary border bounded">
  872. <span v-if="filterStatus === ''">You have no appointments on <b>@{{ selectedDate }}</b></span>
  873. <span v-if="filterStatus !== ''">You have no appointments on <b>@{{ selectedDate }}</b> with status <b>@{{ filterStatus }}</b></span>
  874. </div>
  875. </div>
  876. <div v-show="!selectedDate" class="bg-light p-3 text-secondary border bounded">
  877. Please select a date from the calendar on the left
  878. </div>
  879. </div>
  880. <div v-show="tab==='measurements'">
  881. <div id="measurements-tab">Loading...</div>
  882. </div>
  883. <div v-show="tab==='incoming_reports'">
  884. @include('app.dashboard.incoming_reports')
  885. </div>
  886. <div v-show="tab==='erx'">
  887. @include('app.dashboard.erx')
  888. </div>
  889. </div>
  890. </div>
  891. </div>
  892. </div>
  893. </div>
  894. </div>
  895. <div class="stag-popup stag-popup-md ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
  896. <script>
  897. (function () {
  898. function init() {
  899. window.apapp = new Vue({
  900. el: '#pro-dashboard-container',
  901. delimiters: ['@{{', '}}'],
  902. data: {
  903. tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
  904. datesWithEvents: [],
  905. selectedDate: '{{ date('Y-m-d') }}',
  906. selectedStatus: 'CREATED',
  907. events: [],
  908. numEventsForDate: 0,
  909. filterStatus: '',
  910. calendarElem: null,
  911. currentMonth: null,
  912. currentYear: null,
  913. measurementFilterStatus: 'ALL',
  914. measurements: {!! $pro->pro_type === 'ADMIN' ? '[]' : json_encode($pro->getMeasurements()) !!},
  915. appointmentsLoaded: false,
  916. },
  917. methods: {
  918. formatDate: function (date) {
  919. let d = new Date(date),
  920. month = '' + (d.getMonth() + 1),
  921. day = '' + d.getDate(),
  922. year = d.getFullYear();
  923. if (month.length < 2)
  924. month = '0' + month;
  925. if (day.length < 2)
  926. day = '0' + day;
  927. return [year, month, day].join('-');
  928. },
  929. onDateChange: function (_newDate) {
  930. let self = this;
  931. window.setTimeout(() => {
  932. // let dayValue = $('.pro-dashboard-inline-calendar td.day.active').first().text();
  933. // if(dayValue.length === 1) dayValue = '0' + dayValue;
  934. // self.selectedDate = _newDate.substr(0, 8) + dayValue;
  935. self.selectedDate = _newDate;
  936. showMask();
  937. self.loadEvents(self.selectedDate, function () {
  938. hideMask();
  939. Vue.nextTick(() => {
  940. // self.highlightDatesWithEvents(self.datesWithEvents);
  941. initFastLoad($('.appointments-tab'));
  942. });
  943. });
  944. }, 25);
  945. },
  946. selectToday: function () {
  947. $('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
  948. $('.pro-dashboard-inline-calendar table td[data-date="{{ $milliseconds }}"]')
  949. .addClass('active');
  950. // this.onDateChange('{{ date('Y-m-d') }}');
  951. },
  952. highlightDatesWithEvents: function (_dates) {
  953. $('.pro-dashboard-inline-calendar table td[data-date]').removeAttr('has-events');
  954. for (let i = 0; i < _dates.length; i++) {
  955. $('.pro-dashboard-inline-calendar table td[data-date="' + _dates[i] + '"]')
  956. .attr('has-events', 1);
  957. }
  958. },
  959. updateStatus: function (_event) {
  960. $.post('/api/appointment/updateStatus', {
  961. uid: _event.uid,
  962. status: _event.newStatus
  963. }, function (_data) {
  964. if (!_data) {
  965. toastr.error('Unable to update appointment status!');
  966. } else {
  967. if (!_data.success) {
  968. toastr.error(_data.message);
  969. } else {
  970. _event.status = _event.newStatus;
  971. toastr.success('The appointment has been updated');
  972. }
  973. }
  974. }, 'json')
  975. },
  976. showEditForm: function (_trigger) {
  977. let form = $(_trigger).closest('[moe]').find('form').first();
  978. showMoeFormMask();
  979. form.show();
  980. setTimeout(function () {
  981. initPrimaryForm(form);
  982. }, 0);
  983. },
  984. submitEditForm: function (_trigger) {
  985. let form = $(_trigger).closest('[moe]').find('form').first();
  986. if (!form[0].checkValidity()) {
  987. form[0].reportValidity();
  988. return;
  989. }
  990. $.post(form.attr('url'), form.serialize(), function (_data) {
  991. if (_data && _data.success) {
  992. fastReload();
  993. } else {
  994. if (_data.message) {
  995. toastr.error(_data.message);
  996. } else {
  997. toastr.error('Unable to update the appointment');
  998. }
  999. }
  1000. });
  1001. },
  1002. cancelEditForm: function (_trigger) {
  1003. let form = $(_trigger).closest('[moe]').find('form').first();
  1004. hideMoeFormMask();
  1005. form.hide();
  1006. },
  1007. loadEventDates: function (_refDate = false) {
  1008. let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
  1009. firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
  1010. lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  1011. this.selectedDate = null;
  1012. $('td.day.active').removeClass('active');
  1013. $.get('/pro-dashboard-event-dates/' +
  1014. this.formatDate(firstOfMonth) + '/' +
  1015. this.formatDate(lastOfMonth), (_data) => {
  1016. this.datesWithEvents = _data;
  1017. console.log(this.datesWithEvents);
  1018. this.calendarElem.datepicker('refresh');
  1019. // this.highlightDatesWithEvents(this.datesWithEvents);
  1020. this.currentMonth = firstOfMonth.getMonth();
  1021. this.currentYear = firstOfMonth.getFullYear();
  1022. if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
  1023. $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
  1024. }
  1025. this.appointmentsLoaded = true;
  1026. }, 'json');
  1027. },
  1028. loadEvents: function (_date, _callback) {
  1029. let self = this;
  1030. $.get('/pro-dashboard-events/' + _date + '/' + _date, function (_data) {
  1031. self.events = _data;
  1032. self.numEventsForDate = (_data && _data.length) ? 1 : 0;
  1033. _callback.call(self);
  1034. }, 'json');
  1035. },
  1036. updateMeasurements: function () {
  1037. $.get('/pro-dashboard-measurements/' + this.measurementFilterStatus, (_data) => {
  1038. this.measurements = _data;
  1039. Vue.nextTick(() => {
  1040. // this.initCMRTE();
  1041. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  1042. initMoes();
  1043. });
  1044. }, 'json');
  1045. },
  1046. setMeasurementStatus: function (_uid, _status) {
  1047. $.post('/api/measurement/updateStatus', {
  1048. uid: _uid,
  1049. status: _status
  1050. }, (_data) => {
  1051. this.updateMeasurements();
  1052. }, 'json');
  1053. },
  1054. initCMRTE: function () {
  1055. $('#pro-dashboard-container [cm-rte]').each(function () {
  1056. $(this).wrap(
  1057. $('<div class="border-left border-right rte-holder"/>')
  1058. .attr('data-shortcuts', '')
  1059. );
  1060. // give a unique id to this editor instance
  1061. var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
  1062. var el = this;
  1063. var existingContent = $(el).attr('data-content');
  1064. var quill = new Quill(el, {
  1065. theme: 'snow',
  1066. modules: stagQuillConfig
  1067. });
  1068. var toolbar = $(quill.container).prev('.ql-toolbar');
  1069. // add button for new shortcut
  1070. var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
  1071. 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
  1072. toolbar.append(newSCButton);
  1073. quill.root.innerHTML = existingContent;
  1074. $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
  1075. quill.on('text-change', function (delta, oldDelta, source) {
  1076. $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
  1077. });
  1078. $(quill.container)
  1079. .find('.ql-editor[contenteditable]')
  1080. .attr('data-field', fieldName)
  1081. .attr('data-editor-id', editorID)
  1082. .attr('with-shortcuts', 1);
  1083. })
  1084. },
  1085. initLoadAppointments: function () {
  1086. if (this.appointmentsLoaded) return false;
  1087. this.loadEventDates();
  1088. },
  1089. loadMeasurements: function () {
  1090. $('#measurements-tab').load('/pro-dashboard-measurements-tab', () => {
  1091. initMoes();
  1092. initFastLoad($('#measurements-tab'));
  1093. });
  1094. },
  1095. getFormattedCurrentDate: function() {
  1096. let date = new Date();
  1097. let day = date.getDate();
  1098. day = day < 10 ? '0' + day : day;
  1099. return date.getFullYear()+'-'+parseInt(date.getMonth()+1) +'-' + day;
  1100. },
  1101. formatDate: function(_date, _format) {
  1102. _format = _format || 'MM/DD/YYYY';
  1103. if(_date) {
  1104. return moment(_date).format(_format);
  1105. }
  1106. }
  1107. },
  1108. mounted: function () {
  1109. let self = this;
  1110. this.calendarElem = $('.pro-dashboard-inline-calendar');
  1111. this.calendarElem.datepicker({
  1112. dateFormat: 'yy-mm-dd',
  1113. onSelect: function (_date) {
  1114. self.onDateChange(_date);
  1115. },
  1116. onChangeMonthYear: function (_year, _month) {
  1117. let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
  1118. self.loadEventDates(date);
  1119. },
  1120. beforeShowDay: function (d) {
  1121. if (self.datesWithEvents && self.datesWithEvents.indexOf(self.formatDate(d)) !== -1) {
  1122. return [true, 'has-events'];
  1123. }
  1124. return [true, 'no-events'];
  1125. },
  1126. defaultDate: 0
  1127. });
  1128. // this.calendarElem
  1129. // .on('changeDate', function () {
  1130. // self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
  1131. // })
  1132. // .on('changeMonth', function () {
  1133. // window.setTimeout(function() {
  1134. // let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
  1135. // if(ts) {
  1136. // self.loadEventDates(ts);
  1137. // }
  1138. // }, 10);
  1139. // });
  1140. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  1141. initMoes();
  1142. // init fast load
  1143. initFastLoad($('#pro-dashboard-container'));
  1144. $(document)
  1145. .off('click', '.dashboard-measurements.pagination a.page-link')
  1146. .on('click', '.dashboard-measurements.pagination a.page-link', function () {
  1147. $('#measurements-tab').text('Loading...').load('/pro-dashboard-measurements-tab/' + $(this).attr('data-target-page'), () => {
  1148. initMoes();
  1149. initFastLoad($('#measurements-tab'));
  1150. });
  1151. return false;
  1152. });
  1153. this.loadMeasurements();
  1154. this.initLoadAppointments();
  1155. this.onDateChange(this.getFormattedCurrentDate());
  1156. this.selectedDate = this.getFormattedCurrentDate();
  1157. }
  1158. });
  1159. /*// refresh once ticket popup is closed
  1160. $('body').off('stag-popup-closed')
  1161. $('body').on('stag-popup-closed', function() {
  1162. if($('#pro-dashboard-container').length) {
  1163. let activeTab = $('.nav-link.active[data-tab]').attr('data-tab');
  1164. if(activeTab) {
  1165. fastLoad('/?tab=' + activeTab);
  1166. }
  1167. }
  1168. });*/
  1169. // ticket-popup
  1170. $(document)
  1171. .off('click', '.ticket-popup-trigger')
  1172. .on('click', '.ticket-popup-trigger', function () {
  1173. showMask();
  1174. window.noMc = true;
  1175. $.get(this.href, (_data) => {
  1176. $('.ticket-popup').html(_data);
  1177. showStagPopup('ticket-popup');
  1178. $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
  1179. runMCInitializer('patient-tickets'); // run specific mc initer
  1180. hideMask();
  1181. });
  1182. return false;
  1183. });
  1184. $(document)
  1185. .off('click', '.ack-client-pro-change')
  1186. .on('click', '.ack-client-pro-change', function () {
  1187. let trigger = $(this).text('…');
  1188. $.post('/api/clientProChange/accept', {
  1189. uid: $(this).attr('data-uid')
  1190. }, _data => {
  1191. if (!hasResponseError(_data)) {
  1192. trigger.hide();
  1193. let doneElem = $('<i class="text-success fa fa-check"></i>');
  1194. doneElem.insertAfter(trigger);
  1195. setTimeout(() => {
  1196. let ackContainer = trigger.closest('.ack-container');
  1197. trigger.closest('div').slideUp('fast', function () {
  1198. $(this).remove();
  1199. if (!ackContainer.find('>div').length) {
  1200. ackContainer.remove();
  1201. }
  1202. });
  1203. }, 500);
  1204. }
  1205. }, 'json');
  1206. return false;
  1207. });
  1208. $(document)
  1209. .off('click', '.ack-client-memo')
  1210. .on('click', '.ack-client-memo', function () {
  1211. let trigger = $(this).text('…');
  1212. $.post('/api/clientMemo/stamp', {
  1213. uid: $(this).attr('data-uid')
  1214. }, _data => {
  1215. if (!hasResponseError(_data)) {
  1216. trigger.hide();
  1217. let doneElem = $('<i class="text-success fa fa-check"></i>');
  1218. doneElem.insertAfter(trigger);
  1219. setTimeout(() => {
  1220. let tbody = trigger.closest('tbody');
  1221. trigger.closest('tr').remove();
  1222. if (!tbody.find('>tr').length) {
  1223. tbody.closest('.ack-container').remove();
  1224. }
  1225. }, 500);
  1226. }
  1227. }, 'json');
  1228. return false;
  1229. });
  1230. $(document)
  1231. .off('click', '.ack-pro-appt-update')
  1232. .on('click', '.ack-pro-appt-update', function () {
  1233. let trigger = $(this).text('…');
  1234. $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
  1235. uid: $(this).attr('data-uid')
  1236. }, _data => {
  1237. if (!hasResponseError(_data)) {
  1238. trigger.hide();
  1239. let doneElem = $('<i class="text-success fa fa-check"></i>');
  1240. doneElem.insertAfter(trigger);
  1241. setTimeout(() => {
  1242. let ackContainer = trigger.closest('tbody');
  1243. trigger.closest('tr').slideUp('fast', function () {
  1244. $(this).remove();
  1245. if (!ackContainer.find('>tr').length) {
  1246. ackContainer.remove();
  1247. }
  1248. });
  1249. }, 500);
  1250. }
  1251. }, 'json');
  1252. return false;
  1253. });
  1254. }
  1255. addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
  1256. })();
  1257. </script>
  1258. @endsection