dashboard-mcp.blade.php 41 KB

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