dashboard-mcp.blade.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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 Pending Stamping
  297. </strong>
  298. </div>
  299. <div class="card-body p-0">
  300. @include('app.mcp.dashboard.measurements-pending-stamping')
  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. $('#pro-dashboard-container').find('[moe][initialized]').removeAttr('initialized');
  391. initMoes();
  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. getEventBgColor: function(status){
  585. if(status === 'COMPLETED') return 'event-bg-green';
  586. if(status === 'CANCELLED') return 'event-bg-gray';
  587. return '';
  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