dashboard-mcp.blade.php 42 KB

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