@openmrs/esm-appointments-app 9.2.1-pre.6735 → 9.2.1-pre.6740

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/9712.js CHANGED
@@ -1 +1 @@
1
- (globalThis.webpackChunk_openmrs_esm_appointments_app=globalThis.webpackChunk_openmrs_esm_appointments_app||[]).push([[9712],{19862:(t,e,n)=>{"use strict";n.d(e,{Fy:()=>m,KQ:()=>f,RA:()=>h,q4:()=>d,wQ:()=>v});var r=n(1343),o=n(23464),a=n.n(o),i=n(85602),s=n.n(i),u=n(71123),l=n(54440);function c(t,e,n,r,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}a().extend(s());var p="".concat(l.restBaseUrl,"/appointment");function d(){var t=(0,u.iX)().mutate;return{mutateAppointments:(0,r.useCallback)(function(){return t(function(t){return"string"==typeof t&&t.startsWith(p)||Array.isArray(t)&&t[0].startsWith(p)})},[t])}}function f(){var t=(0,u.Ay)("".concat(l.restBaseUrl,"/appointmentService/all/full"),l.openmrsFetch),e=t.data,n=t.error,r=t.isLoading;return{data:e?e.data:null,error:n,isLoading:r}}function m(t,e){return(0,l.openmrsFetch)("".concat(l.restBaseUrl,"/appointment"),{method:"POST",signal:e.signal,headers:{"Content-Type":"application/json"},body:t})}function h(t,e){return(0,l.openmrsFetch)("".concat(l.restBaseUrl,"/recurring-appointments"),{method:"POST",signal:e.signal,headers:{"Content-Type":"application/json"},body:t})}"".concat(l.restBaseUrl,"/appointments/search");var v=function(t){return(e=function(){return function(t,e){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}(this,function(e){switch(e.label){case 0:return[4,(0,l.openmrsFetch)("".concat(l.restBaseUrl,"/appointments/conflicts"),{method:"POST",body:{patientUuid:t.patientUuid,serviceUuid:t.serviceUuid,startDateTime:t.startDateTime,endDateTime:t.endDateTime,providers:[],locationUuid:t.locationUuid,appointmentKind:t.appointmentKind},headers:{"Content-Type":"application/json"}})];case 1:return[2,e.sent()]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(t){c(a,r,o,i,s,"next",t)}function s(t){c(a,r,o,i,s,"throw",t)}i(void 0)})})();var e}},30493:(t,e,n)=>{"use strict";n.d(e,{D:()=>p,y:()=>d});var r=n(23464),o=n.n(r),a=n(71123),i=n(54440),s=n(85602),u=n.n(s);function l(t,e,n,r,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}o().extend(u());var c="".concat(i.restBaseUrl,"/appointments/search");function p(t,e,n){var r,s,u,l,p,d,f,m=(0,a.Ay)(c,function(){return(0,i.openmrsFetch)(c,{method:"POST",signal:n.signal,headers:{"Content-Type":"application/json"},body:{patientUuid:t,startDate:e}})}),h=m.data,v=m.error,y=m.isLoading,b=m.isValidating,w=m.mutate,g=(null==h||null===(r=h.data)||void 0===r?void 0:r.length)?h.data:null,k=null==g||null===(u=g.sort(function(t,e){return e.startDateTime>t.startDateTime?1:-1}))||void 0===u||null===(s=u.filter(function(t){return"Cancelled"!==t.status}))||void 0===s?void 0:s.filter(function(t){var e=t.startDateTime;return o()(new Date(e).toISOString()).isBefore((new Date).setHours(0,0,0,0))}),T=null==g||null===(p=g.sort(function(t,e){return t.startDateTime>e.startDateTime?1:-1}))||void 0===p||null===(l=p.filter(function(t){return"Cancelled"!==t.status}))||void 0===l?void 0:l.filter(function(t){var e=t.startDateTime;return o()(new Date(e).toISOString()).isAfter(new Date)}),C=null==g||null===(f=g.sort(function(t,e){return t.startDateTime>e.startDateTime?1:-1}))||void 0===f||null===(d=f.filter(function(t){return"Cancelled"!==t.status}))||void 0===d?void 0:d.filter(function(t){var e=t.startDateTime;return o()(new Date(e).toISOString()).isToday()});return{data:h?{pastAppointments:k,upcomingAppointments:T,todaysAppointments:C}:null,error:v,isLoading:y,isValidating:b,mutate:w}}var d=function(t,e){return(n=function(){var n,r,a;return function(t,e){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}(this,function(s){switch(s.label){case 0:return n=Intl.DateTimeFormat().resolvedOptions().timeZone,r=o()(new Date).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),a="".concat(i.restBaseUrl,"/appointments/").concat(e,"/status-change"),[4,(0,i.openmrsFetch)(a,{body:{toStatus:t,onDate:r,timeZone:n},method:"POST",headers:{"Content-Type":"application/json"}})];case 1:return[2,s.sent()]}})},function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function i(t){l(a,r,o,i,s,"next",t)}function s(t){l(a,r,o,i,s,"throw",t)}i(void 0)})})();var n}},79712:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>c});var r=n(1343),o=n.n(r),a=n(93150),i=n(93689),s=n(54440),u=n(30493),l=n(19862);const c=function(t){var e=t.patientUuid,n=t.appointmentUuid,c=t.closeModal,p=(0,a.useTranslation)().t,d=(0,s.useVisit)(e),f=d.activeVisit,m=d.mutate,h=(0,l.q4)().mutateAppointments,v=(0,r.useCallback)(function(){(0,u.y)("Completed",n).then(function(){if(h(),f){var t=new AbortController,e={stopDatetime:new Date};return(0,s.updateVisit)(f.uuid,e,t).then(function(){(0,s.showSnackbar)({title:p("appointmentEnded","Appointment ended"),subtitle:p("appointmentEndedAndVisitClosedSuccessfully","Appointment successfully ended and visit successfully closed"),isLowContrast:!0,kind:"success"}),m()}).catch(function(t){(0,s.showSnackbar)({title:p("appointmentEndedButVisitNotClosedError","Appointment ended successfully, but there was an error closing the visit."),subtitle:null==t?void 0:t.message,kind:"error",isLowContrast:!0})})}(0,s.showSnackbar)({title:p("appointmentEnded","Appointment ended"),subtitle:p("appointmentEndedSuccessfully","Appointment successfully ended."),isLowContrast:!0,kind:"success"})}).catch(function(t){(0,s.showSnackbar)({title:p("appointmentEndError","Error ending appointment"),subtitle:null==t?void 0:t.message,kind:"error",isLowContrast:!0})}).finally(function(){c()})},[f,n,c,m,h,p]);return o().createElement(o().Fragment,null,o().createElement(i.rQ0,{closeModal:c,title:p("endAppointmentConfirmation","Are you sure you want to check the patient out for this appointment?")}),o().createElement(i.cwr,null,o().createElement("p",null,f?p("endAppointmentAndVisitConfirmationMessage","Checking the patient out will mark the appointment as complete and close out the active visit for this patient."):p("endAppointmentConfirmationMessage","Checking the patient out will mark the appointment as complete."))),o().createElement(i.jlY,null,o().createElement(i.$nd,{kind:"secondary",onClick:c},p("cancel","Cancel")),o().createElement(i.$nd,{kind:"danger",onClick:v},p("checkOut","Check out"))))}},85602:function(t){t.exports=function(){"use strict";return function(t,e,n){e.prototype.isToday=function(){var t="YYYY-MM-DD",e=n();return this.format(t)===e.format(t)}}}()}}]);
1
+ (globalThis.webpackChunk_openmrs_esm_appointments_app=globalThis.webpackChunk_openmrs_esm_appointments_app||[]).push([[9712],{19862:(t,e,n)=>{"use strict";n.d(e,{Fy:()=>m,KQ:()=>f,RA:()=>h,q4:()=>d,wQ:()=>v});var r=n(1343),o=n(23464),a=n.n(o),i=n(85602),s=n.n(i),u=n(71123),l=n(54440);function c(t,e,n,r,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}a().extend(s());var p="".concat(l.restBaseUrl,"/appointment");function d(){var t=(0,u.iX)().mutate;return{mutateAppointments:(0,r.useCallback)(function(){return t(function(t){return"string"==typeof t&&t.startsWith(p)||Array.isArray(t)&&t[0].startsWith(p)})},[t])}}function f(){var t=(0,u.Ay)("".concat(l.restBaseUrl,"/appointmentService/all/full"),l.openmrsFetch),e=t.data,n=t.error,r=t.isLoading;return{data:e?e.data:null,error:n,isLoading:r}}function m(t,e){return(0,l.openmrsFetch)("".concat(l.restBaseUrl,"/appointment"),{method:"POST",signal:e.signal,headers:{"Content-Type":"application/json"},body:t})}function h(t,e){return(0,l.openmrsFetch)("".concat(l.restBaseUrl,"/recurring-appointments"),{method:"POST",signal:e.signal,headers:{"Content-Type":"application/json"},body:t})}"".concat(l.restBaseUrl,"/appointments/search");var v=function(t){return(e=function(){return function(t,e){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}(this,function(e){switch(e.label){case 0:return[4,(0,l.openmrsFetch)("".concat(l.restBaseUrl,"/appointments/conflicts"),{method:"POST",body:{patientUuid:t.patientUuid,serviceUuid:t.serviceUuid,startDateTime:t.startDateTime,endDateTime:t.endDateTime,providers:[],locationUuid:t.locationUuid,appointmentKind:t.appointmentKind},headers:{"Content-Type":"application/json"}})];case 1:return[2,e.sent()]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(t){c(a,r,o,i,s,"next",t)}function s(t){c(a,r,o,i,s,"throw",t)}i(void 0)})})();var e}},30493:(t,e,n)=>{"use strict";n.d(e,{D:()=>p,y:()=>d});var r=n(23464),o=n.n(r),a=n(71123),i=n(54440),s=n(85602),u=n.n(s);function l(t,e,n,r,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}o().extend(u());var c="".concat(i.restBaseUrl,"/appointments/search");function p(t,e,n){var r,s,u,l,p,d,f,m=(0,a.Ay)(c,function(){return(0,i.openmrsFetch)(c,{method:"POST",signal:n.signal,headers:{"Content-Type":"application/json"},body:{patientUuid:t,startDate:e}})}),h=m.data,v=m.error,y=m.isLoading,b=m.isValidating,w=m.mutate,g=(null==h||null===(r=h.data)||void 0===r?void 0:r.length)?h.data:null,k=null==g||null===(u=g.sort(function(t,e){return e.startDateTime>t.startDateTime?1:-1}))||void 0===u||null===(s=u.filter(function(t){return"Cancelled"!==t.status}))||void 0===s?void 0:s.filter(function(t){var e=t.startDateTime;return o()(new Date(e).toISOString()).isBefore((new Date).setHours(0,0,0,0))}),T=null==g||null===(p=g.sort(function(t,e){return t.startDateTime>e.startDateTime?1:-1}))||void 0===p||null===(l=p.filter(function(t){return"Cancelled"!==t.status}))||void 0===l?void 0:l.filter(function(t){var e=t.startDateTime;return o()(new Date(e).toISOString()).isAfter(new Date)}),C=null==g||null===(f=g.sort(function(t,e){return t.startDateTime>e.startDateTime?1:-1}))||void 0===f||null===(d=f.filter(function(t){return"Cancelled"!==t.status}))||void 0===d?void 0:d.filter(function(t){var e=t.startDateTime;return o()(new Date(e).toISOString()).isToday()});return{data:h?{pastAppointments:k,upcomingAppointments:T,todaysAppointments:C}:null,error:v,isLoading:y,isValidating:b,mutate:w}}var d=function(t,e){return(n=function(){var n,r,a;return function(t,e){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}(this,function(s){switch(s.label){case 0:return n=Intl.DateTimeFormat().resolvedOptions().timeZone,r=o()(new Date).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),a="".concat(i.restBaseUrl,"/appointments/").concat(e,"/status-change"),[4,(0,i.openmrsFetch)(a,{body:{toStatus:t,onDate:r,timeZone:n},method:"POST",headers:{"Content-Type":"application/json"}})];case 1:return[2,s.sent()]}})},function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function i(t){l(a,r,o,i,s,"next",t)}function s(t){l(a,r,o,i,s,"throw",t)}i(void 0)})})();var n}},79712:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>c});var r=n(1343),o=n.n(r),a=n(93150),i=n(90988),s=n(54440),u=n(30493),l=n(19862);const c=function(t){var e=t.patientUuid,n=t.appointmentUuid,c=t.closeModal,p=(0,a.useTranslation)().t,d=(0,s.useVisit)(e),f=d.activeVisit,m=d.mutate,h=(0,l.q4)().mutateAppointments,v=(0,r.useCallback)(function(){(0,u.y)("Completed",n).then(function(){if(h(),f){var t=new AbortController,e={stopDatetime:new Date};return(0,s.updateVisit)(f.uuid,e,t).then(function(){(0,s.showSnackbar)({title:p("appointmentEnded","Appointment ended"),subtitle:p("appointmentEndedAndVisitClosedSuccessfully","Appointment successfully ended and visit successfully closed"),isLowContrast:!0,kind:"success"}),m()}).catch(function(t){(0,s.showSnackbar)({title:p("appointmentEndedButVisitNotClosedError","Appointment ended successfully, but there was an error closing the visit."),subtitle:null==t?void 0:t.message,kind:"error",isLowContrast:!0})})}(0,s.showSnackbar)({title:p("appointmentEnded","Appointment ended"),subtitle:p("appointmentEndedSuccessfully","Appointment successfully ended."),isLowContrast:!0,kind:"success"})}).catch(function(t){(0,s.showSnackbar)({title:p("appointmentEndError","Error ending appointment"),subtitle:null==t?void 0:t.message,kind:"error",isLowContrast:!0})}).finally(function(){c()})},[f,n,c,m,h,p]);return o().createElement(o().Fragment,null,o().createElement(i.rQ0,{closeModal:c,title:p("endAppointmentConfirmation","Are you sure you want to check the patient out for this appointment?")}),o().createElement(i.cwr,null,o().createElement("p",null,f?p("endAppointmentAndVisitConfirmationMessage","Checking the patient out will mark the appointment as complete and close out the active visit for this patient."):p("endAppointmentConfirmationMessage","Checking the patient out will mark the appointment as complete."))),o().createElement(i.jlY,null,o().createElement(i.$nd,{kind:"secondary",onClick:c},p("cancel","Cancel")),o().createElement(i.$nd,{kind:"danger",onClick:v},p("checkOut","Check out"))))}},85602:function(t){t.exports=function(){"use strict";return function(t,e,n){e.prototype.isToday=function(){var t="YYYY-MM-DD",e=n();return this.format(t)===e.format(t)}}}()}}]);