dashboard-mcp.blade.php 42 KB

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