dashboard-mcp.blade.php 41 KB

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