dashboard-mcp.blade.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. @extends ('layouts.template')
  2. @section('content')
  3. <style>
  4. #dashboard-mcp tr.thin th,
  5. #dashboard-mcp tr.thin td,
  6. #dashboard-mcp .dashboard-stats-table tr td,
  7. #dashboard-mcp .dashboard-stats-table tr th {
  8. padding: 0.25em;
  9. font-weight: normal;
  10. }
  11. #dashboard-mcp table.appointments tr td {
  12. vertical-align: middle;
  13. }
  14. </style>
  15. <div id="dashboard-mcp">
  16. <div class="p-3">
  17. <div class="">
  18. <div class="row mcp-theme-1" id="pro-dashboard-container" v-cloak>
  19. <div class="col-md-3 mcp-theme-1">
  20. <div class="mb-4">
  21. <div class="pro-dashboard-inline-calendar"></div>
  22. </div>
  23. <div class="card mb-4">
  24. <div class="card-header pl-2">
  25. <strong>
  26. Key Numbers
  27. </strong>
  28. </div>
  29. <div class="card-body p-0">
  30. <table class="table table-sm mb-0 dashboard-stats-table">
  31. <tbody>
  32. <tr>
  33. <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
  34. <th class="pl-2">
  35. <a href="{{ route('mcp.patients') }}">Patients</a>
  36. </th>
  37. </tr>
  38. <tr>
  39. <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
  40. <th class="pl-2">
  41. <a href="{{ route('mcp.new_patients_awaiting_visit') }}"
  42. native target="_blank"
  43. open-in-stag-popup
  44. popup-style="tall"
  45. title="New Patients Awaiting Visit">
  46. New Patients Awaiting Visit
  47. </a>
  48. </th>
  49. </tr>
  50. <tr>
  51. <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
  52. <th class="pl-2">
  53. <a href="{{ route('mcp.notes_pending_signature') }}"
  54. native target="_blank"
  55. open-in-stag-popup
  56. popup-style="tall"
  57. title="Notes Pending Signature">
  58. Notes Pending Signature
  59. </a>
  60. </th>
  61. </tr>
  62. <tr>
  63. <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
  64. <th class="pl-2">
  65. <a href="{{ route('mcp.notes_pending_billing') }}"
  66. native target="_blank"
  67. open-in-stag-popup
  68. popup-style="tall"
  69. title="Notes Pending Billing">
  70. Notes Pending Billing
  71. </a>
  72. </th>
  73. </tr>
  74. <tr>
  75. <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
  76. <th class="pl-2">
  77. <a href="{{ route('mcp.reports_pending_signature') }}"
  78. native target="_blank"
  79. open-in-stag-popup
  80. popup-style="tall"
  81. title="Reports Pending Signature">
  82. Reports Pending Signature
  83. </a>
  84. </th>
  85. </tr>
  86. <tr>
  87. <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
  88. <th class="pl-2">
  89. <a href="{{ route('mcp.patients_without_appointments') }}"
  90. native target="_blank"
  91. open-in-stag-popup
  92. popup-style="tall"
  93. title="Patients w/o Appointments">
  94. Patients w/o Appointments
  95. </a>
  96. </th>
  97. </tr>
  98. <tr>
  99. <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
  100. <th class="pl-2">
  101. <a href="{{ route('mcp.patients_overdue_for_visit') }}"
  102. native target="_blank"
  103. open-in-stag-popup
  104. popup-style="tall"
  105. title="Patients Overdue for Visit">
  106. Patients Overdue for Visit
  107. </a>
  108. </th>
  109. </tr>
  110. <tr>
  111. <th class="px-2 text-center">{{$pro->get_cancelled_appointments_pending_acknowledgement_count_as_mcp()}}</th>
  112. <th class="pl-2">
  113. <a href="{{ route('mcp.cancelled_appointments_pending_review') }}"
  114. native target="_blank"
  115. open-in-stag-popup
  116. popup-style="tall"
  117. title="Cancelled Appts. Pending Review">
  118. Cancelled Appts. Pending Review
  119. </a>
  120. </th>
  121. </tr>
  122. <tr>
  123. <th class="px-2 text-center">{{$pro->get_cancelled_bills_awaiting_review_count_as_mcp()}}</th>
  124. <th class="pl-2">
  125. <a href="{{ route('mcp.cancelled_bills_pending_review') }}"
  126. native target="_blank"
  127. open-in-stag-popup
  128. popup-style="tall"
  129. title="Cancelled Bills Pending Review">
  130. Cancelled Bills Pending Review
  131. </a>
  132. </th>
  133. </tr>
  134. <tr>
  135. <th class="px-2 text-center">{{$pro->get_cancelled_supply_orders_awaiting_review_count_as_mcp()}}</th>
  136. <th class="pl-2">
  137. <a href="{{ route('mcp.cancelled_supply_orders_pending_review') }}"
  138. native target="_blank"
  139. open-in-stag-popup
  140. popup-style="tall"
  141. title="Cancelled Supply Orders Pending Review">
  142. Cancelled Supply Orders Pending Review
  143. </a>
  144. </th>
  145. </tr>
  146. <tr>
  147. <th class="px-2 text-center">{{$pro->get_erx_and_orders_awaiting_signature_count_as_mcp()}}</th>
  148. <th class="pl-2">
  149. <a href="{{ route('mcp.erx_and_orders_pending_signature') }}"
  150. native target="_blank"
  151. open-in-stag-popup
  152. popup-style="tall"
  153. title="ERx & Orders Pending Signature">
  154. ERx & Orders Pending Signature
  155. </a>
  156. </th>
  157. </tr>
  158. <tr>
  159. <th class="px-2 text-center">{{$pro->get_supply_orders_awaiting_signature_count_as_mcp()}}</th>
  160. <th class="pl-2">
  161. <a href="{{ route('mcp.supply_orders_pending_signature') }}"
  162. native target="_blank"
  163. open-in-stag-popup
  164. popup-style="tall"
  165. title="Supply Orders Pending Signature">
  166. Supply Orders Pending Signature
  167. </a>
  168. </th>
  169. </tr>
  170. </tbody>
  171. </table>
  172. </div>
  173. </div>
  174. <div class="card mb-4">
  175. <div class="card-header pl-2">
  176. <strong>
  177. Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
  178. </strong>
  179. </div>
  180. <div class="card-body p-0">
  181. <table class="table mb-0 dashboard-stats-table">
  182. <tbody>
  183. <tr class="thin">
  184. <th class="px-2 text-center">{{$pro->get_measurements_awaiting_review_count_as_mcp() ?? '-'}}</th>
  185. <th class="pl-2">Measurements Pending Review</th>
  186. </tr>
  187. <tr class="thin">
  188. <th class="px-2 text-center">{{$pro->get_patients_without_remote_measurement_in_48_hours_count_as_mcp() ?? '-'}}</th>
  189. <th class="pl-2">Patients w/o Measurement in 48 hrs.</th>
  190. </tr>
  191. </tbody>
  192. </table>
  193. </div>
  194. </div>
  195. <div class="card mb-4">
  196. <div class="card-header pl-2">
  197. <strong>
  198. Practice Management
  199. </strong>
  200. </div>
  201. <div class="card-body p-0">
  202. <table class="table mb-0 dashboard-stats-table">
  203. <tbody>
  204. <tr class="thin">
  205. <th colspan="2" class="font-weight-normal px-2 pl-2">Billing & Reimbursement</th>
  206. </tr>
  207. <tr class="thin">
  208. <th class="font-weight-normal px-2 pl-4">{{friendly_date_time($reimbursement['nextPaymentDate'], false)}}</th>
  209. <th class="font-weight-normal pl-2">Next Payment Date</th>
  210. </tr>
  211. <tr class="thin">
  212. <th class="font-weight-normal px-2 pl-4">
  213. ${{friendly_money($reimbursement['currentBalance'])}}</th>
  214. <th class="font-weight-normal pl-2 w-100"><a
  215. href="/practice-management/financial-transactions">Current balance</a></th>
  216. </tr>
  217. <tr class="thin">
  218. <th class="font-weight-normal px-2 pl-4">
  219. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  220. <th class="font-weight-normal pl-2"><a
  221. href="/practice-management/bills-under-processing">Processing</a></th>
  222. </tr>
  223. <tr class="thin">
  224. <th class="font-weight-normal px-2 pl-5">
  225. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  226. <th class="font-weight-normal pl-2"><a
  227. href="/practice-management/bills-under-processing">Treatment Services</a>
  228. </th>
  229. </tr>
  230. <tr class="thin">
  231. <th class="font-weight-normal px-2 pl-5">
  232. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  233. <th class="font-weight-normal pl-2"><a
  234. href="/practice-management/bills-under-processing">Remote Monitoring</a>
  235. </th>
  236. </tr>
  237. <tr class="thin">
  238. <th class="font-weight-normal px-2 pl-5">
  239. ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
  240. <th class="font-weight-normal pl-2"><a
  241. href="/practice-management/bills-under-processing">Other Services</a></th>
  242. </tr>
  243. {{--
  244. <tr>
  245. <th class="px-2">{{$reimbursement['lastPayment']}}</th>
  246. <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment</a></th>
  247. </tr>
  248. <tr>
  249. <th class="px-2">{{friendly_date_time($reimbursement['lastPaymentDate'], false)}}</th>
  250. <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment date</a></th>
  251. </tr>
  252. --}}
  253. </tbody>
  254. </table>
  255. </div>
  256. </div>
  257. </div>
  258. <div class="col-md-9">
  259. <div class="row mcp-theme-1" id="pro-dashboard-container" v-cloak>
  260. <div class="col-md-6 mcp-theme-1">
  261. <div class="card mb-4">
  262. <div class="card-header pl-2">
  263. <strong>
  264. Appointments @{{ formatSelectedDate(selectedDate) }}
  265. </strong>
  266. </div>
  267. <div class="card-body p-0">
  268. @include('app.mcp.dashboard.appointments')
  269. </div>
  270. </div>
  271. <div class="card mb-4">
  272. <div class="card-header pl-2">
  273. <strong>
  274. Measurements
  275. </strong>
  276. </div>
  277. <div class="card-body">
  278. @include('app.mcp.dashboard.measurements')
  279. </div>
  280. </div>
  281. </div>
  282. <div class="col-md-6 mcp-theme-1">
  283. <div class="card mb-4">
  284. <div class="card-header pl-2">
  285. <strong>
  286. Notifications
  287. </strong>
  288. </div>
  289. <div class="card-body px-3 py-2">
  290. @include('app.mcp.dashboard.notifications')
  291. </div>
  292. </div>
  293. <div class="card mb-4">
  294. <div class="card-header pl-2">
  295. <strong>
  296. Messages
  297. </strong>
  298. </div>
  299. <div class="card-body">
  300. @include('app.mcp.dashboard.messages')
  301. </div>
  302. </div>
  303. <div class="card mb-4">
  304. <div class="card-header pl-2">
  305. <strong>
  306. Phone Calls & Memos
  307. </strong>
  308. </div>
  309. <div class="card-body">
  310. @include('app.mcp.dashboard.calls_memos')
  311. </div>
  312. </div>
  313. </div>
  314. </div>
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. </div>
  320. <div class="stag-popup stag-popup-md ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
  321. <script>
  322. (function () {
  323. function init() {
  324. window.apapp = new Vue({
  325. el: '#pro-dashboard-container',
  326. delimiters: ['@{{', '}}'],
  327. data: {
  328. tab: '{{ request()->input('tab') ? request()->input('tab') : 'measurements' }}',
  329. datesWithEvents: [],
  330. selectedDate: '{{ date('Y-m-d') }}',
  331. selectedStatus: 'PENDING',
  332. events: [],
  333. numEventsForDate: 0,
  334. filterStatus: '',
  335. calendarElem: null,
  336. currentMonth: null,
  337. currentYear: null,
  338. measurementFilterStatus: 'ALL',
  339. measurements: {!! $pro->pro_type === 'ADMIN' ? '[]' : json_encode($pro->getMeasurements()) !!},
  340. appointmentsLoaded: false,
  341. },
  342. methods: {
  343. formatDate: function (date) {
  344. let d = new Date(date),
  345. month = '' + (d.getMonth() + 1),
  346. day = '' + d.getDate(),
  347. year = d.getFullYear();
  348. if (month.length < 2)
  349. month = '0' + month;
  350. if (day.length < 2)
  351. day = '0' + day;
  352. return [year, month, day].join('-');
  353. },
  354. onDateChange: function (_newDate) {
  355. let self = this;
  356. window.setTimeout(() => {
  357. // let dayValue = $('.pro-dashboard-inline-calendar td.day.active').first().text();
  358. // if(dayValue.length === 1) dayValue = '0' + dayValue;
  359. // self.selectedDate = _newDate.substr(0, 8) + dayValue;
  360. self.selectedDate = _newDate;
  361. showMask();
  362. self.loadEvents(self.selectedDate, function () {
  363. hideMask();
  364. Vue.nextTick(() => {
  365. // self.highlightDatesWithEvents(self.datesWithEvents);
  366. initFastLoad($('.appointments-tab'));
  367. initFastLoad($('#pro-dashboard-container'));
  368. });
  369. });
  370. }, 25);
  371. },
  372. selectToday: function () {
  373. $('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
  374. $('.pro-dashboard-inline-calendar table td[data-date="{{ $milliseconds }}"]')
  375. .addClass('active');
  376. // this.onDateChange('{{ date('Y-m-d') }}');
  377. },
  378. highlightDatesWithEvents: function (_dates) {
  379. $('.pro-dashboard-inline-calendar table td[data-date]').removeAttr('has-events');
  380. for (let i = 0; i < _dates.length; i++) {
  381. $('.pro-dashboard-inline-calendar table td[data-date="' + _dates[i] + '"]')
  382. .attr('has-events', 1);
  383. }
  384. },
  385. updateStatus: function (_event) {
  386. $.post('/api/appointment/updateStatus', {
  387. uid: _event.uid,
  388. status: _event.newStatus
  389. }, function (_data) {
  390. if (!_data) {
  391. toastr.error('Unable to update appointment status!');
  392. } else {
  393. if (!_data.success) {
  394. toastr.error(_data.message);
  395. } else {
  396. _event.status = _event.newStatus;
  397. toastr.success('The appointment has been updated');
  398. }
  399. }
  400. }, 'json')
  401. },
  402. showEditForm: function (_trigger) {
  403. let form = $(_trigger).closest('[moe]').find('form').first();
  404. showMoeFormMask();
  405. form.show();
  406. setTimeout(function () {
  407. initPrimaryForm(form);
  408. }, 0);
  409. },
  410. submitEditForm: function (_trigger) {
  411. let form = $(_trigger).closest('[moe]').find('form').first();
  412. if (!form[0].checkValidity()) {
  413. form[0].reportValidity();
  414. return;
  415. }
  416. $.post(form.attr('url'), form.serialize(), function (_data) {
  417. if (_data && _data.success) {
  418. fastReload();
  419. } else {
  420. if (_data.message) {
  421. toastr.error(_data.message);
  422. } else {
  423. toastr.error('Unable to update the appointment');
  424. }
  425. }
  426. });
  427. },
  428. cancelEditForm: function (_trigger) {
  429. let form = $(_trigger).closest('[moe]').find('form').first();
  430. hideMoeFormMask();
  431. form.hide();
  432. },
  433. loadEventDates: function (_refDate = false) {
  434. let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
  435. firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
  436. lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  437. this.selectedDate = null;
  438. $('td.day.active').removeClass('active');
  439. $.get('/pro-dashboard-event-dates/' +
  440. this.formatDate(firstOfMonth) + '/' +
  441. this.formatDate(lastOfMonth), (_data) => {
  442. this.datesWithEvents = _data;
  443. console.log(this.datesWithEvents);
  444. this.calendarElem.datepicker('refresh');
  445. // this.highlightDatesWithEvents(this.datesWithEvents);
  446. this.currentMonth = firstOfMonth.getMonth();
  447. this.currentYear = firstOfMonth.getFullYear();
  448. if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
  449. $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
  450. }
  451. this.appointmentsLoaded = true;
  452. }, 'json');
  453. },
  454. loadEvents: function (_date, _callback) {
  455. let self = this;
  456. $.get('/pro-dashboard-events/' + _date + '/' + _date, function (_data) {
  457. self.events = _data;
  458. self.numEventsForDate = (_data && _data.length) ? 1 : 0;
  459. _callback.call(self);
  460. }, 'json');
  461. },
  462. updateMeasurements: function () {
  463. $.get('/pro-dashboard-measurements/' + this.measurementFilterStatus, (_data) => {
  464. this.measurements = _data;
  465. Vue.nextTick(() => {
  466. // this.initCMRTE();
  467. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  468. initMoes();
  469. });
  470. }, 'json');
  471. },
  472. setMeasurementStatus: function (_uid, _status) {
  473. $.post('/api/measurement/updateStatus', {
  474. uid: _uid,
  475. status: _status
  476. }, (_data) => {
  477. this.updateMeasurements();
  478. }, 'json');
  479. },
  480. initCMRTE: function () {
  481. $('#pro-dashboard-container [cm-rte]').each(function () {
  482. $(this).wrap(
  483. $('<div class="border-left border-right rte-holder"/>')
  484. .attr('data-shortcuts', '')
  485. );
  486. // give a unique id to this editor instance
  487. var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
  488. var el = this;
  489. var existingContent = $(el).attr('data-content');
  490. var quill = new Quill(el, {
  491. theme: 'snow',
  492. modules: stagQuillConfig
  493. });
  494. var toolbar = $(quill.container).prev('.ql-toolbar');
  495. // add button for new shortcut
  496. var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
  497. 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
  498. toolbar.append(newSCButton);
  499. quill.root.innerHTML = existingContent;
  500. $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
  501. quill.on('text-change', function (delta, oldDelta, source) {
  502. $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
  503. });
  504. $(quill.container)
  505. .find('.ql-editor[contenteditable]')
  506. .attr('data-field', fieldName)
  507. .attr('data-editor-id', editorID)
  508. .attr('with-shortcuts', 1);
  509. })
  510. },
  511. initLoadAppointments: function () {
  512. if (this.appointmentsLoaded) return false;
  513. this.loadEventDates();
  514. },
  515. loadMeasurements: function () {
  516. $('#measurements-tab').load('/pro-dashboard-measurements-tab', () => {
  517. initMoes();
  518. initFastLoad($('#measurements-tab'));
  519. });
  520. },
  521. getFormattedCurrentDate: function () {
  522. let date = new Date();
  523. let day = date.getDate();
  524. day = day < 10 ? '0' + day : day;
  525. return date.getFullYear() + '-' + parseInt(date.getMonth() + 1) + '-' + day;
  526. },
  527. formatSelectedDate: function (_date, _format) {
  528. _format = _format || 'MM/DD/YYYY';
  529. if (_date) {
  530. return moment(_date).format(_format);
  531. }
  532. },
  533. formatTimeZone: function (_tz) {
  534. switch (_tz) {
  535. case 'EASTERN':
  536. return 'EST'
  537. break;
  538. case 'CENTRAL':
  539. return 'CST'
  540. break;
  541. case 'MOUNTAIN':
  542. return 'MST'
  543. break;
  544. case 'PACIFIC':
  545. return 'PST'
  546. break;
  547. case 'ALASKA':
  548. return 'Alaska'
  549. break;
  550. case 'HAWAII':
  551. return 'Hawaii'
  552. break;
  553. case 'PUERTO_RICO':
  554. return 'Puerto Rico'
  555. break;
  556. default:
  557. return 'N/A';
  558. }
  559. }
  560. },
  561. mounted: function () {
  562. let self = this;
  563. this.calendarElem = $('.pro-dashboard-inline-calendar');
  564. this.calendarElem.datepicker({
  565. dateFormat: 'yy-mm-dd',
  566. onSelect: function (_date) {
  567. self.onDateChange(_date);
  568. },
  569. onChangeMonthYear: function (_year, _month) {
  570. let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
  571. self.loadEventDates(date);
  572. },
  573. beforeShowDay: function (d) {
  574. if (self.datesWithEvents && self.datesWithEvents.indexOf(self.formatDate(d)) !== -1) {
  575. return [true, 'has-events'];
  576. }
  577. return [true, 'no-events'];
  578. },
  579. defaultDate: 0
  580. });
  581. // this.calendarElem
  582. // .on('changeDate', function () {
  583. // self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
  584. // })
  585. // .on('changeMonth', function () {
  586. // window.setTimeout(function() {
  587. // let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
  588. // if(ts) {
  589. // self.loadEventDates(ts);
  590. // }
  591. // }, 10);
  592. // });
  593. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  594. initMoes();
  595. // init fast load
  596. initFastLoad($('#pro-dashboard-container'));
  597. $(document)
  598. .off('click', '.dashboard-measurements.pagination a.page-link')
  599. .on('click', '.dashboard-measurements.pagination a.page-link', function () {
  600. $('#measurements-tab').text('Loading...').load('/pro-dashboard-measurements-tab/' + $(this).attr('data-target-page'), () => {
  601. initMoes();
  602. initFastLoad($('#measurements-tab'));
  603. });
  604. return false;
  605. });
  606. this.loadMeasurements();
  607. this.initLoadAppointments();
  608. this.onDateChange(this.getFormattedCurrentDate());
  609. this.selectedDate = this.getFormattedCurrentDate();
  610. }
  611. });
  612. /*// refresh once ticket popup is closed
  613. $('body').off('stag-popup-closed')
  614. $('body').on('stag-popup-closed', function() {
  615. if($('#pro-dashboard-container').length) {
  616. let activeTab = $('.nav-link.active[data-tab]').attr('data-tab');
  617. if(activeTab) {
  618. fastLoad('/?tab=' + activeTab);
  619. }
  620. }
  621. });*/
  622. // ticket-popup
  623. $(document)
  624. .off('click', '.ticket-popup-trigger')
  625. .on('click', '.ticket-popup-trigger', function () {
  626. showMask();
  627. window.noMc = true;
  628. $.get(this.href, (_data) => {
  629. $('.ticket-popup').html(_data);
  630. showStagPopup('ticket-popup');
  631. $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
  632. runMCInitializer('patient-tickets'); // run specific mc initer
  633. hideMask();
  634. });
  635. return false;
  636. });
  637. $(document)
  638. .off('click', '.ack-client-pro-change')
  639. .on('click', '.ack-client-pro-change', function () {
  640. let trigger = $(this).text('…');
  641. $.post('/api/clientProChange/accept', {
  642. uid: $(this).attr('data-uid')
  643. }, _data => {
  644. if (!hasResponseError(_data)) {
  645. trigger.hide();
  646. let doneElem = $('<i class="text-success fa fa-check"></i>');
  647. doneElem.insertAfter(trigger);
  648. setTimeout(() => {
  649. let ackContainer = trigger.closest('.ack-container');
  650. trigger.closest('div').slideUp('fast', function () {
  651. $(this).remove();
  652. if (!ackContainer.find('>div').length) {
  653. ackContainer.remove();
  654. }
  655. });
  656. }, 500);
  657. }
  658. }, 'json');
  659. return false;
  660. });
  661. $(document)
  662. .off('click', '.ack-client-memo')
  663. .on('click', '.ack-client-memo', function () {
  664. let trigger = $(this).text('…');
  665. $.post('/api/clientMemo/stamp', {
  666. uid: $(this).attr('data-uid')
  667. }, _data => {
  668. if (!hasResponseError(_data)) {
  669. trigger.hide();
  670. let doneElem = $('<i class="text-success fa fa-check"></i>');
  671. doneElem.insertAfter(trigger);
  672. setTimeout(() => {
  673. let tbody = trigger.closest('tbody');
  674. trigger.closest('tr').remove();
  675. if (!tbody.find('>tr').length) {
  676. tbody.closest('.ack-container').remove();
  677. }
  678. }, 500);
  679. }
  680. }, 'json');
  681. return false;
  682. });
  683. $(document)
  684. .off('click', '.ack-pro-appt-update')
  685. .on('click', '.ack-pro-appt-update', function () {
  686. let trigger = $(this).text('…');
  687. $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
  688. uid: $(this).attr('data-uid')
  689. }, _data => {
  690. if (!hasResponseError(_data)) {
  691. trigger.hide();
  692. let doneElem = $('<i class="text-success fa fa-check"></i>');
  693. doneElem.insertAfter(trigger);
  694. setTimeout(() => {
  695. let ackContainer = trigger.closest('tbody');
  696. trigger.closest('tr').slideUp('fast', function () {
  697. $(this).remove();
  698. if (!ackContainer.find('>tr').length) {
  699. ackContainer.remove();
  700. }
  701. });
  702. }, 500);
  703. }
  704. }, 'json');
  705. return false;
  706. });
  707. }
  708. addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
  709. })();
  710. </script>
  711. @endsection