dashboard-mcp.blade.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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">
  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: 'CREATED',
  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. });
  368. });
  369. }, 25);
  370. },
  371. selectToday: function () {
  372. $('.pro-dashboard-inline-calendar table td[data-date]').removeClass('active');
  373. $('.pro-dashboard-inline-calendar table td[data-date="{{ $milliseconds }}"]')
  374. .addClass('active');
  375. // this.onDateChange('{{ date('Y-m-d') }}');
  376. },
  377. highlightDatesWithEvents: function (_dates) {
  378. $('.pro-dashboard-inline-calendar table td[data-date]').removeAttr('has-events');
  379. for (let i = 0; i < _dates.length; i++) {
  380. $('.pro-dashboard-inline-calendar table td[data-date="' + _dates[i] + '"]')
  381. .attr('has-events', 1);
  382. }
  383. },
  384. updateStatus: function (_event) {
  385. $.post('/api/appointment/updateStatus', {
  386. uid: _event.uid,
  387. status: _event.newStatus
  388. }, function (_data) {
  389. if (!_data) {
  390. toastr.error('Unable to update appointment status!');
  391. } else {
  392. if (!_data.success) {
  393. toastr.error(_data.message);
  394. } else {
  395. _event.status = _event.newStatus;
  396. toastr.success('The appointment has been updated');
  397. }
  398. }
  399. }, 'json')
  400. },
  401. showEditForm: function (_trigger) {
  402. let form = $(_trigger).closest('[moe]').find('form').first();
  403. showMoeFormMask();
  404. form.show();
  405. setTimeout(function () {
  406. initPrimaryForm(form);
  407. }, 0);
  408. },
  409. submitEditForm: function (_trigger) {
  410. let form = $(_trigger).closest('[moe]').find('form').first();
  411. if (!form[0].checkValidity()) {
  412. form[0].reportValidity();
  413. return;
  414. }
  415. $.post(form.attr('url'), form.serialize(), function (_data) {
  416. if (_data && _data.success) {
  417. fastReload();
  418. } else {
  419. if (_data.message) {
  420. toastr.error(_data.message);
  421. } else {
  422. toastr.error('Unable to update the appointment');
  423. }
  424. }
  425. });
  426. },
  427. cancelEditForm: function (_trigger) {
  428. let form = $(_trigger).closest('[moe]').find('form').first();
  429. hideMoeFormMask();
  430. form.hide();
  431. },
  432. loadEventDates: function (_refDate = false) {
  433. let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
  434. firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
  435. lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
  436. this.selectedDate = null;
  437. $('td.day.active').removeClass('active');
  438. $.get('/pro-dashboard-event-dates/' +
  439. this.formatDate(firstOfMonth) + '/' +
  440. this.formatDate(lastOfMonth), (_data) => {
  441. this.datesWithEvents = _data;
  442. console.log(this.datesWithEvents);
  443. this.calendarElem.datepicker('refresh');
  444. // this.highlightDatesWithEvents(this.datesWithEvents);
  445. this.currentMonth = firstOfMonth.getMonth();
  446. this.currentYear = firstOfMonth.getFullYear();
  447. if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
  448. $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
  449. }
  450. this.appointmentsLoaded = true;
  451. }, 'json');
  452. },
  453. loadEvents: function (_date, _callback) {
  454. let self = this;
  455. $.get('/pro-dashboard-events/' + _date + '/' + _date, function (_data) {
  456. self.events = _data;
  457. self.numEventsForDate = (_data && _data.length) ? 1 : 0;
  458. _callback.call(self);
  459. }, 'json');
  460. },
  461. updateMeasurements: function () {
  462. $.get('/pro-dashboard-measurements/' + this.measurementFilterStatus, (_data) => {
  463. this.measurements = _data;
  464. Vue.nextTick(() => {
  465. // this.initCMRTE();
  466. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  467. initMoes();
  468. });
  469. }, 'json');
  470. },
  471. setMeasurementStatus: function (_uid, _status) {
  472. $.post('/api/measurement/updateStatus', {
  473. uid: _uid,
  474. status: _status
  475. }, (_data) => {
  476. this.updateMeasurements();
  477. }, 'json');
  478. },
  479. initCMRTE: function () {
  480. $('#pro-dashboard-container [cm-rte]').each(function () {
  481. $(this).wrap(
  482. $('<div class="border-left border-right rte-holder"/>')
  483. .attr('data-shortcuts', '')
  484. );
  485. // give a unique id to this editor instance
  486. var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
  487. var el = this;
  488. var existingContent = $(el).attr('data-content');
  489. var quill = new Quill(el, {
  490. theme: 'snow',
  491. modules: stagQuillConfig
  492. });
  493. var toolbar = $(quill.container).prev('.ql-toolbar');
  494. // add button for new shortcut
  495. var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
  496. 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
  497. toolbar.append(newSCButton);
  498. quill.root.innerHTML = existingContent;
  499. $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
  500. quill.on('text-change', function (delta, oldDelta, source) {
  501. $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
  502. });
  503. $(quill.container)
  504. .find('.ql-editor[contenteditable]')
  505. .attr('data-field', fieldName)
  506. .attr('data-editor-id', editorID)
  507. .attr('with-shortcuts', 1);
  508. })
  509. },
  510. initLoadAppointments: function () {
  511. if (this.appointmentsLoaded) return false;
  512. this.loadEventDates();
  513. },
  514. loadMeasurements: function () {
  515. $('#measurements-tab').load('/pro-dashboard-measurements-tab', () => {
  516. initMoes();
  517. initFastLoad($('#measurements-tab'));
  518. });
  519. },
  520. getFormattedCurrentDate: function () {
  521. let date = new Date();
  522. let day = date.getDate();
  523. day = day < 10 ? '0' + day : day;
  524. return date.getFullYear() + '-' + parseInt(date.getMonth() + 1) + '-' + day;
  525. },
  526. formatSelectedDate: function (_date, _format) {
  527. _format = _format || 'MM/DD/YYYY';
  528. if (_date) {
  529. return moment(_date).format(_format);
  530. }
  531. },
  532. formatTimeZone: function (_tz) {
  533. switch (_tz) {
  534. case 'EASTERN':
  535. return 'EST'
  536. break;
  537. case 'CENTRAL':
  538. return 'CST'
  539. break;
  540. case 'MOUNTAIN':
  541. return 'MST'
  542. break;
  543. case 'PACIFIC':
  544. return 'PST'
  545. break;
  546. case 'ALASKA':
  547. return 'Alaska'
  548. break;
  549. case 'HAWAII':
  550. return 'Hawaii'
  551. break;
  552. case 'PUERTO_RICO':
  553. return 'Puerto Rico'
  554. break;
  555. default:
  556. return 'N/A';
  557. }
  558. }
  559. },
  560. mounted: function () {
  561. let self = this;
  562. this.calendarElem = $('.pro-dashboard-inline-calendar');
  563. this.calendarElem.datepicker({
  564. dateFormat: 'yy-mm-dd',
  565. onSelect: function (_date) {
  566. self.onDateChange(_date);
  567. },
  568. onChangeMonthYear: function (_year, _month) {
  569. let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
  570. self.loadEventDates(date);
  571. },
  572. beforeShowDay: function (d) {
  573. if (self.datesWithEvents && self.datesWithEvents.indexOf(self.formatDate(d)) !== -1) {
  574. return [true, 'has-events'];
  575. }
  576. return [true, 'no-events'];
  577. },
  578. defaultDate: 0
  579. });
  580. // this.calendarElem
  581. // .on('changeDate', function () {
  582. // self.onDateChange(self.calendarElem.datepicker('getFormattedDate'));
  583. // })
  584. // .on('changeMonth', function () {
  585. // window.setTimeout(function() {
  586. // let ts = $('td.day[data-date]').first().closest('tr').find('td.day[data-date]').last().attr('data-date');
  587. // if(ts) {
  588. // self.loadEventDates(ts);
  589. // }
  590. // }, 10);
  591. // });
  592. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  593. initMoes();
  594. // init fast load
  595. initFastLoad($('#pro-dashboard-container'));
  596. $(document)
  597. .off('click', '.dashboard-measurements.pagination a.page-link')
  598. .on('click', '.dashboard-measurements.pagination a.page-link', function () {
  599. $('#measurements-tab').text('Loading...').load('/pro-dashboard-measurements-tab/' + $(this).attr('data-target-page'), () => {
  600. initMoes();
  601. initFastLoad($('#measurements-tab'));
  602. });
  603. return false;
  604. });
  605. this.loadMeasurements();
  606. this.initLoadAppointments();
  607. this.onDateChange(this.getFormattedCurrentDate());
  608. this.selectedDate = this.getFormattedCurrentDate();
  609. }
  610. });
  611. /*// refresh once ticket popup is closed
  612. $('body').off('stag-popup-closed')
  613. $('body').on('stag-popup-closed', function() {
  614. if($('#pro-dashboard-container').length) {
  615. let activeTab = $('.nav-link.active[data-tab]').attr('data-tab');
  616. if(activeTab) {
  617. fastLoad('/?tab=' + activeTab);
  618. }
  619. }
  620. });*/
  621. // ticket-popup
  622. $(document)
  623. .off('click', '.ticket-popup-trigger')
  624. .on('click', '.ticket-popup-trigger', function () {
  625. showMask();
  626. window.noMc = true;
  627. $.get(this.href, (_data) => {
  628. $('.ticket-popup').html(_data);
  629. showStagPopup('ticket-popup');
  630. $('.ticket-popup .stag-popup.stag-slide').attr('close-all-with-self', 1);
  631. runMCInitializer('patient-tickets'); // run specific mc initer
  632. hideMask();
  633. });
  634. return false;
  635. });
  636. $(document)
  637. .off('click', '.ack-client-pro-change')
  638. .on('click', '.ack-client-pro-change', function () {
  639. let trigger = $(this).text('…');
  640. $.post('/api/clientProChange/accept', {
  641. uid: $(this).attr('data-uid')
  642. }, _data => {
  643. if (!hasResponseError(_data)) {
  644. trigger.hide();
  645. let doneElem = $('<i class="text-success fa fa-check"></i>');
  646. doneElem.insertAfter(trigger);
  647. setTimeout(() => {
  648. let ackContainer = trigger.closest('.ack-container');
  649. trigger.closest('div').slideUp('fast', function () {
  650. $(this).remove();
  651. if (!ackContainer.find('>div').length) {
  652. ackContainer.remove();
  653. }
  654. });
  655. }, 500);
  656. }
  657. }, 'json');
  658. return false;
  659. });
  660. $(document)
  661. .off('click', '.ack-client-memo')
  662. .on('click', '.ack-client-memo', function () {
  663. let trigger = $(this).text('…');
  664. $.post('/api/clientMemo/stamp', {
  665. uid: $(this).attr('data-uid')
  666. }, _data => {
  667. if (!hasResponseError(_data)) {
  668. trigger.hide();
  669. let doneElem = $('<i class="text-success fa fa-check"></i>');
  670. doneElem.insertAfter(trigger);
  671. setTimeout(() => {
  672. let tbody = trigger.closest('tbody');
  673. trigger.closest('tr').remove();
  674. if (!tbody.find('>tr').length) {
  675. tbody.closest('.ack-container').remove();
  676. }
  677. }, 500);
  678. }
  679. }, 'json');
  680. return false;
  681. });
  682. $(document)
  683. .off('click', '.ack-pro-appt-update')
  684. .on('click', '.ack-pro-appt-update', function () {
  685. let trigger = $(this).text('…');
  686. $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
  687. uid: $(this).attr('data-uid')
  688. }, _data => {
  689. if (!hasResponseError(_data)) {
  690. trigger.hide();
  691. let doneElem = $('<i class="text-success fa fa-check"></i>');
  692. doneElem.insertAfter(trigger);
  693. setTimeout(() => {
  694. let ackContainer = trigger.closest('tbody');
  695. trigger.closest('tr').slideUp('fast', function () {
  696. $(this).remove();
  697. if (!ackContainer.find('>tr').length) {
  698. ackContainer.remove();
  699. }
  700. });
  701. }, 500);
  702. }
  703. }, 'json');
  704. return false;
  705. });
  706. }
  707. addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
  708. })();
  709. </script>
  710. @endsection