@ampath/esm-dha-workflow-app 4.0.0-claim-workflows.184 → 4.0.0-claim-workflows.185
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/8626.js +1 -1
- package/dist/8626.js.map +1 -1
- package/dist/esm-dha-workflow-app.js.buildmanifest.json +3 -3
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/billing/dashboard/v2/patient-bill-details/bill-details/bill-details.tsx +8 -4
- package/src/billing/dashboard/v2/types/index.ts +1 -0
package/dist/8626.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_ampath_esm_dha_workflow_app=globalThis.webpackChunk_ampath_esm_dha_workflow_app||[]).push([[2801,8626],{3028:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI{display:flex;flex-direction:column;padding:15px 15px;row-gap:10px;width:100%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt-{display:flex;flex-direction:row;column-gap:5px;width:100%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt- .-esm-dha-workflow__claim-visit-details-component__headerTitle___LGuzV{display:flex;flex-direction:row;width:50%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt- .-esm-dha-workflow__claim-visit-details-component__headerAction___2qzZX{display:flex;flex-direction:row;justify-content:flex-end;width:50%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm{display:flex;flex-direction:column}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm .-esm-dha-workflow__claim-visit-details-component__cvRow___KCCTx{display:flex;flex-direction:row;width:100%;flex-wrap:wrap;margin-top:10px}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm .-esm-dha-workflow__claim-visit-details-component__cvRow___KCCTx .-esm-dha-workflow__claim-visit-details-component__cvWidth___SYeGa{display:flex;width:45%}.-esm-dha-workflow__claim-visit-details-component__claimList___iAQLX{display:flex;flex-direction:column;row-gap:10px}.-esm-dha-workflow__claim-visit-details-component__claimSubmitBtn___zzjk7{display:flex;justify-content:flex-end;margin-left:auto;float:right}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/claim-visit-details/claim-visit-details.component.scss"],names:[],mappings:"AAAA,oEACI,YAAA,CACA,qBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,+IACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,UAAA,CACA,sNACI,YAAA,CACA,kBAAA,CACA,SAAA,CAEJ,uNACI,YAAA,CACA,kBAAA,CACA,wBAAA,CACA,SAAA,CAGR,gJACI,YAAA,CACA,qBAAA,CACA,iNACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA,CACA,oRACI,YAAA,CACA,SAAA,CAMhB,qEACI,YAAA,CACA,qBAAA,CACA,YAAA,CAGJ,0EACI,YAAA,CACA,wBAAA,CACA,gBAAA,CACA,WAAA",sourcesContent:[".cvLayout{\n display: flex;\n flex-direction: column;\n padding: 15px 15px;\n row-gap: 10px;\n width: 100%;\n .cvHeaderSection{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n width: 100%;\n .headerTitle{\n display: flex;\n flex-direction: row;\n width: 50%;\n }\n .headerAction{\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n width: 50%;\n }\n }\n .cvContentSection{\n display: flex;\n flex-direction: column;\n .cvRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n flex-wrap: wrap;\n margin-top: 10px;\n .cvWidth{\n display: flex;\n width: 45%;\n }\n }\n }\n}\n\n.claimList{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n}\n\n.claimSubmitBtn {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n float: right;\n}"],sourceRoot:""}]),i.locals={cvLayout:"-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI",cvHeaderSection:"-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt-",headerTitle:"-esm-dha-workflow__claim-visit-details-component__headerTitle___LGuzV",headerAction:"-esm-dha-workflow__claim-visit-details-component__headerAction___2qzZX",cvContentSection:"-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm",cvRow:"-esm-dha-workflow__claim-visit-details-component__cvRow___KCCTx",cvWidth:"-esm-dha-workflow__claim-visit-details-component__cvWidth___SYeGa",claimList:"-esm-dha-workflow__claim-visit-details-component__claimList___iAQLX",claimSubmitBtn:"-esm-dha-workflow__claim-visit-details-component__claimSubmitBtn___zzjk7"};const o=i},5876:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__add-claim-line-modal__addClaimLineModalLayout___d4IeA{display:flex;flex-direction:column;width:100%;row-gap:10px;width:100%}.-esm-dha-workflow__add-claim-line-modal__addClaimLineModalLayout___d4IeA .-esm-dha-workflow__add-claim-line-modal__addClaimLineModalRow___pgSOf{display:flex;flex-direction:row;width:100%;column-gap:5px;padding:5px 5px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/modals/add-claim-line/add-claim-line.modal.scss"],names:[],mappings:"AAAA,0EACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA,CACA,UAAA,CACA,iJACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA",sourcesContent:[".addClaimLineModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n width: 100%;\n .addClaimLineModalRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n padding: 5px 5px;\n }\n}"],sourceRoot:""}]),i.locals={addClaimLineModalLayout:"-esm-dha-workflow__add-claim-line-modal__addClaimLineModalLayout___d4IeA",addClaimLineModalRow:"-esm-dha-workflow__add-claim-line-modal__addClaimLineModalRow___pgSOf"};const o=i},16732:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-visits-component__claimVisitsLayout___SI0NX{display:flex;flex-direction:column;width:100%}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/claim-visits.component.scss"],names:[],mappings:"AAAA,sEACI,YAAA,CACA,qBAAA,CACA,UAAA",sourcesContent:[".claimVisitsLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n}"],sourceRoot:""}]),i.locals={claimVisitsLayout:"-esm-dha-workflow__claim-visits-component__claimVisitsLayout___SI0NX"};const o=i},18548:(e,t,n)=>{n.d(t,{B2:()=>c,lr:()=>m,un:()=>u,zB:()=>s});var r=n(25987),l=n(62801);function a(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function o(e){a(i,r,l,o,c,"next",e)}function c(e){a(i,r,l,o,c,"throw",e)}o(void 0)}))}}function o(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function c(e,t){return i((function(){var n,l;return o(this,(function(a){switch(a.label){case 0:return[4,(0,r.openmrsFetch)(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw l=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(l));case 3:return[2,n.json()]}}))}))()}function u(e){return i((function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/send-custom-otp"),r={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid,phoneNumber:e.phoneNumber},[2,c(n,r)]}}))}))()}function s(e){return i((function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/validate-custom-otp"),r={sessionId:e.sessionId,otp:e.otp,locationUuid:e.locationUuid},[2,c(n,r)]}}))}))()}function m(e){return i((function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/search"),r={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid},[2,c(n,r)]}}))}))()}},18626:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Zt});var r=n(16072),l=n.n(r),a=n(27114),i=n(44455),o=n(25987),c=n(50810),u=n(63654),s=n(2383),m=n(83270),d=n(49564),f=n(59184),p=n(81673),y=n(97209),h=n(84176);function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){v(a,r,l,i,o,"next",e)}function o(e){v(a,r,l,i,o,"throw",e)}i(void 0)}))}}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){E(e,t,n[t])}))}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||S(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(e){if(Array.isArray(e))return A(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||S(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}function k(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var x=[{key:"service",header:"Bill Item"},{key:"payerType",header:"Payer"},{key:"quantity",header:"Quantity"},{key:"price",header:"Price"},{key:"balance",header:"Total"},{key:"status",header:"Status"},{key:"select",header:"Select"},{key:"actions",header:"Actions"}],I=["PHC","SHIF","ECCIF","SHA"],T=["CASH","MPESA"],N=function(e){if(!e)return"";var t=new Date(e),n=new Date,r=t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate(),l=new Date;l.setDate(n.getDate()-1);var a=t.getFullYear()===l.getFullYear()&&t.getMonth()===l.getMonth()&&t.getDate()===l.getDate(),i=t.toLocaleTimeString(void 0,{hour:"numeric",minute:"numeric",hour12:!0});return r?"Today, ".concat(i):a?"Yesterday, ".concat(i):t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",hour12:!0})},P=function(e){return"Ksh ".concat(e.toLocaleString())},D=function(){(0,o.navigate)({to:"".concat(window.spaBase,"/home/billing"),templateParams:{}})};const U=function(){var e,t,n,a,A,v,E,S,U,B,F,j=_((0,r.useState)(null),2),O=j[0],L=j[1],R=_((0,r.useState)([]),2),H=R[0],M=R[1],q=_((0,r.useState)(!0),2),Y=q[0],K=q[1],G=(F=window.location.pathname.split("/"))[F.length-1];(0,r.useEffect)((function(){b((function(){var e,t,n,r;return k(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,3,4]),[4,(0,y.Gn)(G)];case 1:return t=l.sent(),L(t),n=(null==t||null===(e=t.lineItems)||void 0===e?void 0:e.map((function(e){var t;return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:(null===(t=e.paymentStatus)||void 0===t?void 0:t.toUpperCase())||"PENDING"}})))||[],M(n),[3,4];case 2:return r=l.sent(),console.error("Failed to fetch bill",r),[3,4];case 3:return K(!1),[7];case 4:return[2]}}))}))()}),[G,M]);var z=(null==O?void 0:O.receiptNumber)||(null==O?void 0:O.id)||"",V=(null==O||null===(e=O.cashPoint)||void 0===e?void 0:e.name)||"",W=(null==O?void 0:O.status)||"",Q=(null==O||null===(t=O.patient)||void 0===t?void 0:t.display)||"",$=_((0,r.useState)([]),2),X=$[0],J=$[1],Z=_((0,r.useState)(null),2),ee=Z[0],te=Z[1],ne=_((0,r.useState)(""),2),re=ne[0],le=ne[1],ae=_((0,r.useState)("AMOUNT"),2),ie=ae[0],oe=ae[1],ce=_((0,r.useState)(""),2),ue=ce[0],se=ce[1],me=_((0,r.useState)(""),2),de=me[0],fe=me[1],pe=_((0,r.useState)(null),2),ye=(pe[0],pe[1]),he=_((0,r.useState)(1),2),Ae=(he[0],he[1]),ve=_((0,r.useState)(null),2),be=ve[0],Ee=ve[1],ge=_((0,r.useState)(!1),2),we=ge[0],_e=ge[1],Ce=(Number(ue||0),Number(de||0));(0,r.useEffect)((function(){se(""),fe("")}),[ie]);var Se=function(e){return e.price*e.quantity-(e.paidQuantity||0)*e.price-(e.waivedAmount||0)-(e.claimedAmount||0)},ke=function(e,t,n){J((function(r){return C(r).concat([{id:"".concat(e,"-").concat(r.length+1),type:e,items:t,totalAmount:n,reference:"CASH"===e?re:void 0,timestamp:(new Date).toLocaleString()}])}))},xe=H.length>0&&H.every((function(e){return"SHA"===(e.payerType||"").toUpperCase()})),Ie=H.filter((function(e){return"PENDING"===e.status&&I.includes(e.payerType.toUpperCase())})),Te=Ie.length>0,Ne=H.filter((function(e){return function(e){var t;return I.includes((null!==(t=e.payerType)&&void 0!==t?t:"").toUpperCase())}(e)&&["CLAIMED","PAID"].includes(function(e){var t;return(null!==(t=e.status)&&void 0!==t?t:"").toUpperCase()}(e))})).length>0,Pe=H.filter((function(e){var t;return T.includes((null!==(t=e.payerType)&&void 0!==t?t:"").toUpperCase())})).every((function(e){var t;return"PAID"===(null!==(t=e.status)&&void 0!==t?t:"").toUpperCase()})),De=H.filter((function(e){var t;return e.selected&&T.includes((null!==(t=e.payerType)&&void 0!==t?t:"").toUpperCase())&&"PENDING"===e.status})),Ue=H.reduce((function(e,t){var n,r,l,a,i=(null!==(n=t.payerType)&&void 0!==n?n:"").toString().trim().toUpperCase(),o=(null!==(r=t.status)&&void 0!==r?r:"").toString().trim().toUpperCase(),c=Number(null!==(l=t.quantity)&&void 0!==l?l:0),u=Number(null!==(a=t.price)&&void 0!==a?a:0);return T.includes(i)&&"PAID"===o?e+c*u:e}),0),Be=H.reduce((function(e,t){return e+t.price*t.quantity}),0),Fe=H.reduce((function(e,t){return e+(t.waivedAmount||0)}),0),je=H.reduce((function(e,t){var n,r,l,a=(null!==(n=t.payerType)&&void 0!==n?n:"").toUpperCase(),i=(null!==(r=t.status)&&void 0!==r?r:"").toUpperCase();return!I.includes(a)||"CLAIMED"!==i&&"PAID"!==i?e:e+(null!==(l=t.claimedAmount)&&void 0!==l?l:t.price*t.quantity)}),0),Oe=C(new Set(Ie.map((function(e){return e.payerType})))).join(", "),Le=function(e,t,n){(0,o.showSnackbar)({kind:e,title:t,subtitle:n})},Re=Be-(Ue+je+Fe);(0,r.useEffect)((function(){M((function(e){return 0===e.length?e:e.map((function(e){return xe||"PENDING"===e.status&&"SHA"===e.payerType.toUpperCase()?w(g({},e),{selected:!0}):e}))}))}),[xe]);var He=(null==O||null===(A=O.patient)||void 0===A||null===(a=A.identifiers)||void 0===a||null===(n=a.find((function(e){var t,n;return null===(n=e.identifierType)||void 0===n||null===(t=n.display)||void 0===t?void 0:t.toLowerCase().includes("cr")})))||void 0===n?void 0:n.identifier)||"",Me=(null==O||null===(E=O.cashPoint)||void 0===E||null===(v=E.location)||void 0===v?void 0:v.uuid)||"",qe=function(e){switch(e){case"PAID":return l().createElement(i.vwO,{type:"green"},"Paid (Cash)");case"CLAIMED":return l().createElement(i.vwO,{type:"blue"},"Claimed");case"WAIVED":return l().createElement(i.vwO,{type:"purple"},"Waived");default:return l().createElement(i.vwO,{type:"red"},"Pending")}},Ye=(X.map((function(e){var t,n;return{id:e.id,timestamp:e.timestamp,type:e.type,items:e.items.map((function(e){return e.service})).join(", "),totalAmount:e.totalAmount,reference:null!==(n=null!==(t=e.reference)&&void 0!==t?t:e.claimNumber)&&void 0!==n?n:"-"}})),function(){return 0===Re?"Fully Settled":Re<Be?"Partially Settled":"Unpaid"}),Ke=De.length>0?De[0].payerType:"Payment",Ge=Te&&(xe||Pe)?"RAISE":!Te&&Ne?"STATUS":null,ze="".concat(W).concat(Ye()?" (".concat(Ye(),")"):""),Ve=_((0,r.useState)(!1),2),We=Ve[0],Qe=Ve[1],$e=_((0,r.useState)(!1),2),Xe=$e[0],Je=$e[1],Ze=_((0,r.useState)(!1),2),et=Ze[0],tt=Ze[1];return l().createElement(i.xA9,{fullWidth:!0,style:{padding:"0"}},l().createElement(i.VPZ,{lg:16,style:{marginTop:"1rem"}},l().createElement(i.QpV,{style:{marginBottom:"1rem"}},l().createElement(i.J53,{onClick:D},"Billing Dashboard"),l().createElement(i.J53,{isCurrentPage:!0},Y?l().createElement(i.rrI,{width:"120px"}):z)),l().createElement(i.FAs,{style:{paddingTop:"1rem"}},Y?l().createElement(i.rrI,{width:"200px"}):l().createElement(l().Fragment,null,l().createElement("h5",{style:{marginBottom:"0.5rem"}},Q),He&&Me&&l().createElement(h.A,{crId:He,locationUuid:Me})),l().createElement(i.xA9,{fullWidth:!0},l().createElement(i.VPZ,{sm:4,md:4,lg:4},l().createElement("p",null,l().createElement("strong",null,"Bill No:")," ",Y?l().createElement(i.rrI,{width:"100px"}):z)),l().createElement(i.VPZ,{sm:4,md:4,lg:4},l().createElement("p",null,l().createElement("strong",null,"Cash Point:")," ",Y?l().createElement(i.rrI,{width:"120px"}):V)),l().createElement(i.VPZ,{sm:4,md:4,lg:4},l().createElement("p",null,l().createElement("strong",null,"Bill Date:")," ",Y?l().createElement(i.rrI,{width:"150px"}):N(null==O?void 0:O.dateCreated)))))),l().createElement(i.VPZ,{lg:16},l().createElement("div",{style:{borderTop:"1px solid #e0e0e0",paddingTop:"1rem",marginTop:"1rem",background:"#fff"}},l().createElement(i.xA9,{fullWidth:!0},l().createElement(i.VPZ,{lg:12},l().createElement(i.FAs,null,!Pe&&l().createElement(i.FAs,{style:{background:"#fff5f5",border:"1px solid #f5c2c2",borderRadius:"8px",padding:"1rem",marginBottom:"1rem",width:"100%"}},l().createElement("p",{style:{color:"#da1e28",margin:0,fontSize:"0.9rem",lineHeight:1.5}},"Please select cash/M-Pesa item(s) to continue. SHA claims (if any) will be available after all cash payments are completed.")),l().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"}},l().createElement("h4",null,l().createElement("u",null,"Bill Items")),l().createElement(i.BJc,{orientation:"horizontal",gap:2},De.length>0&&l().createElement(i.$nd,{disabled:Y,renderIcon:c.v0,size:"sm",onClick:function(){return te("CASH")}},"Pay Selected ",Ke," Items"),"RAISE"===Ge&&l().createElement(i.$nd,{disabled:Y||we,size:"sm",kind:"secondary",renderIcon:u.pT,onClick:function(){window.confirm("Raise SHA claim for this bill?\n\nConfirm that all cash items are settled if any and that there are no additional items to add to the claim.")&&te("SHA")}},"Raise SHA Claim"),"STATUS"===Ge&&l().createElement(i.$nd,{disabled:Y||we,size:"sm",kind:"tertiary",renderIcon:s.Ss,onClick:function(){return b((function(){var e;return k(this,(function(t){switch(t.label){case 0:return G?(_e(!0),[4,(0,y.$k)(G)]):[2,(0,o.showSnackbar)({kind:"error",title:"SHA Claim Status",subtitle:"Bill ID is required"})];case 1:return(e=t.sent()).success?(Ee(e.data),te("CHECK_SHA"),_e(!1),[2]):(_e(!1),[2,(0,o.showSnackbar)({kind:"error",title:"SHA Claim Status",subtitle:e.message})])}}))}))()}},we?"Checking Status...":"Check SHA Claim Status"),Re>0&&l().createElement(i.$nd,{disabled:Y,renderIcon:m.NA,size:"sm",kind:"tertiary",onClick:function(){return te("WAIVER")}},"Apply Waiver"),0===Re&&"PENDING"===W&&l().createElement(i.$nd,{size:"sm",kind:"primary",renderIcon:d.cU,onClick:function(){window.confirm("Finalize bill? This action cannot be undone.")&&(K(!0),(0,y.yj)(G).then((function(){return Le("success","Finalize Bill","Bill finalized successfully"),(0,y.Gn)(G)})).then((function(e){var t;L(e);var n=(null==e||null===(t=e.lineItems)||void 0===t?void 0:t.map((function(e){var t;return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:(null===(t=e.paymentStatus)||void 0===t?void 0:t.toUpperCase())||"PENDING"}})))||[];M(n)})).catch((function(e){console.error("Failed to finalize bill",e),Le("error","Finalize Bill","Failed to finalize bill. Please try again.")})).finally((function(){return K(!1)})))}},"Finalize Bill"),0===Re&&"PAID"===W&&l().createElement(i.$nd,{disabled:!0,size:"sm",kind:"tertiary",renderIcon:d.TA,onClick:function(){var e="/billing/print-receipt/".concat(G);window.open(e,"_blank")}},"Print Receipt"))),Y?l().createElement(i.PuA,{style:{height:"300px",width:"100%"}}):l().createElement(i.bQt,{rows:H,headers:x},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){var t,n=H.find((function(t){return t.id===e.id}));return l().createElement(i.Hjg,g({key:n.id},a({row:e})),l().createElement(i.nA6,null,n.service),l().createElement(i.nA6,null,n.payerType),l().createElement(i.nA6,null,n.quantity),l().createElement(i.nA6,null,"Ksh ",n.price),l().createElement(i.nA6,null,"Ksh ",Se(n)),l().createElement(i.nA6,null,"SHA"===n.payerType.toUpperCase()&&"PAID"===n.status.toUpperCase()?qe("CLAIMED"):qe(n.status)),l().createElement(i.nA6,null,l().createElement(i.Sc0,{id:"select-".concat(n.id),labelText:"",checked:!!xe||!!n.selected,disabled:"PENDING"!==n.status||xe||!T.includes((null!==(t=n.payerType)&&void 0!==t?t:"").toUpperCase()),onChange:function(){return e=n.id,M((function(t){return t.map((function(t){return t.id===e?w(g({},t),{selected:!t.selected}):t}))}));var e}})),l().createElement(i.nA6,null,l().createElement(i.obU,{ariaLabel:"Actions",size:"sm",disabled:"PENDING"!==n.status},l().createElement(i.XSD,{itemText:"Edit Quantity",onClick:function(){return ye(e=n),Ae(e.quantity),void te("EDIT_QUANTITY");var e}}),l().createElement(i.XSD,{itemText:"Delete Item",onClick:function(){ye(n),te("CONFIRM_DELETE")}}))))}))))}))),(null==O||null===(S=O.payments)||void 0===S?void 0:S.length)>0&&l().createElement(i.FAs,{style:{marginTop:"1rem"}},l().createElement("h4",{style:{marginBottom:"1rem"}},l().createElement("u",null,"Payment Details")),l().createElement(i.bQt,{rows:O.payments.map((function(e){var t;return{id:e.uuid,type:(null===(t=e.instanceType)||void 0===t?void 0:t.name)||"-",amount:P(e.amount),amountTendered:e.amountTendered?P(e.amountTendered):"-",dateCreated:N(e.dateCreated)}})),headers:[{key:"type",header:"Payment Type"},{key:"amount",header:"Amount"},{key:"amountTendered",header:"Amount Tendered"},{key:"dateCreated",header:"Date / Time"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value||"-")})))}))))})))),l().createElement(i.VPZ,{lg:4},l().createElement(i.FAs,{style:{padding:"1.5rem"}},l().createElement("h4",{style:{marginBottom:"1rem"}},l().createElement("u",null,"Bill Summary")),l().createElement(i.BJc,{gap:3},Y?l().createElement(i.rrI,{width:"100%"}):l().createElement(i.vwO,{type:0===Re?"green":Re<Be?"teal":"red"},0===Re&&l().createElement(f._j,{size:12,style:{marginRight:4}}),Re>0&&Re<Be&&l().createElement(s.Cp,{size:12,style:{marginRight:4}}),Re===Be&&l().createElement(p.GU,{size:12,style:{marginRight:4}}),ze),l().createElement("hr",{style:{border:"none",borderTop:"1px solid #e0e0e0"}}),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{fontWeight:"bold"}},"Total"),l().createElement("strong",null,Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Be).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{color:"#24a148",fontWeight:"bold"}},"Paid"),l().createElement("strong",{style:{color:"#24a148"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Ue).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{color:"#0f62fe",fontWeight:"bold"}},"Claimed"),l().createElement("strong",{style:{color:"#0f62fe"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(je).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{color:"#8a3ffc",fontWeight:"bold"}},"Waived"),l().createElement("strong",{style:{color:"#8a3ffc"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Fe).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("hr",{style:{border:"none",borderTop:"1px solid #e0e0e0"}}),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{fontWeight:"bold"}},"Balance"),l().createElement("strong",{style:{color:Re>0?"#da1e28":"#24a148",fontSize:"1.1rem"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Re).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))))))))),l().createElement(i.aFV,{open:"CASH"===ee,modalHeading:"Confirm Payment for ".concat(Ke," Items"),primaryButtonText:We?"Processing...":"Submit",secondaryButtonText:"Cancel",primaryButtonDisabled:We,onRequestClose:function(){return te(null)},onRequestSubmit:function(){return b((function(){var e,t,n,r,l,a,i,o,c,u,s,m,d,f,p;return k(this,(function(h){switch(h.label){case 0:if(!re.trim())return[2,Le("error","Cash Payment","Payment reference required")];0===De.length&&Le("error","Cash Payment","No items selected"),h.label=1;case 1:return h.trys.push([1,6,,7]),Qe(!0),[4,(0,y.x_)()];case 2:return l=h.sent(),a=null===(t=De[0])||void 0===t||null===(e=t.payerType)||void 0===e?void 0:e.toUpperCase(),(i=l.results.find((function(e){var t;return(null!==(t=e.name)&&void 0!==t?t:"").toUpperCase()===a})))?(o=i.uuid,De.length>0&&(null===(n=De[0])||void 0===n||n.payerType),c={instanceType:o,amount:De.reduce((function(e,t){return e+Se(t)}),0),amountTendered:De.reduce((function(e,t){return e+Se(t)}),0)},[4,(0,y.wh)(G,c)]):(Qe(!1),Le("error",a||"Payment","".concat(a||"Selected"," payment mode not found")),[2]);case 3:return h.sent().ok?(u={billUuid:G,cashModeUuid:o,billItemsUuid:De.map((function(e){return e.id}))},[4,(0,y.wH)(u)]):(Qe(!1),Le("error","Cash Payment","Payment processing failed"),[2]);case 4:return(null==(s=h.sent())?void 0:s.success)?(Le("success","Cash Payment","Payment processed successfully"),[4,(0,y.Gn)(G)]):(Qe(!1),Le("error","Cash Payment",null!==(m=null==s?void 0:s.message)&&void 0!==m?m:"Status update failed"),[2]);case 5:return d=h.sent(),L(d),f=(null==d||null===(r=d.lineItems)||void 0===r?void 0:r.map((function(e){return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:e.paymentStatus&&e.paymentStatus.toUpperCase()||"CASH"}})))||[],M(f),ke("CASH",De,c.amountTendered),le(""),te(null),Qe(!1),[3,7];case 6:return p=h.sent(),console.error("Payment failed",p),Qe(!1),Le("error","Cash Payment","Payment failed. Please try again."),[3,7];case 7:return[2]}}))}))()}},l().createElement("div",{style:{marginBottom:"1rem"}},l().createElement(i.ksK,{id:"cash-payment-ref",labelText:"Payment Reference",value:re,onChange:function(e){return le(e.target.value)}})),l().createElement("ul",null,De.map((function(e){return l().createElement("li",{key:e.id,style:{marginBottom:"0.5rem"}},e.service," - Ksh ",Se(e))}))),l().createElement("p",{style:{marginTop:"1rem"}},l().createElement("strong",null,"Total: Ksh ",De.reduce((function(e,t){return e+Se(t)}),0)))),l().createElement(i.aFV,{open:"WAIVER"===ee,modalHeading:"Apply Waiver",primaryButtonText:Xe?"Applying...":"Submit",secondaryButtonText:"Cancel",primaryButtonDisabled:Xe||("PERCENT"===ie?""===ue||Number(ue)<1||Number(ue)>100:""===de||Number(de)<1),onRequestClose:function(){return te(null)},onRequestSubmit:function(){return b((function(){var e,t,n,r,l,a,i,o;return k(this,(function(c){switch(c.label){case 0:return[2,Le("error","Waiver Application","Waiver functionality is currently unavailable. Please contact support.")];case 1:return n=c.sent(),(r=n.results.find((function(e){return"waiver"===e.name.toLowerCase()})))||Le("error","Waiver Application","Waiver payment mode not found. Please contact support."),l=r.uuid,a={instanceType:l,amount:t,amountTendered:t},[4,(0,y.wh)(G,a)];case 2:return c.sent().ok||Le("error","Waiver Application","Failed to apply waiver. Please try again or contact support."),Le("success","Waiver Application","Waiver applied successfully"),[4,(0,y.Gn)(G)];case 3:return i=c.sent(),L(i),o=(null==i||null===(e=i.lineItems)||void 0===e?void 0:e.map((function(e){return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:e.paymentStatus&&e.paymentStatus.toUpperCase()||"CASH"}})))||[],M(o),ke("WAIVER",H.filter((function(e){return e.waiverAllowed})),Ce),fe(""),se(""),te(null),Je(!1),[2]}}))}))()}},l().createElement("div",{style:{marginBottom:"1rem"}},l().createElement("label",{htmlFor:"waiver-type-amount"},l().createElement("input",{type:"radio",id:"waiver-type-amount",name:"waiver-type",value:"AMOUNT",checked:"AMOUNT"===ie,onChange:function(){return oe("AMOUNT")}})," ","Amount"),l().createElement("label",{htmlFor:"waiver-type-percent",style:{marginLeft:"1rem"}},l().createElement("input",{type:"radio",id:"waiver-type-percent",name:"waiver-type",value:"PERCENT",checked:"PERCENT"===ie,onChange:function(){return oe("PERCENT")}})," ","Percentage")),"PERCENT"===ie?l().createElement(i.Q7x,{id:"waiver-percent",label:"Waiver Percentage",min:0,max:100,value:ue,invalid:""!==ue&&(Number(ue)<1||Number(ue)>100),invalidText:"Percentage must be between 1 and 100",onChange:function(e,t){return se(String(t.value))}}):l().createElement(i.Q7x,{id:"waiver-amount",label:"Waiver Amount",min:0,value:de,invalid:""!==de&&Number(de)<1,invalidText:"Amount cannot be less than 1",onChange:function(e,t){return fe(String(t.value))}})),l().createElement(i.aFV,{open:"SHA"===ee,modalHeading:"Confirm ".concat(Oe," Claim"),primaryButtonText:et?"Submitting...":"Submit Claim",secondaryButtonText:"Cancel",primaryButtonDisabled:et,onRequestClose:function(){return te(null)},onRequestSubmit:function(){return b((function(){var e,t,n,r,l,a,i,o,c,u,s;return k(this,(function(m){switch(m.label){case 0:return m.trys.push([0,7,8,9]),tt(!0),[4,(0,y.x_)()];case 1:return t=m.sent(),(n=t.results.find((function(e){return I.includes(e.name.toUpperCase())})))?[4,(0,y.$k)(G)]:(Le("error","SHA Claim","SHA payment mode not found. Please contact support."),tt(!1),[2]);case 2:return r=m.sent(),l=!1,r.success&&r.data&&(l=!0),l?[3,4]:[4,(0,y.tA)(G)];case 3:if(!(a=m.sent()).success)return Le("error","SHA Claim",a.message||"Failed to raise SHA claim."),tt(!1),[2];m.label=4;case 4:return i=Ie.reduce((function(e,t){return e+Se(t)}),0),o={instanceType:n.uuid,amount:i,amountTendered:i},[4,(0,y.wh)(G,o)];case 5:return m.sent().ok?[4,(0,y.Gn)(G)]:(Le("error","SHA Claim","Payment failed after claim creation."),tt(!1),[2]);case 6:return c=m.sent(),L(c),u=(null==c||null===(e=c.lineItems)||void 0===e?void 0:e.map((function(e){var t;return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:(null===(t=e.paymentStatus)||void 0===t?void 0:t.toUpperCase())||"PENDING"}})))||[],M(u),ke("SHA",Ie,i),Le("success","SHA Claim","SHA claim processed successfully"),te(null),[3,9];case 7:return s=m.sent(),console.error("SHA claim flow failed",s),Le("error","SHA Claim","Unexpected error while processing SHA claim."),[3,9];case 8:return tt(!1),[7];case 9:return[2]}}))}))()}},l().createElement(i.BJc,{gap:4},l().createElement(i.FAs,null,l().createElement("p",{style:{marginBottom:"0.5rem"}},"You are about to submit the following items for ",l().createElement("strong",null,Oe," claim"),"."),l().createElement("p",{style:{color:"#6f6f6f",marginBottom:0}},"Please confirm all services are correct before proceeding.")),l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"1rem"}},"Claim Items"),l().createElement(i.bQt,{rows:Ie.map((function(e){return{id:e.id,service:e.service,quantity:e.quantity,unitPrice:"Ksh ".concat(Number(e.price).toLocaleString()),total:"Ksh ".concat(Se(e).toLocaleString())}})),headers:[{key:"service",header:"Service"},{key:"quantity",header:"Qty"},{key:"unitPrice",header:"Unit Price"},{key:"total",header:"Total"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,{size:"sm",useZebraStyles:!0},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value)})))}))))}))),l().createElement(i.FAs,null,l().createElement(i.xA9,{fullWidth:!0},l().createElement(i.VPZ,{lg:8},l().createElement("p",null,l().createElement("strong",null,"Items:")," ",Ie.length)),l().createElement(i.VPZ,{lg:8,style:{textAlign:"right"}},l().createElement("p",{style:{fontSize:"1.1rem",fontWeight:600}},"Total: Ksh ",Ie.reduce((function(e,t){return e+Se(t)}),0).toLocaleString())))))),l().createElement(i.aFV,{open:"CHECK_SHA"===ee,modalHeading:"SHA Claim Status",primaryButtonText:"Close",secondaryButtonText:null,onRequestClose:function(){return te(null)},onRequestSubmit:function(){return te(null)}},be?l().createElement(i.BJc,{gap:4},l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"0.5rem"}},"Patient Information"),l().createElement("p",null,l().createElement("strong",null,"Name:")," ",be.patientFullName),l().createElement("p",null,l().createElement("strong",null,"Gender:")," ",be.gender),l().createElement("h5",{style:{marginTop:"1rem",marginBottom:"0.5rem"}},"Facility"),l().createElement("p",null,be.facilityName," (",be.facilityLevel,")")),l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"0.5rem"}},"Claim Details"),l().createElement("p",null,l().createElement("strong",null,"Status:")," ",l().createElement(i.vwO,{type:function(e){var t=(null==e?void 0:e.toLowerCase())||"";return t.includes("approved")||t.includes("paid")?"green":t.includes("pending")?"warm-gray":t.includes("rejected")||t.includes("failed")?"red":"cool-gray"}(be.claim_Status)},be.claim_Status)),l().createElement("p",null,l().createElement("strong",null,"Response:")," ",be.claim_Response||"-")),(null===(U=be.services)||void 0===U?void 0:U.length)>0&&l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"1rem"}},"Services"),l().createElement(i.bQt,{rows:be.services.map((function(e){return{id:e.serviceCode,name:e.serviceDisplay,code:e.serviceCode,quantity:e.quantity,amount:"Ksh ".concat(Number(e.totalAmount).toLocaleString())}})),headers:[{key:"name",header:"Service"},{key:"code",header:"Code"},{key:"quantity",header:"Qty"},{key:"amount",header:"Total Amount"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,{size:"sm"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value)})))}))))}))),(null===(B=be.diagnoses)||void 0===B?void 0:B.length)>0&&l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"1rem"}},"Diagnoses"),l().createElement(i.bQt,{rows:be.diagnoses.map((function(e,t){return{id:"".concat(e.Code,"-").concat(t),name:e.Display,code:e.Code}})),headers:[{key:"name",header:"Diagnosis"},{key:"code",header:"Code"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,{size:"sm"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value)})))}))))})))):l().createElement(i.FAs,null,l().createElement("p",null,"No claim data available."))))};var B=n(85072),F=n.n(B),j=n(97825),O=n.n(j),L=n(77659),R=n.n(L),H=n(55056),M=n.n(H),q=n(10540),Y=n.n(q),K=n(41113),G=n.n(K),z=n(73637),V={};V.styleTagTransform=G(),V.setAttributes=M(),V.insert=R().bind(null,"head"),V.domAPI=O(),V.insertStyleElement=Y(),F()(z.A,V);const W=z.A&&z.A.locals?z.A.locals:void 0;var Q=function(e){return e.Bills="BILLS",e.BillDetails="Details",e}({}),$=function(e){return e.WrongPatient="WRONG_PATIENT",e.NoServiceGiven="NO_SERVICE_GIVEN",e.WringBenefit="WRONG_BENEFIT",e.ExpiredVisit="EXPIRED_VISIT",e.ExhaustedBenefit="EXHAUSTED_BENEFIT",e.TimeBarred="TIME_BARRED",e.OtherReasons="OTHER_REASONS",e}({}),X=n(62801),J=n(23492);function Z(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Z(a,r,l,i,o,"next",e)}function o(e){Z(a,r,l,i,o,"throw",e)}i(void 0)}))}}function te(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function ne(e){return ee((function(){var t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n="".concat(t,"/claim-preview/provider"),[4,(0,o.openmrsFetch)(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))()}function re(e){return ee((function(){var t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n="".concat(t,"/claim-line"),[4,(0,o.openmrsFetch)(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))()}function le(e){return ee((function(){var t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n="".concat(t,"/claim-diagnosis"),[4,(0,o.openmrsFetch)(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))()}var ae=n(36350),ie={};ie.styleTagTransform=G(),ie.setAttributes=M(),ie.insert=R().bind(null,"head"),ie.domAPI=O(),ie.insertStyleElement=Y(),F()(ae.A,ie);const oe=ae.A&&ae.A.locals?ae.A.locals:void 0;var ce=n(86375),ue={};ue.styleTagTransform=G(),ue.setAttributes=M(),ue.insert=R().bind(null,"head"),ue.domAPI=O(),ue.insertStyleElement=Y(),F()(ce.A,ue);const se=ce.A&&ce.A.locals?ce.A.locals:void 0;var me=n(91558),de=n(64870),fe={};fe.styleTagTransform=G(),fe.setAttributes=M(),fe.insert=R().bind(null,"head"),fe.domAPI=O(),fe.insertStyleElement=Y(),F()(de.A,fe);const pe=de.A&&de.A.locals?de.A.locals:void 0;var ye=n(61240),he={};he.styleTagTransform=G(),he.setAttributes=M(),he.insert=R().bind(null,"head"),he.domAPI=O(),he.insertStyleElement=Y(),F()(ye.A,he);const Ae=ye.A&&ye.A.locals?ye.A.locals:void 0;var ve=n(83983);function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ee(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function ge(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Ee(a,r,l,i,o,"next",e)}function o(e){Ee(a,r,l,i,o,"throw",e)}i(void 0)}))}}function we(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?be(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _e(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const Ce=function(e){var t=e.open,n=e.onClose,a=e.onPay,c=e.billItem,u=we((0,r.useState)(0),2),s=u[0],m=u[1],d=we((0,r.useState)([]),2),f=d[0],p=d[1],y=(0,r.useMemo)((function(){return f.find((function(e){return e.name===c.payment_scheme}))}),[f,c]),h=we((0,r.useState)(""),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){c&&ge((function(){var e;return _e(this,(function(t){switch(t.label){case 0:return[4,(0,ve.x_)()];case 1:return e=t.sent(),p(e),[2]}}))}))()}),[c]),l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Bill Item Payment",open:t,size:"sm",onSecondarySubmit:n,onRequestClose:n,onRequestSubmit:function(){return ge((function(){var e;return _e(this,(function(t){switch(t.label){case 0:e={instanceType:y?null!==(n=y.uuid)&&void 0!==n?n:"":null!=A?A:"",amountTendered:s,amount:c.item_total_price},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(r=c.bill_uuid,l=e,ee((function(){var e,t;return te(this,(function(n){switch(n.label){case 0:return e="".concat(o.restBaseUrl,"/billing/bill/").concat(r,"/payment"),[4,(0,o.openmrsFetch)(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})];case 1:return[4,n.sent().json()];case 2:return[2,null!=(t=n.sent())?t:null]}}))}))())];case 2:return t.sent()&&((0,o.showSnackbar)({kind:"success",title:"Bill item payment succesfully made",subtitle:""}),a()),[3,4];case 3:return t.sent(),(0,o.showSnackbar)({kind:"error",title:"An error occurred while making bill item payment",subtitle:"An error occurred while making bill item payment, please try again or contact support"}),[3,4];case 4:return[2]}var n,r,l}))}))()},primaryButtonText:"Pay",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:Ae.biModalLayout},l().createElement("div",{className:Ae.biRow},l().createElement(i.ksK,{id:"bill-item",labelText:"Billable Item",value:"".concat(c.billable_service),readOnly:!0})),l().createElement("div",{className:Ae.biRow},l().createElement(i.ksK,{id:"bill-item-amount",labelText:"Amount",value:"Ksh ".concat(c.item_total_price),readOnly:!0})),l().createElement("div",{className:Ae.biRow},y?l().createElement(l().Fragment,null,l().createElement(i.ksK,{id:"insurance-scheme",labelText:"Payment Mode",value:null==y?void 0:y.name,readOnly:!0})):l().createElement(l().Fragment,null,l().createElement(i.l6P,{id:"cash-point",labelText:"Cash Point",onChange:function(e){return t=e.target.value,void v(t);var t}},l().createElement(i.ebT,{value:"",text:"Select"}),";",f&&f.map((function(e){return l().createElement(i.ebT,{value:e.uuid,text:e.name})}))))),l().createElement("div",{className:Ae.biRow},l().createElement(i.ksK,{id:"insurance-scheme",labelText:"Pay Amount",type:"number",onChange:function(e){return t=parseInt(e.target.value),void m(t);var t}}))))))};var Se=n(5876),ke={};ke.styleTagTransform=G(),ke.setAttributes=M(),ke.insert=R().bind(null,"head"),ke.domAPI=O(),ke.insertStyleElement=Y(),F()(Se.A,ke);const xe=Se.A&&Se.A.locals?Se.A.locals:void 0;function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Te(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}const Ne=function(e){var t,n,a=e.open,c=e.onClose,u=e.onSuccess,s=e.billItem,m=e.locationUuid,d=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=d[0],p=d[1];return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Add Claim Line",open:a,size:"md",onSecondarySubmit:c,onRequestClose:c,onRequestSubmit:f?function(){}:function(){return(e=function(){var e,t,n,r;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(l){switch(l.label){case 0:p(!0),e={consentToken:s.consent_token,interventionCode:s.intervention_code,unitPrice:String(s.item_price),quantity:String(s.item_quantity),locationUuid:m},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,re(e)];case 2:return(t=l.sent()).error?((0,o.showSnackbar)({title:null!==(n=t.error)&&void 0!==n?n:"Error Adding Claim Line",kind:"error",subtitle:null!==(r=t.message)&&void 0!==r?r:"An error occurred while adding the claim line. Kindy retry or contact support"}),u()):(0,o.showSnackbar)({title:"Sucess Adding Claim Line",kind:"success",subtitle:"Claim Item added successfully"}),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error Adding Claim Line",subtitle:"An error occurred while adding the claim line. Kindy retry or contact support"}),[3,5];case 4:return p(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Te(a,r,l,i,o,"next",e)}function o(e){Te(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:f?"Adding...":"Add",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:xe.addClaimLineModalLayout},l().createElement("div",{className:xe.addClaimLineModalRow},l().createElement(i.ksK,{id:"bill-item",labelText:"Intervention Code",value:s.intervention_code,readOnly:!0})),l().createElement("div",{className:xe.addClaimLineModalRow},l().createElement(i.ksK,{id:"bill-item-amount",labelText:"Unit Price",value:"Ksh ".concat(s.item_price),readOnly:!0})),l().createElement("div",{className:xe.addClaimLineModalRow},l().createElement(i.ksK,{id:"bill-item-amount",labelText:"Quantity",value:s.item_quantity,readOnly:!0}))))))};var Pe=n(70328),De={};De.styleTagTransform=G(),De.setAttributes=M(),De.insert=R().bind(null,"head"),De.domAPI=O(),De.insertStyleElement=Y(),F()(Pe.A,De);const Ue=Pe.A&&Pe.A.locals?Pe.A.locals:void 0;function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fe(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}const je=function(e){var t,n,a=e.open,c=e.onClose,u=e.onSuccess,s=e.amrsVisitDiagnosis,m=e.interventionCode,d=e.consentToken,f=e.locationUuid,p=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Be(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=p[0],h=p[1];return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Add Claim Diagnosis",open:a,size:"md",onSecondarySubmit:c,onRequestClose:c,onRequestSubmit:y?function(){}:function(){return(e=function(){var e,t,n,r;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(l){switch(l.label){case 0:h(!0),e={consentToken:d,interventionCode:m,locationUuid:f,icdCode:s.icd11_code},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,le(e)];case 2:return(t=l.sent()).error?((0,o.showSnackbar)({title:null!==(n=t.error)&&void 0!==n?n:"Error Adding Claim Diagnosis",kind:"error",subtitle:null!==(r=t.message)&&void 0!==r?r:"An error occurred while adding the claim disgnosis. Kindy retry or contact support"}),u()):(0,o.showSnackbar)({title:"Sucess Adding Claim Diagnosis",kind:"success",subtitle:"Claim Item added successfully"}),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error Adding Claim Diagnosis",subtitle:"An error occurred while adding the Claim Diagnosis. Kindy retry or contact support"}),[3,5];case 4:return h(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Fe(a,r,l,i,o,"next",e)}function o(e){Fe(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:y?"Adding...":"Add",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:Ue.addClaimDiagnosisModalLayout},l().createElement("div",{className:Ue.addClaimDiagnosisModalRow},l().createElement(i.ksK,{id:"intervention-code",labelText:"Intervention Code",value:m,readOnly:!0})),l().createElement("div",{className:Ue.addClaimDiagnosisModalRow},l().createElement(i.ksK,{id:"icd11Code",labelText:"ICD11 Diagnosis",value:s.icd11_code,readOnly:!0}))))))};function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oe(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Re=function(e){var t=e.amrsVisitDiagnosis,n=e.consentToken,a=e.interventionCode,c=e.locationUuid,u=function(){y(!1)},s=Le((0,r.useState)(null),2),m=s[0],d=s[1],f=Le((0,r.useState)(!1),2),p=f[0],y=f[1];return l().createElement(l().Fragment,null,l().createElement("div",null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Encounter Date"),l().createElement(i.A0N,null,"Encounter Type"),l().createElement(i.A0N,null,"ICD11 Diagnosis"),l().createElement(i.A0N,null,"Actions"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.encounter_id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.encounter_datetime))),l().createElement(i.nA6,null,e.encounter_type),l().createElement(i.nA6,null,e.icd11_code),l().createElement(i.nA6,null,l().createElement(i.obU,{"aria-label":"overflow-menu"},l().createElement(i.XSD,{itemText:"Add Claim Diagnosis",onClick:function(){return function(e){d(e),y(!0)}(e)}})))))})))),p&&m&&l().createElement(je,{consentToken:n,amrsVisitDiagnosis:m,locationUuid:c,interventionCode:a,open:p,onClose:u,onSuccess:u})))};function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Me(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return He(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?He(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const qe=function(e){var t=e.patientBillDetails,n=e.patientPayments,a=e.amrsVisitDiagnosis,c=e.consentToken,u=e.locationUuid,s=function(){p(!1)},m=function(){A(!1)},d=Me((0,r.useState)(!1),2),f=d[0],p=d[1],y=Me((0,r.useState)(!1),2),h=y[0],A=y[1],v=Me((0,r.useState)(null),2),b=v[0],E=v[1],g=(0,r.useMemo)((function(){return function(){if(!t||0===t.length)return"";var e,n=t.find((function(e){return e.billable_service.toLocaleLowerCase().trim().includes("consultation")}));return n?n.intervention_code:null!==(e=t[0].intervention_code)&&void 0!==e?e:""}()}),[t]);return t||n?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billDetailsLayout},t.length>0?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billRow},l().createElement("div",null,l().createElement("h6",null,"Bill Items")),l().createElement("div",null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Bill Item"),l().createElement(i.A0N,null,"Intervention Code"),l().createElement(i.A0N,null,"Order No"),l().createElement(i.A0N,null,"Service Type"),l().createElement(i.A0N,null,"Payer"),l().createElement(i.A0N,null,"Quantity"),l().createElement(i.A0N,null,"Total"),l().createElement(i.A0N,null,"Actions"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){var n,r,a;return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.patient_uuid},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.billable_service),l().createElement(i.nA6,null,null!==(n=e.intervention_code)&&void 0!==n?n:""),l().createElement(i.nA6,null,null!==(r=e.order_no)&&void 0!==r?r:""),l().createElement(i.nA6,null,null!==(a=e.service_type)&&void 0!==a?a:""),l().createElement(i.nA6,null,e.payment_scheme),l().createElement(i.nA6,null,e.item_quantity),l().createElement(i.nA6,null,"Ksh ",e.item_total_price),l().createElement(i.nA6,null,l().createElement(i.obU,{"aria-label":"overflow-menu"},l().createElement(i.XSD,{itemText:"Pay",onClick:function(){return E(e),void p(!0)}}),e.intervention_code&&l().createElement(i.XSD,{itemText:"Add Claim Line",onClick:function(){return E(e),void A(!0)}})))))}))))))):l().createElement(l().Fragment,null),n.length>0?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billRow},l().createElement("div",null,l().createElement("h6",null,"Bill Payments")),l().createElement("div",null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Payment Type"),l().createElement(i.A0N,null,"Amount"),l().createElement(i.A0N,null,"Amount Tendered"),l().createElement(i.A0N,null,"Date / Time"))),l().createElement(i.BFY,null,n&&n.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.cashier_bill_payment_uuid},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.payment_mode),l().createElement(i.nA6,null,"Ksh ",e.amount),l().createElement(i.nA6,null,"Ksh ",e.amount_tendered),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.payment_time)))))}))))))):l().createElement(l().Fragment,null),a.length>0?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billRow},l().createElement("div",null,l().createElement("h6",null,"Patient Dignosis")),l().createElement("div",null,l().createElement(Re,{amrsVisitDiagnosis:a,consentToken:c,locationUuid:u,interventionCode:g})))):l().createElement(l().Fragment,null),f&&b&&l().createElement(Ce,{open:f,billItem:b,onClose:s,onPay:function(){s()}}),h&&b&&l().createElement(Ne,{open:h,billItem:b,onClose:m,onSuccess:m,locationUuid:u}))):l().createElement(l().Fragment,null,"No Data")};var Ye=n(42737),Ke={};Ke.styleTagTransform=G(),Ke.setAttributes=M(),Ke.insert=R().bind(null,"head"),Ke.domAPI=O(),Ke.insertStyleElement=Y(),F()(Ye.A,Ke);const Ge=Ye.A&&Ye.A.locals?Ye.A.locals:void 0;var ze=n(3028),Ve={};Ve.styleTagTransform=G(),Ve.setAttributes=M(),Ve.insert=R().bind(null,"head"),Ve.domAPI=O(),Ve.insertStyleElement=Y(),F()(ze.A,Ve);const We=ze.A&&ze.A.locals?ze.A.locals:void 0;var Qe=n(47708),$e={};$e.styleTagTransform=G(),$e.setAttributes=M(),$e.insert=R().bind(null,"head"),$e.domAPI=O(),$e.insertStyleElement=Y(),F()(Qe.A,$e);const Xe=Qe.A&&Qe.A.locals?Qe.A.locals:void 0;function Je(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function Ze(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Je(a,r,l,i,o,"next",e)}function o(e){Je(a,r,l,i,o,"throw",e)}i(void 0)}))}}function et(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const tt=function(e){var t=e.claimInvoiceLines,n=e.consentToken,r=(0,o.useSession)();return l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Item Code"),l().createElement(i.A0N,null,"Item Name"),l().createElement(i.A0N,null,"Intervention Code"),l().createElement(i.A0N,null,"Line Total Amount"),l().createElement(i.A0N,null,"Line Net Amount"),l().createElement(i.A0N,null,"Quantity"),l().createElement(i.A0N,null,"Unit"),l().createElement(i.A0N,null,"Unit Price"),l().createElement(i.A0N,null,"Is Active"),l().createElement(i.A0N,null,"Is Cancellation"),l().createElement(i.A0N,null,"Is Return"),l().createElement(i.A0N,null,"UHC Exceeded"),l().createElement(i.A0N,null,"Charge Date"),l().createElement(i.A0N,null,"Is Return"),l().createElement(i.A0N,null,"Line Number"),l().createElement(i.A0N,null,"Scheme Code"),l().createElement(i.A0N,null,"Scheme Name"),l().createElement(i.A0N,null,"Discount"),l().createElement(i.A0N,null,"Action"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.item_code),l().createElement(i.nA6,null,e.item_name),l().createElement(i.nA6,null,e.intervention_code),l().createElement(i.nA6,null,e.line_total_amount),l().createElement(i.nA6,null,e.line_net_amount),l().createElement(i.nA6,null,e.quantity),l().createElement(i.nA6,null,e.unit),l().createElement(i.nA6,null,e.unit_price),l().createElement(i.nA6,null,e.is_active),l().createElement(i.nA6,null,e.is_cancellation),l().createElement(i.nA6,null,e.is_return),l().createElement(i.nA6,null,e.uhc_exceeded),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.charge_date))),l().createElement(i.nA6,null,e.is_return),l().createElement(i.nA6,null,e.line_number),l().createElement(i.nA6,null,e.scheme_code),l().createElement(i.nA6,null,e.scheme_name),l().createElement(i.nA6,null,e.discount),l().createElement(i.nA6,null,l().createElement(i.$nd,{hasIconOnly:!0,iconDescription:"Remove claim line",size:"sm",kind:"danger",onClick:function(){return Ze((function(){return et(this,(function(t){switch(t.label){case 0:return[4,(l=e,Ze((function(){var e,t;return et(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,(i={consentToken:n,lineGuid:l.id,locationUuid:null==r||null===(e=r.sessionLocation)||void 0===e?void 0:e.uuid},ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return e=l.sent().hieBaseUrl,t="".concat(e,"/claim-line"),[4,(0,o.openmrsFetch)(t,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify(i)}).catch((function(e){var t,n,r,l=null!==(n=null==e||null===(t=e.responseBody)||void 0===t?void 0:t.message)&&void 0!==n?n:"";if("object"==(void 0===l?"undefined":(r=l)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r))throw"".concat(null==l?void 0:l.join(","));throw l}))];case 2:if((null==(n=l.sent())?void 0:n.data)&&"error"in n.data&&"message"in n.data)throw null!==(r=n.data.message)&&void 0!==r?r:"";return[2,null==n?void 0:n.data]}}))}))())];case 1:return a.sent(),(0,o.showSnackbar)({title:"Success removing claim line",subtitle:"Claim line removed successfully",kind:"success"}),[3,3];case 2:return t=a.sent(),(0,o.showSnackbar)({title:"Error removing claim line",subtitle:t,kind:"error"}),[3,3];case 3:return[2]}var i}))}))())];case 1:return[2,t.sent()]}var l}))}))()},renderIcon:function(){return l().createElement(f.G$,null)}}))))})))))};var nt=n(62748),rt={};rt.styleTagTransform=G(),rt.setAttributes=M(),rt.insert=R().bind(null,"head"),rt.domAPI=O(),rt.insertStyleElement=Y(),F()(nt.A,rt);const lt=nt.A&&nt.A.locals?nt.A.locals:void 0,at=function(e){var t=e.open,n=e.handleClose,r=e.claimInvoiceLines,a=e.consentToken;return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Invoice Line Details",open:t,size:"lg",onSecondarySubmit:function(){},onRequestClose:n,onRequestSubmit:function(){},primaryButtonText:"",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:lt.claimInvoiceLinesModalLayout},l().createElement(tt,{claimInvoiceLines:r,consentToken:a})))))};function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ot(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return it(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?it(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const ct=function(e){var t=e.claimInvoices,n=e.consentToken,a=ot((0,r.useState)(),2),c=a[0],u=a[1],s=ot((0,r.useState)([]),2),m=s[0],d=s[1];return t&&0!==t.length?l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Invoice No"),l().createElement(i.A0N,null,"Date"),l().createElement(i.A0N,null,"Dispatch Status"),l().createElement(i.A0N,null,"State"),l().createElement(i.A0N,null,"Patient"),l().createElement(i.A0N,null,"Provider"),l().createElement(i.A0N,null,"Lines"),l().createElement(i.A0N,null,"Scheme"),l().createElement(i.A0N,null,"Service Type"),l().createElement(i.A0N,null,"Amount"),l().createElement(i.A0N,null,"Net"),l().createElement(i.A0N,null,"Co-Pay"),l().createElement(i.A0N,null,"Discount"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.invoice_number),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.invoice_date))),l().createElement(i.nA6,null,e.dispatch_status),l().createElement(i.nA6,null,e.workflow_state),l().createElement(i.nA6,null,e.patient_name),l().createElement(i.nA6,null,e.provider_name),l().createElement(i.nA6,null,l().createElement("div",{className:Xe.linkBtn,onClick:function(){return t=e.lines,d(t),void u(!0);var t}},e.lines.length)),l().createElement(i.nA6,null,e.scheme_code),l().createElement(i.nA6,null,e.service_type),l().createElement(i.nA6,null,e.total_inv_amount),l().createElement(i.nA6,null,e.total_inv_net_amount),l().createElement(i.nA6,null,e.total_inv_copay),l().createElement(i.nA6,null,e.total_inv_discount)))})))),c&&l().createElement(at,{claimInvoiceLines:m,consentToken:n,open:c,handleClose:function(){u(!1)}})):l().createElement(l().Fragment,null,"No Invoice data")},ut=function(e){var t=e.claimInterventions,n=function(e){return e?"YES":"NO"};return t&&0!==t.length?l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Code"),l().createElement(i.A0N,null,"Payment Mechanism"),l().createElement(i.A0N,null,"Name"),l().createElement(i.A0N,null,"Keph Level Tarrif"),l().createElement(i.A0N,null,"Accrued Per Diem"),l().createElement(i.A0N,null,"Accrued Per Diem Days"),l().createElement(i.A0N,null,"State"),l().createElement(i.A0N,null,"Scheme"),l().createElement(i.A0N,null,"Sub Benefit Code"),l().createElement(i.A0N,null,"Active For UHC"),l().createElement(i.A0N,null,"Fund"),l().createElement(i.A0N,null,"Surgical Preauth"),l().createElement(i.A0N,null,"Renal Preauth"),l().createElement(i.A0N,null,"Oncology Preauth"),l().createElement(i.A0N,null,"Radiology Preauth"),l().createElement(i.A0N,null,"Optical Preauth"),l().createElement(i.A0N,null,"Needs Preauth"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.intervention_code),l().createElement(i.nA6,null,e.intervention_payment_mechanism),l().createElement(i.nA6,null,e.intervention_name),l().createElement(i.nA6,null,e.keph_level_tarrif),l().createElement(i.nA6,null,e.accrued_per_diem_amount),l().createElement(i.nA6,null,e.accrued_per_diem_days),l().createElement(i.nA6,null,e.workflow_state),l().createElement(i.nA6,null,e.supported_scheme),l().createElement(i.nA6,null,e.sub_benefit_code),l().createElement(i.nA6,null,e.active_for_uhc),l().createElement(i.nA6,null,e.intervention_fund),l().createElement(i.nA6,null,n(e.requires_surgical_preauth)),l().createElement(i.nA6,null,n(e.requires_renal_preauth)),l().createElement(i.nA6,null,n(e.requires_oncology_preauth)),l().createElement(i.nA6,null,n(e.requires_radiology_preauth)),l().createElement(i.nA6,null,n(e.requires_optical_preauth)),l().createElement(i.nA6,null,n(e.needs_preauth))))}))))):l().createElement(l().Fragment,null,"No Intervention data")},st=function(e){var t=e.claimDiagnosiss;return t&&0!==t.length?l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Recorded On"),l().createElement(i.A0N,null,"Diagnosis Name"),l().createElement(i.A0N,null,"Diagnosis Code"),l().createElement(i.A0N,null,"Intervention Code"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.claim},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.recorded_on))),l().createElement(i.nA6,null,e.diagnosis_name),l().createElement(i.nA6,null,e.diagnosis_code),l().createElement(i.nA6,null,e.intervention_code)))}))))):l().createElement(l().Fragment,null,"No Diagnosis data")};var mt=n(95636),dt={};dt.styleTagTransform=G(),dt.setAttributes=M(),dt.insert=R().bind(null,"head"),dt.domAPI=O(),dt.insertStyleElement=Y(),F()(mt.A,dt);const ft=mt.A&&mt.A.locals?mt.A.locals:void 0;function pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function ht(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const At=function(e){var t=e.open,n=e.onClose,a=e.onSuccess,c=e.locationUuid,u=e.consentToken,s=ht((0,r.useState)(!1),2),m=s[0],d=s[1],f=ht((0,r.useState)(""),2),p=f[0],y=f[1],h=ht((0,r.useState)(""),2),A=h[0],v=h[1],b=Object.values($);return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Close Claim",open:t,size:"md",onSecondarySubmit:n,onRequestClose:n,onRequestSubmit:m?function(){}:function(){return(e=function(){var e;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(t){switch(t.label){case 0:d(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),function(e){return e.cancelReasonText?!!e.cancelReasonType||((0,o.showSnackbar)({kind:"error",title:"Missing Cancel Reason Type",subtitle:"Please add a cancel reason type"}),!1):((0,o.showSnackbar)({kind:"error",title:"Missing Cancel Reason",subtitle:"Please add a cancel reason"}),!1)}(e={consentToken:u,cancelReasonType:null!=p?p:"",cancelReasonText:null!=A?A:"",locationUuid:c})?[4,(n=e,ee((function(){var e,t,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return e=l.sent().hieBaseUrl,t="".concat(e,"/claim-closure"),[4,(0,o.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))())]:[2,!1];case 2:return"error"in t.sent()?((0,o.showSnackbar)({title:"Error Closing claim",kind:"error",subtitle:"An error occurred while closing the claim. Kindy retry or contact support"}),a()):(0,o.showSnackbar)({title:"Sucess Closing Claim",kind:"success",subtitle:"Claim closed successfully"}),[3,5];case 3:return t.sent(),(0,o.showSnackbar)({kind:"error",title:"Error Closing Claim",subtitle:"An error occurred while closing the claim. Kindy retry or contact support"}),[3,5];case 4:return d(!1),[7];case 5:return[2]}var n}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){yt(a,r,l,i,o,"next",e)}function o(e){yt(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:m?"Closing Claim...":"Close Claim",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:ft.closeClaimModalLayout},l().createElement("div",{className:ft.closeClaimModalRow},l().createElement(i.l6P,{id:"cancel_reason_type",labelText:"Cancel Reason Type",onChange:function(e){return function(e){y(e)}(e.target.value)}},l().createElement(i.ebT,{value:"",text:"Select"}),";",b.map((function(e){return l().createElement(i.ebT,{value:e,text:e})})))),l().createElement("div",{className:ft.closeClaimModalRow},l().createElement(i.ksK,{id:"cancel_reason_text",labelText:"Cancel Reason",onChange:function(e){return function(e){v(e)}(e.target.value)}}))))))};function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}const Et=function(e){var t,n,a=e.open,c=e.onClose,u=e.onSuccess,s=e.locationUuid,m=e.claimsVisit,d=e.invoiceNumber,f=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=f[0],y=f[1],h=(0,r.useMemo)((function(){return!d||!m}),[d,m]);return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Submit Claim",open:a,size:"md",onSecondarySubmit:c,onRequestClose:c,onRequestSubmit:h?null:p?function(){}:function(){return(e=function(){var e;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(t){switch(t.label){case 0:y(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),e={consentToken:m.authorization_code,invoiceNumber:d,locationUuid:s},[4,(n=e,ee((function(){var e,t,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return e=l.sent().hieBaseUrl,t="".concat(e,"/claim-submission"),[4,(0,o.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))())];case 2:return"error"in t.sent()?((0,o.showSnackbar)({title:"Error submitting claim",kind:"error",subtitle:"An error occurred while submitting the claim. Kindy retry or contact support"}),u()):(0,o.showSnackbar)({title:"Success submitting claim",kind:"success",subtitle:"Claim submitted successfully"}),[3,5];case 3:return t.sent(),(0,o.showSnackbar)({kind:"error",title:"Error submitting claim",subtitle:"An error occurred while submitting the claim. Kindy retry or contact support"}),[3,5];case 4:return y(!1),[7];case 5:return[2]}var n}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){bt(a,r,l,i,o,"next",e)}function o(e){bt(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:h?null:p?"Submitting claim...":"Submit claim",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("p",null,"Are you sure you want to submit the claim?"))))};function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const _t=function(e){var t=e.claimsVisit,n=e.locationUuid,a=e.patientBillDetails,c=function(){d(!1)},u=function(){y(!1)},s=wt((0,r.useState)(),2),m=s[0],d=s[1],f=wt((0,r.useState)(!1),2),p=f[0],y=f[1],h=(0,r.useMemo)((function(){return a?a.receipt_number:""}),[a]);return t?l().createElement(l().Fragment,null,l().createElement("div",{className:We.cvLayout},l().createElement("div",{className:We.cvHeaderSection},l().createElement("div",{className:We.headerTitle},l().createElement("h4",null,"Claim Visit Details")),l().createElement("div",{className:We.headerAction},l().createElement(i.$nd,{kind:"primary",onClick:function(){d(!0)}},"Close Claim"))),l().createElement("div",{className:We.cvContentSection},l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvWidth},l().createElement("ul",{className:We.claimList},l().createElement("li",null,l().createElement("strong",null,"State :")," ",t.workflow_state," "),l().createElement("li",null,l().createElement("strong",null,"Status : "),t.claim_auth_status),l().createElement("li",null,l().createElement("strong",null,"Name :")," ",t.patient_name),l().createElement("li",null,l().createElement("strong",null,"Member Number :")," ",t.member_number),l().createElement("li",null,l().createElement("strong",null,"Scheme Code :")," ",t.scheme_code),l().createElement("li",null,l().createElement("strong",null,"Scheme Name :")," ",t.scheme_name),l().createElement("li",null,l().createElement("strong",null,"Service Type :")," ",t.service_type),l().createElement("li",null,l().createElement("strong",null,"Provider :")," ",t.provider_name),l().createElement("li",null,l().createElement("strong",null,"Visit Start :")," ",(0,o.formatDate)((0,o.parseDate)(t.visit_start))," "))),l().createElement("div",{className:We.cvWidth},l().createElement("ul",{className:We.claimList},l().createElement("li",null,l().createElement("strong",null,"Total Amount :")," ",t.total_claim_amount),l().createElement("li",null,l().createElement("strong",null,"Total Net Amount :")," ",t.total_claim_net_amount),l().createElement("li",null,l().createElement("strong",null,"Total Co-Pay :")," ",t.total_claim_copay),l().createElement("li",null,l().createElement("strong",null,"Total Claim Discount:")," ",t.total_claim_discount),l().createElement("li",null,l().createElement("strong",null,"Total Claim Splits:")," ",t.total_claim_splits),l().createElement("li",null,l().createElement("strong",null,"No of Invoices : "),t.number_of_invoices),l().createElement("li",null,l().createElement("strong",null,"Diagnosis Count :")," ",t.diagnoses_count),l().createElement("li",null,l().createElement("strong",null,"Attachments Count :")," ",t.claim_attachments_count),l().createElement("li",null,l().createElement("strong",null,"Invoice Attachment Count :")," ",t.invoice_attachments_count)))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvRow},l().createElement("h6",null,"Invoices")),l().createElement("div",{className:We.cvRow},t.invoices&&l().createElement(ct,{claimInvoices:t.invoices,consentToken:t.authorization_code}))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvRow},l().createElement("h6",null,"Interventions")),l().createElement("div",{className:We.cvRow},t.interventions&&l().createElement(ut,{claimInterventions:t.interventions}))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvRow},l().createElement("h6",null,"Diagnosis")),l().createElement("div",{className:We.cvRow},t.claim_diagnoses&&l().createElement(st,{claimDiagnosiss:t.claim_diagnoses}))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.claimSubmitBtn},l().createElement(i.$nd,{kind:"tertiary",onClick:function(){y(!0)}},"Submit claim"))))),m&&l().createElement(At,{locationUuid:n,open:m,onClose:c,onSuccess:c,consentToken:t.authorization_code}),p&&l().createElement(Et,{locationUuid:n,open:p,onClose:u,onSuccess:u,claimsVisit:t,invoiceNumber:h})):l().createElement(l().Fragment,null,"No Data")};function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function St(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function kt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const xt=function(e){var t=e.consentToken,n=e.locationUuid,a=e.patientBillDetails,c=function(){return(e=function(){var e,t;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(n){switch(n.label){case 0:y(!0),e=u(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,ne(e)];case 2:return t=n.sent(),d(t||null),[3,5];case 3:return n.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching provider preview",subtitle:"An error was encountered while fetching the claim preview, retry or contact support"}),[3,5];case 4:return y(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){St(a,r,l,i,o,"next",e)}function o(e){St(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},u=function(){return{locationUuid:n,consentToken:t}},s=kt((0,r.useState)(null),2),m=s[0],d=s[1],f=kt((0,r.useState)(!1),2),p=f[0],y=f[1],h=kt((0,r.useState)(),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){var e;t&&n&&(e=a.find((function(e){return e.consent_token===t})),v(e),c())}),[t,n]),p?l().createElement(i.OuH,{description:"Loading data...please wait"}):l().createElement(l().Fragment,null,l().createElement("div",{className:Ge.pcLayout},m&&l().createElement(_t,{patientBillDetails:A,claimsVisit:m,locationUuid:n})))};function It(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function Nt(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Tt(a,r,l,i,o,"next",e)}function o(e){Tt(a,r,l,i,o,"throw",e)}i(void 0)}))}}function Pt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return It(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?It(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dt(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const Ut=function(e){var t=e.patientUuid,n=e.locationUuid,a=e.billingDate,c=Pt((0,r.useState)([]),2),u=c[0],s=c[1],m=Pt((0,r.useState)(""),2),d=m[0],f=m[1],p=Pt((0,r.useState)([]),2),y=p[0],h=p[1],A=(0,r.useMemo)((function(){var e;return null!==(e=u[0])&&void 0!==e?e:null}),[u]),v=(0,r.useMemo)((function(){return function(e){return e.length>0?e.some((function(e){return"POSTED"===e.paid_status}))?"PARTIALLY PAID":e.some((function(e){return"PENDING"===e.paid_status}))?"PENDING":"PAID":status}(u)}),[u]),b=Pt((0,r.useState)([]),2),E=b[0],g=b[1];return(0,r.useEffect)((function(){n&&t&&a&&(Nt((function(){var e,r;return Dt(this,(function(l){switch(l.label){case 0:e={locationUuid:n,billingDate:a,patientUuid:t},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,(i=e,ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,X.SW)()];case 1:return e=l.sent(),t="".concat(e,"/facility/patient/bill?locationUuid=").concat(i.locationUuid,"&billingDate=").concat(i.billingDate,"&patientUuid=").concat(i.patientUuid),[4,(0,o.openmrsFetch)(t)];case 2:return[4,l.sent().json()];case 3:return n=l.sent(),[2,null!==(r=n.results)&&void 0!==r?r:[]]}}))}))())];case 2:return(r=l.sent())&&(s(r),f(r[0].consent_token)),[3,4];case 3:return l.sent(),(0,me.tdF)({title:"Error fetching patient bill details",kind:"error",subtitle:"An error occurred while generat"}),[3,4];case 4:return[2]}var i}))}))(),Nt((function(){var e,n;return Dt(this,(function(r){switch(r.label){case 0:e={patientUuid:t,billingDate:a},r.label=1;case 1:return r.trys.push([1,3,,4]),[4,(l=e,ee((function(){var e,t,n,r;return te(this,(function(a){switch(a.label){case 0:return[4,(0,X.SW)()];case 1:return e=a.sent(),t="".concat(e,"/bill/patient/payment?billingDate=").concat(l.billingDate,"&patientUuid=").concat(l.patientUuid),[4,(0,o.openmrsFetch)(t)];case 2:return[4,a.sent().json()];case 3:return n=a.sent(),[2,null!==(r=n.results)&&void 0!==r?r:[]]}}))}))())];case 2:return(n=r.sent())&&n.length>0?h(n):h([]),[3,4];case 3:return r.sent(),(0,me.tdF)({title:"Error fetching patient bill payments",kind:"error",subtitle:"An error occurred while fetching the patient bill payments"}),[3,4];case 4:return[2]}var l}))}))(),Nt((function(){var e,r;return Dt(this,(function(l){switch(l.label){case 0:e={patientUuid:t,visitDate:a,locationUuid:n},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,(i=e,ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,X.SW)()];case 1:return e=l.sent(),t="".concat(e,"/patient/diagnosis?visitDate=").concat(i.visitDate,"&patientUuid=").concat(i.patientUuid,"&locationUuid=").concat(i.locationUuid),[4,(0,o.openmrsFetch)(t)];case 2:return[4,l.sent().json()];case 3:return n=l.sent(),[2,null!==(r=n.results)&&void 0!==r?r:[]]}}))}))())];case 2:return(r=l.sent())&&r.length>0?g(r):g([]),[3,4];case 3:return l.sent(),(0,me.tdF)({title:"Error fetching patient diagnosis",kind:"error",subtitle:"An error occurred while fetching the patient diagnosis"}),[3,4];case 4:return[2]}var i}))}))())}),[n,t,a]),l().createElement(l().Fragment,null,l().createElement("div",{className:se.bdLayout},l().createElement("div",{className:se.bdHeader},A?l().createElement(l().Fragment,null,l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"Name:")," ",A.patient_name),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"CashPoint:")," ",A.cash_point),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"Bill Date:")," ",A.bill_date),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"CR:")," ",A.cr_no),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"AMRS Universl ID:")," ",A.amrs_universal_id),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"Bill Status:")," ",null!=v?v:"")):l().createElement(l().Fragment,null)),l().createElement("div",null,l().createElement(i.tUM,null,l().createElement(i.wbY,{scrollDebounceWait:200},l().createElement(i.ozo,null,"Bill Details"),l().createElement(i.ozo,null,"Claim")),l().createElement(i.T2N,null,l().createElement(i.KpK,null,u&&l().createElement(qe,{patientBillDetails:u,patientPayments:y,amrsVisitDiagnosis:E,locationUuid:n,consentToken:d})),l().createElement(i.KpK,null,n&&d?l().createElement(l().Fragment,null,l().createElement(xt,{locationUuid:n,patientBillDetails:u,consentToken:d})):l().createElement(l().Fragment,null)))))))};function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ft(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ot=function(e){var t=e.billingDate,n=e.locationUuid,a=function(){return(e=function(){var e,t;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(n){switch(n.label){case 0:e=c(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(r=e,ee((function(){var e,t,n,l;return te(this,(function(a){switch(a.label){case 0:return[4,(0,X.SW)()];case 1:return e=a.sent(),t="".concat(e,"/facility/bills?locationUuid=").concat(r.locationUuid,"&billingDate=").concat(r.billingDate),[4,(0,o.openmrsFetch)(t)];case 2:return[4,a.sent().json()];case 3:return n=a.sent(),[2,null!==(l=n.results)&&void 0!==l?l:[]]}}))}))())];case 2:return t=n.sent(),d(t||[]),[3,4];case 3:return n.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching facility bills",subtitle:"An error occurred while fetehcing facility bills, please reload or contact support"}),[3,4];case 4:return[2]}var r}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Ft(a,r,l,i,o,"next",e)}function o(e){Ft(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},c=function(){return{locationUuid:null!=n?n:"",billingDate:t}},u=function(e,t){y(e),v(t)},s=jt((0,r.useState)([]),2),m=s[0],d=s[1],f=jt((0,r.useState)(Q.Bills),2),p=f[0],y=f[1],h=jt((0,r.useState)(""),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){n&&t&&a()}),[t,n]),l().createElement(l().Fragment,null,p===Q.Bills?l().createElement(l().Fragment,null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Date"),l().createElement(i.A0N,null,"Patient"),l().createElement(i.A0N,null,"Status"),l().createElement(i.A0N,null,"Cashpoint"))),l().createElement(i.BFY,null,m&&m.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.patient_uuid},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.bill_date),l().createElement(i.nA6,null,l().createElement("div",{className:oe.clickableData,onClick:function(){return u(Q.BillDetails,e.patient_uuid)}},e.patient_name)),l().createElement(i.nA6,null,function(e){var t=e.split(",");return t.length>0?t.some((function(e){return"POSTED"===e}))?"PARTIALLY PAID":t.some((function(e){return"PENDING"===e}))?"PENDING":"PAID":e}(e.paid_status)),l().createElement(i.nA6,null,e.cash_point)))}))))):l().createElement(l().Fragment,null),p===Q.BillDetails&&A?l().createElement(l().Fragment,null,l().createElement("div",null,l().createElement(i.$nd,{kind:"primary",onClick:function(){return u(Q.Bills,"")}},"Back")),l().createElement("div",null,l().createElement(Ut,{locationUuid:n,billingDate:t,patientUuid:A}))):l().createElement(l().Fragment,null))};var Lt=n(16732),Rt={};Rt.styleTagTransform=G(),Rt.setAttributes=M(),Rt.insert=R().bind(null,"head"),Rt.domAPI=O(),Rt.insertStyleElement=Y(),F()(Lt.A,Rt);const Ht=Lt.A&&Lt.A.locals?Lt.A.locals:void 0;var Mt=n(75492),qt={};qt.styleTagTransform=G(),qt.setAttributes=M(),qt.insert=R().bind(null,"head"),qt.domAPI=O(),qt.insertStyleElement=Y(),F()(Mt.A,qt);const Yt=Mt.A&&Mt.A.locals?Mt.A.locals:void 0,Kt=function(e){var t=e.open,n=e.claimsVisit,r=e.handleClose,a=e.locationUuid;return l().createElement(l().Fragment,null,l().createElement(i.aFV,{open:t,size:"lg",onSecondarySubmit:function(){},onRequestClose:r,onRequestSubmit:function(){},primaryButtonText:"",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:Yt.cvModalLayout},l().createElement(_t,{claimsVisit:n,locationUuid:a})))))};function Gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function zt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function Vt(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){zt(a,r,l,i,o,"next",e)}function o(e){zt(a,r,l,i,o,"throw",e)}i(void 0)}))}}function Wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qt(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const $t=function(e){var t=e.locationUuid,n=e.billingDate,a=Wt((0,r.useState)(),2),c=a[0],u=a[1],s=Wt((0,r.useState)(null),2),m=s[0],d=s[1],f=Wt((0,r.useState)(!1),2),p=f[0],y=f[1],h=Wt((0,r.useState)(!1),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){t&&n&&Vt((function(){var e,r;return Qt(this,(function(l){switch(l.label){case 0:v(!0),e={locationUuid:null!=t?t:"",visitDate:n},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,(a=e,ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return e={},a.consentToken&&(e.consentToken=a.consentToken),a.locationUuid&&(e.locationUuid=a.locationUuid),a.visitDate&&(e.visitDate=a.visitDate),[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n=new URLSearchParams(e).toString(),[4,(0,o.openmrsFetch)("".concat(t,"/claims-visit?").concat(n))];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:[]]}}))}))())];case 2:return(r=l.sent())&&u(r),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching facility bills",subtitle:"An error occurred while fetehcing facility bills, please reload or contact support"}),[3,5];case 4:return v(!1),[7];case 5:return[2]}var a}))}))()}),[t,n]),t&&n?l().createElement(l().Fragment,null,l().createElement("div",{className:Ht.claimVisitsLayout},l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Date"),l().createElement(i.A0N,null,"Patient"),l().createElement(i.A0N,null,"Service Type"),l().createElement(i.A0N,null,"Action"))),l().createElement(i.BFY,null,c&&c.map((function(e,n){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,n+1),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.visitStart))),l().createElement(i.nA6,null,l().createElement("div",null,e.patientId)),l().createElement(i.nA6,null,e.serviceType),l().createElement(i.$nd,{kind:"ghost",onClick:function(){return n=e,Vt((function(){var e,r;return Qt(this,(function(l){switch(l.label){case 0:v(!0),a=n.authorizationCode,e={locationUuid:t,consentToken:a},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,ne(e)];case 2:return(r=l.sent())?(d(r),y(!0)):(d(null),y(!1)),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching provider preview",subtitle:"An error was encountered while fetching the claim preview, retry or contact support"}),[3,5];case 4:return v(!1),[7];case 5:return[2]}var a}))}))();var n},size:"sm"},A?l().createElement(i.OuH,{description:"Fetching data...."}):"View Claim")))})))),p&&m?l().createElement(l().Fragment,null,l().createElement(Kt,{open:p,claimsVisit:m,handleClose:function(){y(!1),d(null)},locationUuid:t})):l().createElement(l().Fragment,null))):l().createElement(l().Fragment,null)};function Xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Jt=function(){var e,t,n,a,c=null!==(t=null===(e=(0,o.useSession)().sessionLocation)||void 0===e?void 0:e.uuid)&&void 0!==t?t:"",u=(n=(0,r.useState)((new Date).toLocaleDateString("en-CA")),a=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(n,a)||function(e,t){if(e){if("string"==typeof e)return Xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xt(e,t):void 0}}(n,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],m=u[1];return l().createElement(l().Fragment,null,l().createElement("div",{className:W.bcLayout},l().createElement("div",{className:W.bcHeader},l().createElement("div",{className:W.bcHeaderTitle},l().createElement("h4",null,"Billing and Claims Dashboard")),l().createElement("div",{className:W.bcHeaderStats})),l().createElement("div",{className:W.bcContent},l().createElement("div",{className:W.bcContentFilters},l().createElement(i.lrV,{datePickerType:"single",locale:"en",onChange:function(e){var t=new Date(e[0]).toLocaleDateString("en-CA");m(t)},onClose:function(){},onOpen:function(){}},l().createElement(i.tKA,{id:"date-picker-single",labelText:"Date",placeholder:"mm/dd/yyyy"}))),l().createElement("div",{className:W.bcContentTabs},l().createElement(i.tUM,null,l().createElement(i.wbY,{scrollDebounceWait:200},l().createElement(i.ozo,null,"Bills"),l().createElement(i.ozo,null,"Claims")),l().createElement(i.T2N,null,l().createElement(i.KpK,null,l().createElement(Ot,{locationUuid:c,billingDate:s})),l().createElement(i.KpK,null,l().createElement($t,{locationUuid:c,billingDate:s}))))))))},Zt=function(){return l().createElement(a.BrowserRouter,{basename:"".concat(window.spaBase,"/home/billing")},l().createElement(a.Routes,null,l().createElement(a.Route,{path:"",element:l().createElement(Jt,null)}),l().createElement(a.Route,{path:"/patient/:patientUuid/:billUuid",element:l().createElement(U,null)})))}},22540:(e,t,n)=>{n.d(t,{Q:()=>l,s:()=>r});var r=function(e){return e.Completed="COMPLETED",e.Waiting="WAITING",e.InService="IN SERVICE",e}({}),l=function(e){return e.Emergency="EMERGENCY",e.Priority="PRIORITY",e.NonUrgent="NON-URGENT",e}({})},23492:(e,t,n)=>{n.d(t,{bo:()=>i,y$:()=>a});var r=n(25987);function l(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}var a=function(){var e=(0,r.useConfig)({externalModuleName:"@ampath/esm-dha-workflow-app"}).hieBaseUrl,t=(0,r.useSession)().sessionLocation;return{hieBaseUrl:e,locationUuid:null==t?void 0:t.uuid}};function i(){return(e=function(){var e;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)("@ampath/esm-dha-workflow-app")];case 1:return[2,{hieBaseUrl:null!=(e=t.sent().hieBaseUrl)?e:null}]}}))},function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){l(i,r,a,o,c,"next",e)}function c(e){l(i,r,a,o,c,"throw",e)}o(void 0)}))})();var e}},36350:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__facility-bills-component__clickableData___H-XlC{color:blue}.-esm-dha-workflow__facility-bills-component__clickableData___H-XlC:hover{cursor:pointer}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/facility-bills/facility-bills.component.scss"],names:[],mappings:"AAAA,oEACI,UAAA,CAEJ,0EACI,cAAA",sourcesContent:[".clickableData{\n color: blue;\n}\n.clickableData:hover{\n cursor: pointer;\n}"],sourceRoot:""}]),i.locals={clickableData:"-esm-dha-workflow__facility-bills-component__clickableData___H-XlC"};const o=i},42737:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const o=i},47708:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-invoice-details-component__linkBtn___LOZaQ{color:blue}.-esm-dha-workflow__claim-invoice-details-component__linkBtn___LOZaQ:hover{cursor:pointer}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/claim-invoice-details/claim-invoice-details.component.scss"],names:[],mappings:"AAAA,qEACI,UAAA,CAEJ,2EACI,cAAA",sourcesContent:[".linkBtn{\n color: blue;\n}\n.linkBtn:hover{\n cursor: pointer;\n}"],sourceRoot:""}]),i.locals={linkBtn:"-esm-dha-workflow__claim-invoice-details-component__linkBtn___LOZaQ"};const o=i},61240:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__bill-item-payment-modal__biModalLayout___yNYxz{display:flex;flex-direction:column;width:100%;row-gap:15px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/modals/bill-item-payment/bill-item-payment.modal.scss"],names:[],mappings:"AAAA,mEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA",sourcesContent:[".biModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 15px;\n}"],sourceRoot:""}]),i.locals={biModalLayout:"-esm-dha-workflow__bill-item-payment-modal__biModalLayout___yNYxz"};const o=i},62214:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__eligibility-tags__eligibilityTagsLayout___VNY4e{display:flex;flex-direction:row;width:100%;column-gap:5px}","",{version:3,sources:["webpack://./src/registry/eligibility/eliigibility-tags/eligibility-tags.scss"],names:[],mappings:"AAAA,oEACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA",sourcesContent:[".eligibilityTagsLayout{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}"],sourceRoot:""}]),i.locals={eligibilityTagsLayout:"-esm-dha-workflow__eligibility-tags__eligibilityTagsLayout___VNY4e"};const o=i},62748:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-invoice-lines-modal__claimInvoiceLinesModalLayout___qCTwI{display:flex;flex-direction:column;width:100%;row-gap:5px;padding:5px 5px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/modal/claim-invoice-lines/claim-invoice-lines.modal.scss"],names:[],mappings:"AAAA,oFACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CACA,eAAA",sourcesContent:[".claimInvoiceLinesModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n padding: 5px 5px;\n}"],sourceRoot:""}]),i.locals={claimInvoiceLinesModalLayout:"-esm-dha-workflow__claim-invoice-lines-modal__claimInvoiceLinesModalLayout___qCTwI"};const o=i},62801:(e,t,n)=>{n.d(t,{E$:()=>c,SW:()=>u,Zp:()=>m,bo:()=>s,tI:()=>d});var r=n(25987),l=n(42333);function a(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function o(e){a(i,r,l,o,c,"next",e)}function c(e){a(i,r,l,o,c,"throw",e)}o(void 0)}))}}function o(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function c(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().subDomainUrl)?e:null]}}))}))()}function u(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().etlBaseUrl)?e:null]}}))}))()}function s(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().hieBaseUrl)?e:null]}}))}))()}function m(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().claimsBaseUrl)?e:null]}}))}))()}function d(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().claimsKey)?e:null]}}))}))()}},64870:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__bill-details__billDetailsLayout___egS9m{display:flex;flex-direction:column;row-gap:10px;width:100%;padding:15px 15px}.-esm-dha-workflow__bill-details__billDetailsLayout___egS9m .-esm-dha-workflow__bill-details__billRow___Wt-k1{display:flex;flex-direction:column;width:100%;row-gap:10px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/bill-details/bill-details.scss"],names:[],mappings:"AAAA,4DACI,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CACA,iBAAA,CACA,8GACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA",sourcesContent:[".billDetailsLayout{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n padding: 15px 15px;\n .billRow{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n }\n}"],sourceRoot:""}]),i.locals={billDetailsLayout:"-esm-dha-workflow__bill-details__billDetailsLayout___egS9m",billRow:"-esm-dha-workflow__bill-details__billRow___Wt-k1"};const o=i},70328:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const o=i},73637:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo{display:flex;flex-direction:column;width:100%;padding:2% 2%;row-gap:10px}.-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo .-esm-dha-workflow__billing-claims-dashboard-component__bcContent___5Lhmg{display:flex;flex-direction:column;width:100%;row-gap:10px}.-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo .-esm-dha-workflow__billing-claims-dashboard-component__bcContent___5Lhmg .-esm-dha-workflow__billing-claims-dashboard-component__bcContentFilters___n\\+tCo{display:flex;flex-direction:row;justify-content:flex-end}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/billing-claims-dashboard.component.scss"],names:[],mappings:"AAAA,yEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,aAAA,CACA,YAAA,CACA,mJACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA,CACA,qOACI,YAAA,CACA,kBAAA,CACA,wBAAA",sourcesContent:[".bcLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 2% 2%;\n row-gap: 10px;\n .bcContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n .bcContentFilters{\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n }\n }\n}"],sourceRoot:""}]),i.locals={bcLayout:"-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo",bcContent:"-esm-dha-workflow__billing-claims-dashboard-component__bcContent___5Lhmg",bcContentFilters:"-esm-dha-workflow__billing-claims-dashboard-component__bcContentFilters___n+tCo"};const o=i},73837:(e,t,n)=>{n.d(t,{E:()=>i});var r=n(25987),l=n(62801);function a(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function i(e){return(t=function(){var t,n;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/eligibility"),[4,(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 2:return[2,a.sent().json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,l){var i=t.apply(e,n);function o(e){a(i,r,l,o,c,"next",e)}function c(e){a(i,r,l,o,c,"throw",e)}o(void 0)}))})();var t}},75492:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-visit-details-modal__cvModalLayout___TY-U4{display:flex;flex-direction:column;width:100%;row-gap:10px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/modal/claim-visit-details/claim-visit-details.modal.scss"],names:[],mappings:"AAAA,qEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA",sourcesContent:[".cvModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n}"],sourceRoot:""}]),i.locals={cvModalLayout:"-esm-dha-workflow__claim-visit-details-modal__cvModalLayout___TY-U4"};const o=i},83983:(e,t,n)=>{n.d(t,{B3:()=>d,EI:()=>s,Uv:()=>m,pC:()=>f,x_:()=>u});var r=n(25987),l=n(62801),a=n(18548);function i(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function o(e){i(a,r,l,o,c,"next",e)}function c(e){i(a,r,l,o,c,"throw",e)}o(void 0)}))}}function c(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function u(){return o((function(){var e,t,n;return c(this,(function(l){switch(l.label){case 0:return e="".concat(r.restBaseUrl,"/billing/paymentMode"),[4,(0,r.openmrsFetch)(e)];case 1:return[4,l.sent().json()];case 2:return t=l.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()}function s(){return o((function(){var e,t,n;return c(this,(function(l){switch(l.label){case 0:return e="".concat(r.restBaseUrl,"/billing/billableService"),[4,(0,r.openmrsFetch)("".concat(e,"?v=").concat("full"))];case 1:return[4,l.sent().json()];case 2:return t=l.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()}function m(e){return o((function(){var t;return c(this,(function(n){switch(n.label){case 0:return t="".concat(r.restBaseUrl,"/billing/bill"),[4,(0,r.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 1:return[2,n.sent().data]}}))}))()}function d(){return o((function(){var e,t,n;return c(this,(function(l){switch(l.label){case 0:return e="".concat(r.restBaseUrl,"/billing/cashPoint?v=").concat("full"),[4,(0,r.openmrsFetch)(e)];case 1:return[4,l.sent().json()];case 2:return t=l.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()}var f=function(e){return o((function(){var t,n;return c(this,(function(r){switch(r.label){case 0:return[4,(0,l.bo)()];case 1:return t=r.sent(),n="".concat(t,"/bill-order"),[2,(0,a.B2)(n,e)]}}))}))()}},84176:(e,t,n)=>{n.d(t,{A:()=>x});var r=n(16072),l=n.n(r),a=n(93323),i=n(44455),o=n(73837),c=n(85072),u=n.n(c),s=n(97825),m=n.n(s),d=n(77659),f=n.n(d),p=n(55056),y=n.n(p),h=n(10540),A=n.n(h),v=n(41113),b=n.n(v),E=n(62214),g={};g.styleTagTransform=b(),g.setAttributes=y(),g.insert=f().bind(null,"head"),g.domAPI=m(),g.insertStyleElement=A(),u()(E.A,g);const w=E.A&&E.A.locals?E.A.locals:void 0;var _=n(25987);function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const x=function(e){var t=e.crId,n=e.locationUuid,c=function(){return(e=function(){var e,r;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(l){switch(l.label){case 0:if(y(!0),e=function(){var e={requestIdNumber:"",requestIdType:"",locationUuid:n};return t&&(e.requestIdNumber=t,e.requestIdType="3"),e}(),!u(e))return y(!1),[2];l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,(0,o.E)(e)];case 2:return r=l.sent(),d(r),[3,5];case 3:return l.sent(),(0,_.showSnackbar)({kind:"error",title:"Failed getting eligibility status",subtitle:"An error occurred while fetching eligibility status. Please try again or contact support"}),[3,5];case 4:return y(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){S(a,r,l,i,o,"next",e)}function o(e){S(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},u=function(e){return!!e.locationUuid&&!!e.requestIdNumber&&!!e.requestIdType},s=k((0,r.useState)(),2),m=s[0],d=s[1],f=k((0,r.useState)(!1),2),p=f[0],y=f[1],h=k((0,r.useState)(!1),2);return h[0],h[1],(0,r.useEffect)((function(){c()}),[t]),t?l().createElement(l().Fragment,null,l().createElement("div",{className:w.eligibilityTagsLayout},p?l().createElement(l().Fragment,null,l().createElement(i.OuH,{description:"Fetching Eligibility data..."})):l().createElement(l().Fragment,null,m?l().createElement(l().Fragment,null,m.schemes&&m.schemes.length>0?l().createElement(l().Fragment,null,m.schemes.map((function(e){return l().createElement("div",null,l().createElement(i.vwO,{className:"some-class",size:"md",title:"Status",type:(0,a.HT)(e.coverage.status)},e.schemeName," : ","1"===e.coverage.status?"Active":"Not Active"))}))):l().createElement("div",null,l().createElement(i.vwO,{className:"some-class",size:"md",title:"Status",type:"gray"},"No Insurance schemes found"))):l().createElement(l().Fragment,null)))):l().createElement(l().Fragment,null)}},86375:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__patient-bill-details__bdLayout___5g-5o{display:flex;flex-direction:column;width:100%;padding:15px 15px;row-gap:5px}.-esm-dha-workflow__patient-bill-details__bdHeader___vtzgp{display:flex;flex-direction:row;column-gap:10px;padding:15px 15px;background:#f4f4f4;flex-wrap:wrap}.-esm-dha-workflow__patient-bill-details__pdCol___WnSrk{padding:5px 5px;width:30%}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/patient-bill-details.scss"],names:[],mappings:"AAAA,2DACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,iBAAA,CACA,WAAA,CAGJ,2DACI,YAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CACA,kBAAA,CACA,cAAA,CAEJ,wDACI,eAAA,CACA,SAAA",sourcesContent:[".bdLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 15px 15px;\n row-gap: 5px;\n}\n\n.bdHeader{\n display: flex;\n flex-direction: row;\n column-gap: 10px;\n padding: 15px 15px;\n background: #f4f4f4;\n flex-wrap: wrap;\n}\n.pdCol{\n padding: 5px 5px;\n width: 30%;\n}"],sourceRoot:""}]),i.locals={bdLayout:"-esm-dha-workflow__patient-bill-details__bdLayout___5g-5o",bdHeader:"-esm-dha-workflow__patient-bill-details__bdHeader___vtzgp",pdCol:"-esm-dha-workflow__patient-bill-details__pdCol___WnSrk"};const o=i},93323:(e,t,n)=>{n.d(t,{EU:()=>a,HT:()=>l});var r=n(22540);function l(e){return 1===e||"1"===e?"green":"red"}var a=function(e){var t;switch(e){case r.Q.Emergency:t="emergencyTag";break;case r.Q.Priority:t="priorityTag";break;case r.Q.NonUrgent:t="nonUrgentTag";break;case"".concat(r.Q.Emergency," PRIORITY"):t="emergencyTag";break;case"".concat(r.Q.NonUrgent," PRIORITY"):t="nonUrgentTag";break;case"".concat(r.Q.Priority," PRIORITY"):case"NORMAL PRIORITY":t="priorityTag";break;case"NOT URGENT":t="nonUrgentTag";break;default:t="gray"}return t}},95636:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const o=i},97209:(e,t,n)=>{n.d(t,{$k:()=>p,Gn:()=>y,MQ:()=>f,tA:()=>m,wH:()=>d,wh:()=>v,x_:()=>h,yj:()=>A});var r=n(25987),l=n(62801);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function o(e){i(a,r,l,o,c,"next",e)}function c(e){i(a,r,l,o,c,"throw",e)}o(void 0)}))}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2?arguments[2]:void 0;return o((function(){var a,i,o,s,m,d,f;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),[4,Promise.all([(0,l.Zp)(),(0,l.tI)()])];case 1:return a=c.apply(void 0,[u.sent(),2]),i=a[0],o=a[1],[4,(0,r.openmrsFetch)("".concat(i).concat(e),{method:t,headers:{"AMPATH-CLAIMS-KEY":o,"Content-Type":"application/json"},body:n?JSON.stringify(n):void 0})];case 2:return[2,null==(s=u.sent())?void 0:s.data];case 3:return[2,{success:!1,data:null,message:(null==(m=u.sent())||null===(f=m.response)||void 0===f||null===(d=f.data)||void 0===d?void 0:d.message)||(null==m?void 0:m.message)||"Claims API request failed"}];case 4:return[2]}}))}))()}function m(e){return o((function(){return u(this,(function(t){return e?[2,s("/claims/".concat(e),"POST")]:[2,{success:!1,data:null,message:"Bill ID is required to raise a SHA claim"}]}))}))()}function d(e){return o((function(){return u(this,(function(t){return[2,s("/bill-item/status","POST",e)]}))}))()}function f(e){return o((function(){return u(this,(function(t){return e?[2,s("/daily-bills?locationUuId=090089ea-1352-11df-a1f1-0026b9348838&billDate=".concat(e))]:[2,{success:!1,data:null,message:"Bill date is required"}]}))}))()}function p(e){return o((function(){return u(this,(function(t){return e?[2,s("/claims/".concat(e,"/status"))]:[2,{success:!1,data:null,message:"Bill UUID is required"}]}))}))()}function y(e){return o((function(){return u(this,(function(t){switch(t.label){case 0:return[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/billing/bill/").concat(e))];case 1:return[2,t.sent().data]}}))}))()}function h(){return o((function(){return u(this,(function(e){switch(e.label){case 0:return[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/billing/paymentMode"))];case 1:return[2,e.sent().data]}}))}))()}function A(e){return o((function(){return u(this,(function(t){return e?[2,s("/bills/".concat(e,"/status"),"POST")]:[2,{success:!1,data:null,message:"Bill UUID is required"}]}))}))()}function v(e,t){return o((function(){return u(this,(function(n){return[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/billing/bill/").concat(e,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:t})]}))}))()}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_ampath_esm_dha_workflow_app=globalThis.webpackChunk_ampath_esm_dha_workflow_app||[]).push([[2801,8626],{3028:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI{display:flex;flex-direction:column;padding:15px 15px;row-gap:10px;width:100%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt-{display:flex;flex-direction:row;column-gap:5px;width:100%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt- .-esm-dha-workflow__claim-visit-details-component__headerTitle___LGuzV{display:flex;flex-direction:row;width:50%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt- .-esm-dha-workflow__claim-visit-details-component__headerAction___2qzZX{display:flex;flex-direction:row;justify-content:flex-end;width:50%}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm{display:flex;flex-direction:column}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm .-esm-dha-workflow__claim-visit-details-component__cvRow___KCCTx{display:flex;flex-direction:row;width:100%;flex-wrap:wrap;margin-top:10px}.-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI .-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm .-esm-dha-workflow__claim-visit-details-component__cvRow___KCCTx .-esm-dha-workflow__claim-visit-details-component__cvWidth___SYeGa{display:flex;width:45%}.-esm-dha-workflow__claim-visit-details-component__claimList___iAQLX{display:flex;flex-direction:column;row-gap:10px}.-esm-dha-workflow__claim-visit-details-component__claimSubmitBtn___zzjk7{display:flex;justify-content:flex-end;margin-left:auto;float:right}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/claim-visit-details/claim-visit-details.component.scss"],names:[],mappings:"AAAA,oEACI,YAAA,CACA,qBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,+IACI,YAAA,CACA,kBAAA,CACA,cAAA,CACA,UAAA,CACA,sNACI,YAAA,CACA,kBAAA,CACA,SAAA,CAEJ,uNACI,YAAA,CACA,kBAAA,CACA,wBAAA,CACA,SAAA,CAGR,gJACI,YAAA,CACA,qBAAA,CACA,iNACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA,CACA,oRACI,YAAA,CACA,SAAA,CAMhB,qEACI,YAAA,CACA,qBAAA,CACA,YAAA,CAGJ,0EACI,YAAA,CACA,wBAAA,CACA,gBAAA,CACA,WAAA",sourcesContent:[".cvLayout{\n display: flex;\n flex-direction: column;\n padding: 15px 15px;\n row-gap: 10px;\n width: 100%;\n .cvHeaderSection{\n display: flex;\n flex-direction: row;\n column-gap: 5px;\n width: 100%;\n .headerTitle{\n display: flex;\n flex-direction: row;\n width: 50%;\n }\n .headerAction{\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n width: 50%;\n }\n }\n .cvContentSection{\n display: flex;\n flex-direction: column;\n .cvRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n flex-wrap: wrap;\n margin-top: 10px;\n .cvWidth{\n display: flex;\n width: 45%;\n }\n }\n }\n}\n\n.claimList{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n}\n\n.claimSubmitBtn {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n float: right;\n}"],sourceRoot:""}]),i.locals={cvLayout:"-esm-dha-workflow__claim-visit-details-component__cvLayout___M5yPI",cvHeaderSection:"-esm-dha-workflow__claim-visit-details-component__cvHeaderSection___2tbt-",headerTitle:"-esm-dha-workflow__claim-visit-details-component__headerTitle___LGuzV",headerAction:"-esm-dha-workflow__claim-visit-details-component__headerAction___2qzZX",cvContentSection:"-esm-dha-workflow__claim-visit-details-component__cvContentSection___B8dGm",cvRow:"-esm-dha-workflow__claim-visit-details-component__cvRow___KCCTx",cvWidth:"-esm-dha-workflow__claim-visit-details-component__cvWidth___SYeGa",claimList:"-esm-dha-workflow__claim-visit-details-component__claimList___iAQLX",claimSubmitBtn:"-esm-dha-workflow__claim-visit-details-component__claimSubmitBtn___zzjk7"};const o=i},5876:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__add-claim-line-modal__addClaimLineModalLayout___d4IeA{display:flex;flex-direction:column;width:100%;row-gap:10px;width:100%}.-esm-dha-workflow__add-claim-line-modal__addClaimLineModalLayout___d4IeA .-esm-dha-workflow__add-claim-line-modal__addClaimLineModalRow___pgSOf{display:flex;flex-direction:row;width:100%;column-gap:5px;padding:5px 5px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/modals/add-claim-line/add-claim-line.modal.scss"],names:[],mappings:"AAAA,0EACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA,CACA,UAAA,CACA,iJACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA,CACA,eAAA",sourcesContent:[".addClaimLineModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n width: 100%;\n .addClaimLineModalRow{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n padding: 5px 5px;\n }\n}"],sourceRoot:""}]),i.locals={addClaimLineModalLayout:"-esm-dha-workflow__add-claim-line-modal__addClaimLineModalLayout___d4IeA",addClaimLineModalRow:"-esm-dha-workflow__add-claim-line-modal__addClaimLineModalRow___pgSOf"};const o=i},16732:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-visits-component__claimVisitsLayout___SI0NX{display:flex;flex-direction:column;width:100%}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/claim-visits.component.scss"],names:[],mappings:"AAAA,sEACI,YAAA,CACA,qBAAA,CACA,UAAA",sourcesContent:[".claimVisitsLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n}"],sourceRoot:""}]),i.locals={claimVisitsLayout:"-esm-dha-workflow__claim-visits-component__claimVisitsLayout___SI0NX"};const o=i},18548:(e,t,n)=>{n.d(t,{B2:()=>c,lr:()=>m,un:()=>u,zB:()=>s});var r=n(25987),l=n(62801);function a(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function o(e){a(i,r,l,o,c,"next",e)}function c(e){a(i,r,l,o,c,"throw",e)}o(void 0)}))}}function o(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function c(e,t){return i((function(){var n,l;return o(this,(function(a){switch(a.label){case 0:return[4,(0,r.openmrsFetch)(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})];case 1:return(n=a.sent()).ok?[3,3]:[4,n.text()];case 2:throw l=a.sent(),new Error("Request failed with ".concat(n.status,": ").concat(l));case 3:return[2,n.json()]}}))}))()}function u(e){return i((function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/send-custom-otp"),r={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid,phoneNumber:e.phoneNumber},[2,c(n,r)]}}))}))()}function s(e){return i((function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/validate-custom-otp"),r={sessionId:e.sessionId,otp:e.otp,locationUuid:e.locationUuid},[2,c(n,r)]}}))}))()}function m(e){return i((function(){var t,n,r;return o(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/client/search"),r={identificationNumber:e.identificationNumber,identificationType:e.identificationType,locationUuid:e.locationUuid},[2,c(n,r)]}}))}))()}},18626:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Zt});var r=n(16072),l=n.n(r),a=n(27114),i=n(44455),o=n(25987),c=n(50810),u=n(63654),s=n(2383),m=n(83270),d=n(49564),f=n(59184),p=n(81673),y=n(97209),h=n(84176);function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){v(a,r,l,i,o,"next",e)}function o(e){v(a,r,l,i,o,"throw",e)}i(void 0)}))}}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){E(e,t,n[t])}))}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||S(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e){return function(e){if(Array.isArray(e))return A(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||S(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}function k(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var x=[{key:"service",header:"Bill Item"},{key:"payerType",header:"Payer"},{key:"quantity",header:"Quantity"},{key:"price",header:"Price"},{key:"balance",header:"Total"},{key:"status",header:"Status"},{key:"select",header:"Select"},{key:"actions",header:"Actions"}],I=["PHC","SHIF","ECCIF","SHA"],N=["CASH","MPESA"],T=function(e){if(!e)return"";var t=new Date(e),n=new Date,r=t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate(),l=new Date;l.setDate(n.getDate()-1);var a=t.getFullYear()===l.getFullYear()&&t.getMonth()===l.getMonth()&&t.getDate()===l.getDate(),i=t.toLocaleTimeString(void 0,{hour:"numeric",minute:"numeric",hour12:!0});return r?"Today, ".concat(i):a?"Yesterday, ".concat(i):t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",hour12:!0})},P=function(e){return"Ksh ".concat(e.toLocaleString())},D=function(){(0,o.navigate)({to:"".concat(window.spaBase,"/home/billing"),templateParams:{}})};const U=function(){var e,t,n,a,A,v,E,S,U,B,F,j=_((0,r.useState)(null),2),O=j[0],L=j[1],R=_((0,r.useState)([]),2),H=R[0],M=R[1],q=_((0,r.useState)(!0),2),Y=q[0],K=q[1],G=(F=window.location.pathname.split("/"))[F.length-1];(0,r.useEffect)((function(){b((function(){var e,t,n,r;return k(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,3,4]),[4,(0,y.Gn)(G)];case 1:return t=l.sent(),L(t),n=(null==t||null===(e=t.lineItems)||void 0===e?void 0:e.map((function(e){var t;return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:(null===(t=e.paymentStatus)||void 0===t?void 0:t.toUpperCase())||"PENDING"}})))||[],M(n),[3,4];case 2:return r=l.sent(),console.error("Failed to fetch bill",r),[3,4];case 3:return K(!1),[7];case 4:return[2]}}))}))()}),[G,M]);var z=(null==O?void 0:O.receiptNumber)||(null==O?void 0:O.id)||"",V=(null==O||null===(e=O.cashPoint)||void 0===e?void 0:e.name)||"",W=(null==O?void 0:O.status)||"",Q=(null==O||null===(t=O.patient)||void 0===t?void 0:t.display)||"",$=_((0,r.useState)([]),2),X=$[0],J=$[1],Z=_((0,r.useState)(null),2),ee=Z[0],te=Z[1],ne=_((0,r.useState)(""),2),re=ne[0],le=ne[1],ae=_((0,r.useState)("AMOUNT"),2),ie=ae[0],oe=ae[1],ce=_((0,r.useState)(""),2),ue=ce[0],se=ce[1],me=_((0,r.useState)(""),2),de=me[0],fe=me[1],pe=_((0,r.useState)(null),2),ye=(pe[0],pe[1]),he=_((0,r.useState)(1),2),Ae=(he[0],he[1]),ve=_((0,r.useState)(null),2),be=ve[0],Ee=ve[1],ge=_((0,r.useState)(!1),2),we=ge[0],_e=ge[1],Ce=(Number(ue||0),Number(de||0));(0,r.useEffect)((function(){se(""),fe("")}),[ie]);var Se=function(e){return e.price*e.quantity-(e.paidQuantity||0)*e.price-(e.waivedAmount||0)-(e.claimedAmount||0)},ke=function(e,t,n){J((function(r){return C(r).concat([{id:"".concat(e,"-").concat(r.length+1),type:e,items:t,totalAmount:n,reference:"CASH"===e?re:void 0,timestamp:(new Date).toLocaleString()}])}))},xe=H.length>0&&H.every((function(e){return"SHA"===(e.payerType||"").toUpperCase()})),Ie=H.filter((function(e){return"PENDING"===e.status&&I.includes(e.payerType.toUpperCase())})),Ne=Ie.length>0,Te=H.filter((function(e){return function(e){var t;return I.includes((null!==(t=e.payerType)&&void 0!==t?t:"").toUpperCase())}(e)&&["CLAIMED","PAID"].includes(function(e){var t;return(null!==(t=e.status)&&void 0!==t?t:"").toUpperCase()}(e))})).length>0,Pe=H.filter((function(e){var t;return N.includes((null!==(t=e.payerType)&&void 0!==t?t:"").toUpperCase())})).every((function(e){var t;return"PAID"===(null!==(t=e.status)&&void 0!==t?t:"").toUpperCase()})),De=H.filter((function(e){var t;return e.selected&&N.includes((null!==(t=e.payerType)&&void 0!==t?t:"").toUpperCase())&&"PENDING"===e.status})),Ue=H.reduce((function(e,t){var n,r,l,a,i=(null!==(n=t.payerType)&&void 0!==n?n:"").toString().trim().toUpperCase(),o=(null!==(r=t.status)&&void 0!==r?r:"").toString().trim().toUpperCase(),c=Number(null!==(l=t.quantity)&&void 0!==l?l:0),u=Number(null!==(a=t.price)&&void 0!==a?a:0);return N.includes(i)&&"PAID"===o?e+c*u:e}),0),Be=H.reduce((function(e,t){return e+t.price*t.quantity}),0),Fe=H.reduce((function(e,t){return e+(t.waivedAmount||0)}),0),je=H.reduce((function(e,t){var n,r,l,a=(null!==(n=t.payerType)&&void 0!==n?n:"").toUpperCase(),i=(null!==(r=t.status)&&void 0!==r?r:"").toUpperCase();return!I.includes(a)||"CLAIMED"!==i&&"PAID"!==i?e:e+(null!==(l=t.claimedAmount)&&void 0!==l?l:t.price*t.quantity)}),0),Oe=C(new Set(Ie.map((function(e){return e.payerType})))).join(", "),Le=function(e,t,n){(0,o.showSnackbar)({kind:e,title:t,subtitle:n})},Re=Be-(Ue+je+Fe);(0,r.useEffect)((function(){M((function(e){return 0===e.length?e:e.map((function(e){return xe||"PENDING"===e.status&&"SHA"===e.payerType.toUpperCase()?w(g({},e),{selected:!0}):e}))}))}),[xe]);var He=(null==O||null===(A=O.patient)||void 0===A||null===(a=A.identifiers)||void 0===a||null===(n=a.find((function(e){var t,n;return null===(n=e.identifierType)||void 0===n||null===(t=n.display)||void 0===t?void 0:t.toLowerCase().includes("cr")})))||void 0===n?void 0:n.identifier)||"",Me=(null==O||null===(E=O.cashPoint)||void 0===E||null===(v=E.location)||void 0===v?void 0:v.uuid)||"",qe=function(e){switch(e){case"PAID":return l().createElement(i.vwO,{type:"green"},"Paid (Cash)");case"CLAIMED":return l().createElement(i.vwO,{type:"blue"},"Claimed");case"WAIVED":return l().createElement(i.vwO,{type:"purple"},"Waived");default:return l().createElement(i.vwO,{type:"red"},"Pending")}},Ye=(X.map((function(e){var t,n;return{id:e.id,timestamp:e.timestamp,type:e.type,items:e.items.map((function(e){return e.service})).join(", "),totalAmount:e.totalAmount,reference:null!==(n=null!==(t=e.reference)&&void 0!==t?t:e.claimNumber)&&void 0!==n?n:"-"}})),function(){return 0===Re?"Fully Settled":Re<Be?"Partially Settled":"Unpaid"}),Ke=De.length>0?De[0].payerType:"Payment",Ge=Ne&&(xe||Pe)?"RAISE":!Ne&&Te?"STATUS":null,ze="".concat(W).concat(Ye()?" (".concat(Ye(),")"):""),Ve=_((0,r.useState)(!1),2),We=Ve[0],Qe=Ve[1],$e=_((0,r.useState)(!1),2),Xe=$e[0],Je=$e[1],Ze=_((0,r.useState)(!1),2),et=Ze[0],tt=Ze[1];return l().createElement(i.xA9,{fullWidth:!0,style:{padding:"0"}},l().createElement(i.VPZ,{lg:16,style:{marginTop:"1rem"}},l().createElement(i.QpV,{style:{marginBottom:"1rem"}},l().createElement(i.J53,{onClick:D},"Billing Dashboard"),l().createElement(i.J53,{isCurrentPage:!0},Y?l().createElement(i.rrI,{width:"120px"}):z)),l().createElement(i.FAs,{style:{paddingTop:"1rem"}},Y?l().createElement(i.rrI,{width:"200px"}):l().createElement(l().Fragment,null,l().createElement("h5",{style:{marginBottom:"0.5rem"}},Q),He&&Me&&l().createElement(h.A,{crId:He,locationUuid:Me})),l().createElement(i.xA9,{fullWidth:!0},l().createElement(i.VPZ,{sm:4,md:4,lg:4},l().createElement("p",null,l().createElement("strong",null,"Bill No:")," ",Y?l().createElement(i.rrI,{width:"100px"}):z)),l().createElement(i.VPZ,{sm:4,md:4,lg:4},l().createElement("p",null,l().createElement("strong",null,"Cash Point:")," ",Y?l().createElement(i.rrI,{width:"120px"}):V)),l().createElement(i.VPZ,{sm:4,md:4,lg:4},l().createElement("p",null,l().createElement("strong",null,"Bill Date:")," ",Y?l().createElement(i.rrI,{width:"150px"}):T(null==O?void 0:O.dateCreated)))))),l().createElement(i.VPZ,{lg:16},l().createElement("div",{style:{borderTop:"1px solid #e0e0e0",paddingTop:"1rem",marginTop:"1rem",background:"#fff"}},l().createElement(i.xA9,{fullWidth:!0},l().createElement(i.VPZ,{lg:12},l().createElement(i.FAs,null,!Pe&&l().createElement(i.FAs,{style:{background:"#fff5f5",border:"1px solid #f5c2c2",borderRadius:"8px",padding:"1rem",marginBottom:"1rem",width:"100%"}},l().createElement("p",{style:{color:"#da1e28",margin:0,fontSize:"0.9rem",lineHeight:1.5}},"Please select cash/M-Pesa item(s) to continue. SHA claims (if any) will be available after all cash payments are completed.")),l().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1rem"}},l().createElement("h4",null,l().createElement("u",null,"Bill Items")),l().createElement(i.BJc,{orientation:"horizontal",gap:2},De.length>0&&l().createElement(i.$nd,{disabled:Y,renderIcon:c.v0,size:"sm",onClick:function(){return te("CASH")}},"Pay Selected ",Ke," Items"),"RAISE"===Ge&&l().createElement(i.$nd,{disabled:Y||we,size:"sm",kind:"secondary",renderIcon:u.pT,onClick:function(){window.confirm("Raise SHA claim for this bill?\n\nConfirm that all cash items are settled if any and that there are no additional items to add to the claim.")&&te("SHA")}},"Raise SHA Claim"),"STATUS"===Ge&&l().createElement(i.$nd,{disabled:Y||we,size:"sm",kind:"tertiary",renderIcon:s.Ss,onClick:function(){return b((function(){var e;return k(this,(function(t){switch(t.label){case 0:return G?(_e(!0),[4,(0,y.$k)(G)]):[2,(0,o.showSnackbar)({kind:"error",title:"SHA Claim Status",subtitle:"Bill ID is required"})];case 1:return(e=t.sent()).success?(Ee(e.data),te("CHECK_SHA"),_e(!1),[2]):(_e(!1),[2,(0,o.showSnackbar)({kind:"error",title:"SHA Claim Status",subtitle:e.message})])}}))}))()}},we?"Checking Status...":"Check SHA Claim Status"),Re>0&&l().createElement(i.$nd,{disabled:Y,renderIcon:m.NA,size:"sm",kind:"tertiary",onClick:function(){return te("WAIVER")}},"Apply Waiver"),0===Re&&"PENDING"===W&&l().createElement(i.$nd,{size:"sm",kind:"primary",renderIcon:d.cU,onClick:function(){window.confirm("Finalize bill? This action cannot be undone.")&&(K(!0),(0,y.yj)(G).then((function(){return Le("success","Finalize Bill","Bill finalized successfully"),(0,y.Gn)(G)})).then((function(e){var t;L(e);var n=(null==e||null===(t=e.lineItems)||void 0===t?void 0:t.map((function(e){var t;return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:(null===(t=e.paymentStatus)||void 0===t?void 0:t.toUpperCase())||"PENDING"}})))||[];M(n)})).catch((function(e){console.error("Failed to finalize bill",e),Le("error","Finalize Bill","Failed to finalize bill. Please try again.")})).finally((function(){return K(!1)})))}},"Finalize Bill"),0===Re&&"PAID"===W&&l().createElement(i.$nd,{disabled:!0,size:"sm",kind:"tertiary",renderIcon:d.TA,onClick:function(){var e="/billing/print-receipt/".concat(G);window.open(e,"_blank")}},"Print Receipt"))),Y?l().createElement(i.PuA,{style:{height:"300px",width:"100%"}}):l().createElement(i.bQt,{rows:H,headers:x},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){var t,n=H.find((function(t){return t.id===e.id}));return l().createElement(i.Hjg,g({key:n.id},a({row:e})),l().createElement(i.nA6,null,n.service),l().createElement(i.nA6,null,n.payerType),l().createElement(i.nA6,null,n.quantity),l().createElement(i.nA6,null,"Ksh ",n.price),l().createElement(i.nA6,null,"Ksh ",Se(n)),l().createElement(i.nA6,null,"SHA"===n.payerType.toUpperCase()&&"PAID"===n.status.toUpperCase()?qe("CLAIMED"):qe(n.status)),l().createElement(i.nA6,null,l().createElement(i.Sc0,{id:"select-".concat(n.id),labelText:"",checked:!!xe||!!n.selected,disabled:"PENDING"!==n.status||xe||!N.includes((null!==(t=n.payerType)&&void 0!==t?t:"").toUpperCase()),onChange:function(){return e=n.id,M((function(t){return t.map((function(t){return t.id===e?w(g({},t),{selected:!t.selected}):t}))}));var e}})),l().createElement(i.nA6,null,l().createElement(i.obU,{ariaLabel:"Actions",size:"sm",disabled:"PENDING"!==n.status},l().createElement(i.XSD,{itemText:"Edit Quantity",onClick:function(){return ye(e=n),Ae(e.quantity),void te("EDIT_QUANTITY");var e}}),l().createElement(i.XSD,{itemText:"Delete Item",onClick:function(){ye(n),te("CONFIRM_DELETE")}}))))}))))}))),(null==O||null===(S=O.payments)||void 0===S?void 0:S.length)>0&&l().createElement(i.FAs,{style:{marginTop:"1rem"}},l().createElement("h4",{style:{marginBottom:"1rem"}},l().createElement("u",null,"Payment Details")),l().createElement(i.bQt,{rows:O.payments.map((function(e){var t;return{id:e.uuid,type:(null===(t=e.instanceType)||void 0===t?void 0:t.name)||"-",amount:P(e.amount),amountTendered:e.amountTendered?P(e.amountTendered):"-",dateCreated:T(e.dateCreated)}})),headers:[{key:"type",header:"Payment Type"},{key:"amount",header:"Amount"},{key:"amountTendered",header:"Amount Tendered"},{key:"dateCreated",header:"Date / Time"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value||"-")})))}))))})))),l().createElement(i.VPZ,{lg:4},l().createElement(i.FAs,{style:{padding:"1.5rem"}},l().createElement("h4",{style:{marginBottom:"1rem"}},l().createElement("u",null,"Bill Summary")),l().createElement(i.BJc,{gap:3},Y?l().createElement(i.rrI,{width:"100%"}):l().createElement(i.vwO,{type:0===Re?"green":Re<Be?"teal":"red"},0===Re&&l().createElement(f._j,{size:12,style:{marginRight:4}}),Re>0&&Re<Be&&l().createElement(s.Cp,{size:12,style:{marginRight:4}}),Re===Be&&l().createElement(p.GU,{size:12,style:{marginRight:4}}),ze),l().createElement("hr",{style:{border:"none",borderTop:"1px solid #e0e0e0"}}),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{fontWeight:"bold"}},"Total"),l().createElement("strong",null,Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Be).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{color:"#24a148",fontWeight:"bold"}},"Paid"),l().createElement("strong",{style:{color:"#24a148"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Ue).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{color:"#0f62fe",fontWeight:"bold"}},"Claimed"),l().createElement("strong",{style:{color:"#0f62fe"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(je).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{color:"#8a3ffc",fontWeight:"bold"}},"Waived"),l().createElement("strong",{style:{color:"#8a3ffc"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Fe).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))),l().createElement("hr",{style:{border:"none",borderTop:"1px solid #e0e0e0"}}),l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement("span",{style:{fontWeight:"bold"}},"Balance"),l().createElement("strong",{style:{color:Re>0?"#da1e28":"#24a148",fontSize:"1.1rem"}},Y?l().createElement(i.rrI,{width:"100px"}):"Ksh ".concat(Number(Re).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})))))))))),l().createElement(i.aFV,{open:"CASH"===ee,modalHeading:"Confirm Payment for ".concat(Ke," Items"),primaryButtonText:We?"Processing...":"Submit",secondaryButtonText:"Cancel",primaryButtonDisabled:We,onRequestClose:function(){return te(null)},onRequestSubmit:function(){return b((function(){var e,t,n,r,l,a,i,o,c,u,s,m,d,f,p;return k(this,(function(h){switch(h.label){case 0:if(!re.trim())return[2,Le("error","Cash Payment","Payment reference required")];0===De.length&&Le("error","Cash Payment","No items selected"),h.label=1;case 1:return h.trys.push([1,6,,7]),Qe(!0),[4,(0,y.x_)()];case 2:return l=h.sent(),a=null===(t=De[0])||void 0===t||null===(e=t.payerType)||void 0===e?void 0:e.toUpperCase(),(i=l.results.find((function(e){var t;return(null!==(t=e.name)&&void 0!==t?t:"").toUpperCase()===a})))?(o=i.uuid,De.length>0&&(null===(n=De[0])||void 0===n||n.payerType),c={instanceType:o,amount:De.reduce((function(e,t){return e+Se(t)}),0),amountTendered:De.reduce((function(e,t){return e+Se(t)}),0)},[4,(0,y.wh)(G,c)]):(Qe(!1),Le("error",a||"Payment","".concat(a||"Selected"," payment mode not found")),[2]);case 3:return h.sent().ok?(u={billUuid:G,cashModeUuid:o,billItemsUuid:De.map((function(e){return e.id}))},[4,(0,y.wH)(u)]):(Qe(!1),Le("error","Cash Payment","Payment processing failed"),[2]);case 4:return(null==(s=h.sent())?void 0:s.success)?(Le("success","Cash Payment","Payment processed successfully"),[4,(0,y.Gn)(G)]):(Qe(!1),Le("error","Cash Payment",null!==(m=null==s?void 0:s.message)&&void 0!==m?m:"Status update failed"),[2]);case 5:return d=h.sent(),L(d),f=(null==d||null===(r=d.lineItems)||void 0===r?void 0:r.map((function(e){return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:e.paymentStatus&&e.paymentStatus.toUpperCase()||"CASH"}})))||[],M(f),ke("CASH",De,c.amountTendered),le(""),te(null),Qe(!1),[3,7];case 6:return p=h.sent(),console.error("Payment failed",p),Qe(!1),Le("error","Cash Payment","Payment failed. Please try again."),[3,7];case 7:return[2]}}))}))()}},l().createElement("div",{style:{marginBottom:"1rem"}},l().createElement(i.ksK,{id:"cash-payment-ref",labelText:"Payment Reference",value:re,onChange:function(e){return le(e.target.value)}})),l().createElement("ul",null,De.map((function(e){return l().createElement("li",{key:e.id,style:{marginBottom:"0.5rem"}},e.service," - Ksh ",Se(e))}))),l().createElement("p",{style:{marginTop:"1rem"}},l().createElement("strong",null,"Total: Ksh ",De.reduce((function(e,t){return e+Se(t)}),0)))),l().createElement(i.aFV,{open:"WAIVER"===ee,modalHeading:"Apply Waiver",primaryButtonText:Xe?"Applying...":"Submit",secondaryButtonText:"Cancel",primaryButtonDisabled:Xe||("PERCENT"===ie?""===ue||Number(ue)<1||Number(ue)>100:""===de||Number(de)<1),onRequestClose:function(){return te(null)},onRequestSubmit:function(){return b((function(){var e,t,n,r,l,a,i,o;return k(this,(function(c){switch(c.label){case 0:return[2,Le("error","Waiver Application","Waiver functionality is currently unavailable. Please contact support.")];case 1:return n=c.sent(),(r=n.results.find((function(e){return"waiver"===e.name.toLowerCase()})))||Le("error","Waiver Application","Waiver payment mode not found. Please contact support."),l=r.uuid,a={instanceType:l,amount:t,amountTendered:t},[4,(0,y.wh)(G,a)];case 2:return c.sent().ok||Le("error","Waiver Application","Failed to apply waiver. Please try again or contact support."),Le("success","Waiver Application","Waiver applied successfully"),[4,(0,y.Gn)(G)];case 3:return i=c.sent(),L(i),o=(null==i||null===(e=i.lineItems)||void 0===e?void 0:e.map((function(e){return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:e.paymentStatus&&e.paymentStatus.toUpperCase()||"CASH"}})))||[],M(o),ke("WAIVER",H.filter((function(e){return e.waiverAllowed})),Ce),fe(""),se(""),te(null),Je(!1),[2]}}))}))()}},l().createElement("div",{style:{marginBottom:"1rem"}},l().createElement("label",{htmlFor:"waiver-type-amount"},l().createElement("input",{type:"radio",id:"waiver-type-amount",name:"waiver-type",value:"AMOUNT",checked:"AMOUNT"===ie,onChange:function(){return oe("AMOUNT")}})," ","Amount"),l().createElement("label",{htmlFor:"waiver-type-percent",style:{marginLeft:"1rem"}},l().createElement("input",{type:"radio",id:"waiver-type-percent",name:"waiver-type",value:"PERCENT",checked:"PERCENT"===ie,onChange:function(){return oe("PERCENT")}})," ","Percentage")),"PERCENT"===ie?l().createElement(i.Q7x,{id:"waiver-percent",label:"Waiver Percentage",min:0,max:100,value:ue,invalid:""!==ue&&(Number(ue)<1||Number(ue)>100),invalidText:"Percentage must be between 1 and 100",onChange:function(e,t){return se(String(t.value))}}):l().createElement(i.Q7x,{id:"waiver-amount",label:"Waiver Amount",min:0,value:de,invalid:""!==de&&Number(de)<1,invalidText:"Amount cannot be less than 1",onChange:function(e,t){return fe(String(t.value))}})),l().createElement(i.aFV,{open:"SHA"===ee,modalHeading:"Confirm ".concat(Oe," Claim"),primaryButtonText:et?"Submitting...":"Submit Claim",secondaryButtonText:"Cancel",primaryButtonDisabled:et,onRequestClose:function(){return te(null)},onRequestSubmit:function(){return b((function(){var e,t,n,r,l,a,i,o,c,u,s;return k(this,(function(m){switch(m.label){case 0:return m.trys.push([0,7,8,9]),tt(!0),[4,(0,y.x_)()];case 1:return t=m.sent(),(n=t.results.find((function(e){return I.includes(e.name.toUpperCase())})))?[4,(0,y.$k)(G)]:(Le("error","SHA Claim","SHA payment mode not found. Please contact support."),tt(!1),[2]);case 2:return r=m.sent(),l=!1,r.success&&r.data&&(l=!0),l?[3,4]:[4,(0,y.tA)(G)];case 3:if(!(a=m.sent()).success)return Le("error","SHA Claim",a.message||"Failed to raise SHA claim."),tt(!1),[2];m.label=4;case 4:return i=Ie.reduce((function(e,t){return e+Se(t)}),0),o={instanceType:n.uuid,amount:i,amountTendered:i},[4,(0,y.wh)(G,o)];case 5:return m.sent().ok?[4,(0,y.Gn)(G)]:(Le("error","SHA Claim","Payment failed after claim creation."),tt(!1),[2]);case 6:return c=m.sent(),L(c),u=(null==c||null===(e=c.lineItems)||void 0===e?void 0:e.map((function(e){var t;return{id:e.uuid,service:e.billableService||"Service",payerType:e.priceName&&e.priceName.toUpperCase()||"CASH",supportsSha:e.supportsSha||!1,waiverAllowed:e.waiverAllowed||!1,quantity:e.quantity||1,price:e.price||0,status:(null===(t=e.paymentStatus)||void 0===t?void 0:t.toUpperCase())||"PENDING"}})))||[],M(u),ke("SHA",Ie,i),Le("success","SHA Claim","SHA claim processed successfully"),te(null),[3,9];case 7:return s=m.sent(),console.error("SHA claim flow failed",s),Le("error","SHA Claim","Unexpected error while processing SHA claim."),[3,9];case 8:return tt(!1),[7];case 9:return[2]}}))}))()}},l().createElement(i.BJc,{gap:4},l().createElement(i.FAs,null,l().createElement("p",{style:{marginBottom:"0.5rem"}},"You are about to submit the following items for ",l().createElement("strong",null,Oe," claim"),"."),l().createElement("p",{style:{color:"#6f6f6f",marginBottom:0}},"Please confirm all services are correct before proceeding.")),l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"1rem"}},"Claim Items"),l().createElement(i.bQt,{rows:Ie.map((function(e){return{id:e.id,service:e.service,quantity:e.quantity,unitPrice:"Ksh ".concat(Number(e.price).toLocaleString()),total:"Ksh ".concat(Se(e).toLocaleString())}})),headers:[{key:"service",header:"Service"},{key:"quantity",header:"Qty"},{key:"unitPrice",header:"Unit Price"},{key:"total",header:"Total"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,{size:"sm",useZebraStyles:!0},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value)})))}))))}))),l().createElement(i.FAs,null,l().createElement(i.xA9,{fullWidth:!0},l().createElement(i.VPZ,{lg:8},l().createElement("p",null,l().createElement("strong",null,"Items:")," ",Ie.length)),l().createElement(i.VPZ,{lg:8,style:{textAlign:"right"}},l().createElement("p",{style:{fontSize:"1.1rem",fontWeight:600}},"Total: Ksh ",Ie.reduce((function(e,t){return e+Se(t)}),0).toLocaleString())))))),l().createElement(i.aFV,{open:"CHECK_SHA"===ee,modalHeading:"SHA Claim Status",primaryButtonText:"Close",secondaryButtonText:null,onRequestClose:function(){return te(null)},onRequestSubmit:function(){return te(null)}},be?l().createElement(i.BJc,{gap:4},l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"0.5rem"}},"Patient Information"),l().createElement("p",null,l().createElement("strong",null,"Name:")," ",be.patientFullName),l().createElement("p",null,l().createElement("strong",null,"Gender:")," ",be.gender),l().createElement("h5",{style:{marginTop:"1rem",marginBottom:"0.5rem"}},"Facility"),l().createElement("p",null,be.facilityName," (",be.facilityLevel,")")),l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"0.5rem"}},"Claim Details"),l().createElement("p",null,l().createElement("strong",null,"Status:")," ",l().createElement(i.vwO,{type:function(e){var t=(null==e?void 0:e.toLowerCase())||"";return t.includes("approved")||t.includes("paid")?"green":t.includes("pending")?"warm-gray":t.includes("rejected")||t.includes("failed")?"red":"cool-gray"}(be.claim_Status)},be.claim_Status)),l().createElement("p",null,l().createElement("strong",null,"Response:")," ",be.claim_Response||"-")),(null===(U=be.services)||void 0===U?void 0:U.length)>0&&l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"1rem"}},"Services"),l().createElement(i.bQt,{rows:be.services.map((function(e){return{id:e.serviceCode,name:e.serviceDisplay,code:e.serviceCode,quantity:e.quantity,amount:"Ksh ".concat(Number(e.totalAmount).toLocaleString())}})),headers:[{key:"name",header:"Service"},{key:"code",header:"Code"},{key:"quantity",header:"Qty"},{key:"amount",header:"Total Amount"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,{size:"sm"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value)})))}))))}))),(null===(B=be.diagnoses)||void 0===B?void 0:B.length)>0&&l().createElement(i.FAs,null,l().createElement("h5",{style:{marginBottom:"1rem"}},"Diagnoses"),l().createElement(i.bQt,{rows:be.diagnoses.map((function(e,t){return{id:"".concat(e.Code,"-").concat(t),name:e.Display,code:e.Code}})),headers:[{key:"name",header:"Diagnosis"},{key:"code",header:"Code"}]},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,a=e.getRowProps;return l().createElement(i.XIK,{size:"sm"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,n.map((function(e){return l().createElement(i.A0N,g({key:e.key},r({header:e})),e.header)})))),l().createElement(i.BFY,null,t.map((function(e){return l().createElement(i.Hjg,g({key:e.id},a({row:e})),e.cells.map((function(e){return l().createElement(i.nA6,{key:e.id},e.value)})))}))))})))):l().createElement(i.FAs,null,l().createElement("p",null,"No claim data available."))))};var B=n(85072),F=n.n(B),j=n(97825),O=n.n(j),L=n(77659),R=n.n(L),H=n(55056),M=n.n(H),q=n(10540),Y=n.n(q),K=n(41113),G=n.n(K),z=n(73637),V={};V.styleTagTransform=G(),V.setAttributes=M(),V.insert=R().bind(null,"head"),V.domAPI=O(),V.insertStyleElement=Y(),F()(z.A,V);const W=z.A&&z.A.locals?z.A.locals:void 0;var Q=function(e){return e.Bills="BILLS",e.BillDetails="Details",e}({}),$=function(e){return e.WrongPatient="WRONG_PATIENT",e.NoServiceGiven="NO_SERVICE_GIVEN",e.WringBenefit="WRONG_BENEFIT",e.ExpiredVisit="EXPIRED_VISIT",e.ExhaustedBenefit="EXHAUSTED_BENEFIT",e.TimeBarred="TIME_BARRED",e.OtherReasons="OTHER_REASONS",e}({}),X=n(62801),J=n(23492);function Z(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Z(a,r,l,i,o,"next",e)}function o(e){Z(a,r,l,i,o,"throw",e)}i(void 0)}))}}function te(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function ne(e){return ee((function(){var t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n="".concat(t,"/claim-preview/provider"),[4,(0,o.openmrsFetch)(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))()}function re(e){return ee((function(){var t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n="".concat(t,"/claim-line"),[4,(0,o.openmrsFetch)(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))()}function le(e){return ee((function(){var t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n="".concat(t,"/claim-diagnosis"),[4,(0,o.openmrsFetch)(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))()}var ae=n(36350),ie={};ie.styleTagTransform=G(),ie.setAttributes=M(),ie.insert=R().bind(null,"head"),ie.domAPI=O(),ie.insertStyleElement=Y(),F()(ae.A,ie);const oe=ae.A&&ae.A.locals?ae.A.locals:void 0;var ce=n(86375),ue={};ue.styleTagTransform=G(),ue.setAttributes=M(),ue.insert=R().bind(null,"head"),ue.domAPI=O(),ue.insertStyleElement=Y(),F()(ce.A,ue);const se=ce.A&&ce.A.locals?ce.A.locals:void 0;var me=n(91558),de=n(64870),fe={};fe.styleTagTransform=G(),fe.setAttributes=M(),fe.insert=R().bind(null,"head"),fe.domAPI=O(),fe.insertStyleElement=Y(),F()(de.A,fe);const pe=de.A&&de.A.locals?de.A.locals:void 0;var ye=n(61240),he={};he.styleTagTransform=G(),he.setAttributes=M(),he.insert=R().bind(null,"head"),he.domAPI=O(),he.insertStyleElement=Y(),F()(ye.A,he);const Ae=ye.A&&ye.A.locals?ye.A.locals:void 0;var ve=n(83983);function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ee(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function ge(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Ee(a,r,l,i,o,"next",e)}function o(e){Ee(a,r,l,i,o,"throw",e)}i(void 0)}))}}function we(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?be(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _e(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const Ce=function(e){var t=e.open,n=e.onClose,a=e.onPay,c=e.billItem,u=we((0,r.useState)(0),2),s=u[0],m=u[1],d=we((0,r.useState)([]),2),f=d[0],p=d[1],y=(0,r.useMemo)((function(){return f.find((function(e){return e.name===c.payment_scheme}))}),[f,c]),h=we((0,r.useState)(""),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){c&&ge((function(){var e;return _e(this,(function(t){switch(t.label){case 0:return[4,(0,ve.x_)()];case 1:return e=t.sent(),p(e),[2]}}))}))()}),[c]),l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Bill Item Payment",open:t,size:"sm",onSecondarySubmit:n,onRequestClose:n,onRequestSubmit:function(){return ge((function(){var e;return _e(this,(function(t){switch(t.label){case 0:e={instanceType:y?null!==(n=y.uuid)&&void 0!==n?n:"":null!=A?A:"",amountTendered:s,amount:c.item_total_price},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(r=c.bill_uuid,l=e,ee((function(){var e,t;return te(this,(function(n){switch(n.label){case 0:return e="".concat(o.restBaseUrl,"/billing/bill/").concat(r,"/payment"),[4,(0,o.openmrsFetch)(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})];case 1:return[4,n.sent().json()];case 2:return[2,null!=(t=n.sent())?t:null]}}))}))())];case 2:return t.sent()&&((0,o.showSnackbar)({kind:"success",title:"Bill item payment succesfully made",subtitle:""}),a()),[3,4];case 3:return t.sent(),(0,o.showSnackbar)({kind:"error",title:"An error occurred while making bill item payment",subtitle:"An error occurred while making bill item payment, please try again or contact support"}),[3,4];case 4:return[2]}var n,r,l}))}))()},primaryButtonText:"Pay",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:Ae.biModalLayout},l().createElement("div",{className:Ae.biRow},l().createElement(i.ksK,{id:"bill-item",labelText:"Billable Item",value:"".concat(c.billable_service),readOnly:!0})),l().createElement("div",{className:Ae.biRow},l().createElement(i.ksK,{id:"bill-item-amount",labelText:"Amount",value:"Ksh ".concat(c.item_total_price),readOnly:!0})),l().createElement("div",{className:Ae.biRow},y?l().createElement(l().Fragment,null,l().createElement(i.ksK,{id:"insurance-scheme",labelText:"Payment Mode",value:null==y?void 0:y.name,readOnly:!0})):l().createElement(l().Fragment,null,l().createElement(i.l6P,{id:"cash-point",labelText:"Cash Point",onChange:function(e){return t=e.target.value,void v(t);var t}},l().createElement(i.ebT,{value:"",text:"Select"}),";",f&&f.map((function(e){return l().createElement(i.ebT,{value:e.uuid,text:e.name})}))))),l().createElement("div",{className:Ae.biRow},l().createElement(i.ksK,{id:"insurance-scheme",labelText:"Pay Amount",type:"number",onChange:function(e){return t=parseInt(e.target.value),void m(t);var t}}))))))};var Se=n(5876),ke={};ke.styleTagTransform=G(),ke.setAttributes=M(),ke.insert=R().bind(null,"head"),ke.domAPI=O(),ke.insertStyleElement=Y(),F()(Se.A,ke);const xe=Se.A&&Se.A.locals?Se.A.locals:void 0;function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ne(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}const Te=function(e){var t,n,a=e.open,c=e.onClose,u=e.onSuccess,s=e.billItem,m=e.locationUuid,d=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=d[0],p=d[1];return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Add Claim Line",open:a,size:"md",onSecondarySubmit:c,onRequestClose:c,onRequestSubmit:f?function(){}:function(){return(e=function(){var e,t,n,r;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(l){switch(l.label){case 0:p(!0),e={consentToken:s.consent_token,interventionCode:s.intervention_code,unitPrice:String(s.item_price),quantity:String(s.item_quantity),locationUuid:m},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,re(e)];case 2:return(t=l.sent()).error?((0,o.showSnackbar)({title:null!==(n=t.error)&&void 0!==n?n:"Error Adding Claim Line",kind:"error",subtitle:null!==(r=t.message)&&void 0!==r?r:"An error occurred while adding the claim line. Kindy retry or contact support"}),u()):(0,o.showSnackbar)({title:"Sucess Adding Claim Line",kind:"success",subtitle:"Claim Item added successfully"}),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error Adding Claim Line",subtitle:"An error occurred while adding the claim line. Kindy retry or contact support"}),[3,5];case 4:return p(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Ne(a,r,l,i,o,"next",e)}function o(e){Ne(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:f?"Adding...":"Add",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:xe.addClaimLineModalLayout},l().createElement("div",{className:xe.addClaimLineModalRow},l().createElement(i.ksK,{id:"bill-item",labelText:"Intervention Code",value:s.intervention_code,readOnly:!0})),l().createElement("div",{className:xe.addClaimLineModalRow},l().createElement(i.ksK,{id:"bill-item-amount",labelText:"Unit Price",value:"Ksh ".concat(s.item_price),readOnly:!0})),l().createElement("div",{className:xe.addClaimLineModalRow},l().createElement(i.ksK,{id:"bill-item-amount",labelText:"Quantity",value:s.item_quantity,readOnly:!0}))))))};var Pe=n(70328),De={};De.styleTagTransform=G(),De.setAttributes=M(),De.insert=R().bind(null,"head"),De.domAPI=O(),De.insertStyleElement=Y(),F()(Pe.A,De);const Ue=Pe.A&&Pe.A.locals?Pe.A.locals:void 0;function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fe(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}const je=function(e){var t,n,a=e.open,c=e.onClose,u=e.onSuccess,s=e.amrsVisitDiagnosis,m=e.interventionCode,d=e.consentToken,f=e.locationUuid,p=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Be(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=p[0],h=p[1];return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Add Claim Diagnosis",open:a,size:"md",onSecondarySubmit:c,onRequestClose:c,onRequestSubmit:y?function(){}:function(){return(e=function(){var e,t,n,r;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(l){switch(l.label){case 0:h(!0),e={consentToken:d,interventionCode:m,locationUuid:f,icdCode:s.icd11_code},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,le(e)];case 2:return(t=l.sent()).error?((0,o.showSnackbar)({title:null!==(n=t.error)&&void 0!==n?n:"Error Adding Claim Diagnosis",kind:"error",subtitle:null!==(r=t.message)&&void 0!==r?r:"An error occurred while adding the claim disgnosis. Kindy retry or contact support"}),u()):(0,o.showSnackbar)({title:"Sucess Adding Claim Diagnosis",kind:"success",subtitle:"Claim Item added successfully"}),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error Adding Claim Diagnosis",subtitle:"An error occurred while adding the Claim Diagnosis. Kindy retry or contact support"}),[3,5];case 4:return h(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Fe(a,r,l,i,o,"next",e)}function o(e){Fe(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:y?"Adding...":"Add",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:Ue.addClaimDiagnosisModalLayout},l().createElement("div",{className:Ue.addClaimDiagnosisModalRow},l().createElement(i.ksK,{id:"intervention-code",labelText:"Intervention Code",value:m,readOnly:!0})),l().createElement("div",{className:Ue.addClaimDiagnosisModalRow},l().createElement(i.ksK,{id:"icd11Code",labelText:"ICD11 Diagnosis",value:s.icd11_code,readOnly:!0}))))))};function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oe(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Re=function(e){var t=e.amrsVisitDiagnosis,n=e.consentToken,a=e.interventionCode,c=e.locationUuid,u=function(){y(!1)},s=Le((0,r.useState)(null),2),m=s[0],d=s[1],f=Le((0,r.useState)(!1),2),p=f[0],y=f[1];return l().createElement(l().Fragment,null,l().createElement("div",null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Encounter Date"),l().createElement(i.A0N,null,"Encounter Type"),l().createElement(i.A0N,null,"ICD11 Diagnosis"),l().createElement(i.A0N,null,"Actions"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.encounter_id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.encounter_datetime))),l().createElement(i.nA6,null,e.encounter_type),l().createElement(i.nA6,null,e.icd11_code),l().createElement(i.nA6,null,l().createElement(i.obU,{"aria-label":"overflow-menu"},l().createElement(i.XSD,{itemText:"Add Claim Diagnosis",onClick:function(){return function(e){d(e),y(!0)}(e)}})))))})))),p&&m&&l().createElement(je,{consentToken:n,amrsVisitDiagnosis:m,locationUuid:c,interventionCode:a,open:p,onClose:u,onSuccess:u})))};function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Me(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return He(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?He(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const qe=function(e){var t=e.patientBillDetails,n=e.patientPayments,a=e.amrsVisitDiagnosis,c=e.consentToken,u=e.locationUuid,s=function(){p(!1)},m=function(){A(!1)},d=Me((0,r.useState)(!1),2),f=d[0],p=d[1],y=Me((0,r.useState)(!1),2),h=y[0],A=y[1],v=Me((0,r.useState)(null),2),b=v[0],E=v[1],g=(0,r.useMemo)((function(){return function(){if(!t||0===t.length)return"";var e,n=t.find((function(e){return e.billable_service.toLocaleLowerCase().trim().includes("consultation")}));return n?n.intervention_code:null!==(e=t[0].intervention_code)&&void 0!==e?e:""}()}),[t]);return t||n?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billDetailsLayout},t.length>0?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billRow},l().createElement("div",null,l().createElement("h6",null,"Bill Items")),l().createElement("div",null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Bill Item"),l().createElement(i.A0N,null,"Intervention Code"),l().createElement(i.A0N,null,"Order No"),l().createElement(i.A0N,null,"Service Type"),l().createElement(i.A0N,null,"Payer"),l().createElement(i.A0N,null,"Payment Status"),l().createElement(i.A0N,null,"Quantity"),l().createElement(i.A0N,null,"Total"),l().createElement(i.A0N,null,"Actions"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){var n,r,a;return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.patient_uuid},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.billable_service),l().createElement(i.nA6,null,null!==(n=e.intervention_code)&&void 0!==n?n:""),l().createElement(i.nA6,null,null!==(r=e.order_no)&&void 0!==r?r:""),l().createElement(i.nA6,null,null!==(a=e.service_type)&&void 0!==a?a:""),l().createElement(i.nA6,null,e.payment_scheme),l().createElement(i.nA6,null,e.payment_status),l().createElement(i.nA6,null,e.item_quantity),l().createElement(i.nA6,null,"Ksh ",e.item_total_price),l().createElement(i.nA6,null,l().createElement(i.obU,{"aria-label":"overflow-menu"},"PAID"!==e.payment_status&&l().createElement(i.XSD,{itemText:"Pay",onClick:function(){return E(e),void p(!0)}}),e.intervention_code&&0===e.has_claim_line&&l().createElement(i.XSD,{itemText:"Add Claim Line",onClick:function(){return E(e),void A(!0)}})))))}))))))):l().createElement(l().Fragment,null),n.length>0?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billRow},l().createElement("div",null,l().createElement("h6",null,"Bill Payments")),l().createElement("div",null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Payment Type"),l().createElement(i.A0N,null,"Amount"),l().createElement(i.A0N,null,"Amount Tendered"),l().createElement(i.A0N,null,"Date / Time"))),l().createElement(i.BFY,null,n&&n.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.cashier_bill_payment_uuid},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.payment_mode),l().createElement(i.nA6,null,"Ksh ",e.amount),l().createElement(i.nA6,null,"Ksh ",e.amount_tendered),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.payment_time)))))}))))))):l().createElement(l().Fragment,null),a.length>0?l().createElement(l().Fragment,null,l().createElement("div",{className:pe.billRow},l().createElement("div",null,l().createElement("h6",null,"Patient Dignosis")),l().createElement("div",null,l().createElement(Re,{amrsVisitDiagnosis:a,consentToken:c,locationUuid:u,interventionCode:g})))):l().createElement(l().Fragment,null),f&&b&&l().createElement(Ce,{open:f,billItem:b,onClose:s,onPay:function(){s()}}),h&&b&&l().createElement(Te,{open:h,billItem:b,onClose:m,onSuccess:m,locationUuid:u}))):l().createElement(l().Fragment,null,"No Data")};var Ye=n(42737),Ke={};Ke.styleTagTransform=G(),Ke.setAttributes=M(),Ke.insert=R().bind(null,"head"),Ke.domAPI=O(),Ke.insertStyleElement=Y(),F()(Ye.A,Ke);const Ge=Ye.A&&Ye.A.locals?Ye.A.locals:void 0;var ze=n(3028),Ve={};Ve.styleTagTransform=G(),Ve.setAttributes=M(),Ve.insert=R().bind(null,"head"),Ve.domAPI=O(),Ve.insertStyleElement=Y(),F()(ze.A,Ve);const We=ze.A&&ze.A.locals?ze.A.locals:void 0;var Qe=n(47708),$e={};$e.styleTagTransform=G(),$e.setAttributes=M(),$e.insert=R().bind(null,"head"),$e.domAPI=O(),$e.insertStyleElement=Y(),F()(Qe.A,$e);const Xe=Qe.A&&Qe.A.locals?Qe.A.locals:void 0;function Je(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function Ze(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Je(a,r,l,i,o,"next",e)}function o(e){Je(a,r,l,i,o,"throw",e)}i(void 0)}))}}function et(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const tt=function(e){var t=e.claimInvoiceLines,n=e.consentToken,r=(0,o.useSession)();return l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Item Code"),l().createElement(i.A0N,null,"Item Name"),l().createElement(i.A0N,null,"Intervention Code"),l().createElement(i.A0N,null,"Line Total Amount"),l().createElement(i.A0N,null,"Line Net Amount"),l().createElement(i.A0N,null,"Quantity"),l().createElement(i.A0N,null,"Unit"),l().createElement(i.A0N,null,"Unit Price"),l().createElement(i.A0N,null,"Is Active"),l().createElement(i.A0N,null,"Is Cancellation"),l().createElement(i.A0N,null,"Is Return"),l().createElement(i.A0N,null,"UHC Exceeded"),l().createElement(i.A0N,null,"Charge Date"),l().createElement(i.A0N,null,"Is Return"),l().createElement(i.A0N,null,"Line Number"),l().createElement(i.A0N,null,"Scheme Code"),l().createElement(i.A0N,null,"Scheme Name"),l().createElement(i.A0N,null,"Discount"),l().createElement(i.A0N,null,"Action"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.item_code),l().createElement(i.nA6,null,e.item_name),l().createElement(i.nA6,null,e.intervention_code),l().createElement(i.nA6,null,e.line_total_amount),l().createElement(i.nA6,null,e.line_net_amount),l().createElement(i.nA6,null,e.quantity),l().createElement(i.nA6,null,e.unit),l().createElement(i.nA6,null,e.unit_price),l().createElement(i.nA6,null,e.is_active),l().createElement(i.nA6,null,e.is_cancellation),l().createElement(i.nA6,null,e.is_return),l().createElement(i.nA6,null,e.uhc_exceeded),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.charge_date))),l().createElement(i.nA6,null,e.is_return),l().createElement(i.nA6,null,e.line_number),l().createElement(i.nA6,null,e.scheme_code),l().createElement(i.nA6,null,e.scheme_name),l().createElement(i.nA6,null,e.discount),l().createElement(i.nA6,null,l().createElement(i.$nd,{hasIconOnly:!0,iconDescription:"Remove claim line",size:"sm",kind:"danger",onClick:function(){return Ze((function(){return et(this,(function(t){switch(t.label){case 0:return[4,(l=e,Ze((function(){var e,t;return et(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,(i={consentToken:n,lineGuid:l.id,locationUuid:null==r||null===(e=r.sessionLocation)||void 0===e?void 0:e.uuid},ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return e=l.sent().hieBaseUrl,t="".concat(e,"/claim-line"),[4,(0,o.openmrsFetch)(t,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify(i)}).catch((function(e){var t,n,r,l=null!==(n=null==e||null===(t=e.responseBody)||void 0===t?void 0:t.message)&&void 0!==n?n:"";if("object"==(void 0===l?"undefined":(r=l)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r))throw"".concat(null==l?void 0:l.join(","));throw l}))];case 2:if((null==(n=l.sent())?void 0:n.data)&&"error"in n.data&&"message"in n.data)throw null!==(r=n.data.message)&&void 0!==r?r:"";return[2,null==n?void 0:n.data]}}))}))())];case 1:return a.sent(),(0,o.showSnackbar)({title:"Success removing claim line",subtitle:"Claim line removed successfully",kind:"success"}),[3,3];case 2:return t=a.sent(),(0,o.showSnackbar)({title:"Error removing claim line",subtitle:t,kind:"error"}),[3,3];case 3:return[2]}var i}))}))())];case 1:return[2,t.sent()]}var l}))}))()},renderIcon:function(){return l().createElement(f.G$,null)}}))))})))))};var nt=n(62748),rt={};rt.styleTagTransform=G(),rt.setAttributes=M(),rt.insert=R().bind(null,"head"),rt.domAPI=O(),rt.insertStyleElement=Y(),F()(nt.A,rt);const lt=nt.A&&nt.A.locals?nt.A.locals:void 0,at=function(e){var t=e.open,n=e.handleClose,r=e.claimInvoiceLines,a=e.consentToken;return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Invoice Line Details",open:t,size:"lg",onSecondarySubmit:function(){},onRequestClose:n,onRequestSubmit:function(){},primaryButtonText:"",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:lt.claimInvoiceLinesModalLayout},l().createElement(tt,{claimInvoiceLines:r,consentToken:a})))))};function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ot(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return it(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?it(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const ct=function(e){var t=e.claimInvoices,n=e.consentToken,a=ot((0,r.useState)(),2),c=a[0],u=a[1],s=ot((0,r.useState)([]),2),m=s[0],d=s[1];return t&&0!==t.length?l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Invoice No"),l().createElement(i.A0N,null,"Date"),l().createElement(i.A0N,null,"Dispatch Status"),l().createElement(i.A0N,null,"State"),l().createElement(i.A0N,null,"Patient"),l().createElement(i.A0N,null,"Provider"),l().createElement(i.A0N,null,"Lines"),l().createElement(i.A0N,null,"Scheme"),l().createElement(i.A0N,null,"Service Type"),l().createElement(i.A0N,null,"Amount"),l().createElement(i.A0N,null,"Net"),l().createElement(i.A0N,null,"Co-Pay"),l().createElement(i.A0N,null,"Discount"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.invoice_number),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.invoice_date))),l().createElement(i.nA6,null,e.dispatch_status),l().createElement(i.nA6,null,e.workflow_state),l().createElement(i.nA6,null,e.patient_name),l().createElement(i.nA6,null,e.provider_name),l().createElement(i.nA6,null,l().createElement("div",{className:Xe.linkBtn,onClick:function(){return t=e.lines,d(t),void u(!0);var t}},e.lines.length)),l().createElement(i.nA6,null,e.scheme_code),l().createElement(i.nA6,null,e.service_type),l().createElement(i.nA6,null,e.total_inv_amount),l().createElement(i.nA6,null,e.total_inv_net_amount),l().createElement(i.nA6,null,e.total_inv_copay),l().createElement(i.nA6,null,e.total_inv_discount)))})))),c&&l().createElement(at,{claimInvoiceLines:m,consentToken:n,open:c,handleClose:function(){u(!1)}})):l().createElement(l().Fragment,null,"No Invoice data")},ut=function(e){var t=e.claimInterventions,n=function(e){return e?"YES":"NO"};return t&&0!==t.length?l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Code"),l().createElement(i.A0N,null,"Payment Mechanism"),l().createElement(i.A0N,null,"Name"),l().createElement(i.A0N,null,"Keph Level Tarrif"),l().createElement(i.A0N,null,"Accrued Per Diem"),l().createElement(i.A0N,null,"Accrued Per Diem Days"),l().createElement(i.A0N,null,"State"),l().createElement(i.A0N,null,"Scheme"),l().createElement(i.A0N,null,"Sub Benefit Code"),l().createElement(i.A0N,null,"Active For UHC"),l().createElement(i.A0N,null,"Fund"),l().createElement(i.A0N,null,"Surgical Preauth"),l().createElement(i.A0N,null,"Renal Preauth"),l().createElement(i.A0N,null,"Oncology Preauth"),l().createElement(i.A0N,null,"Radiology Preauth"),l().createElement(i.A0N,null,"Optical Preauth"),l().createElement(i.A0N,null,"Needs Preauth"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.intervention_code),l().createElement(i.nA6,null,e.intervention_payment_mechanism),l().createElement(i.nA6,null,e.intervention_name),l().createElement(i.nA6,null,e.keph_level_tarrif),l().createElement(i.nA6,null,e.accrued_per_diem_amount),l().createElement(i.nA6,null,e.accrued_per_diem_days),l().createElement(i.nA6,null,e.workflow_state),l().createElement(i.nA6,null,e.supported_scheme),l().createElement(i.nA6,null,e.sub_benefit_code),l().createElement(i.nA6,null,e.active_for_uhc),l().createElement(i.nA6,null,e.intervention_fund),l().createElement(i.nA6,null,n(e.requires_surgical_preauth)),l().createElement(i.nA6,null,n(e.requires_renal_preauth)),l().createElement(i.nA6,null,n(e.requires_oncology_preauth)),l().createElement(i.nA6,null,n(e.requires_radiology_preauth)),l().createElement(i.nA6,null,n(e.requires_optical_preauth)),l().createElement(i.nA6,null,n(e.needs_preauth))))}))))):l().createElement(l().Fragment,null,"No Intervention data")},st=function(e){var t=e.claimDiagnosiss;return t&&0!==t.length?l().createElement(l().Fragment,null,l().createElement(i.XIK,null,l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Recorded On"),l().createElement(i.A0N,null,"Diagnosis Name"),l().createElement(i.A0N,null,"Diagnosis Code"),l().createElement(i.A0N,null,"Intervention Code"))),l().createElement(i.BFY,null,t&&t.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.claim},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.recorded_on))),l().createElement(i.nA6,null,e.diagnosis_name),l().createElement(i.nA6,null,e.diagnosis_code),l().createElement(i.nA6,null,e.intervention_code)))}))))):l().createElement(l().Fragment,null,"No Diagnosis data")};var mt=n(95636),dt={};dt.styleTagTransform=G(),dt.setAttributes=M(),dt.insert=R().bind(null,"head"),dt.domAPI=O(),dt.insertStyleElement=Y(),F()(mt.A,dt);const ft=mt.A&&mt.A.locals?mt.A.locals:void 0;function pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function ht(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const At=function(e){var t=e.open,n=e.onClose,a=e.onSuccess,c=e.locationUuid,u=e.consentToken,s=ht((0,r.useState)(!1),2),m=s[0],d=s[1],f=ht((0,r.useState)(""),2),p=f[0],y=f[1],h=ht((0,r.useState)(""),2),A=h[0],v=h[1],b=Object.values($);return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Close Claim",open:t,size:"md",onSecondarySubmit:n,onRequestClose:n,onRequestSubmit:m?function(){}:function(){return(e=function(){var e;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(t){switch(t.label){case 0:d(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),function(e){return e.cancelReasonText?!!e.cancelReasonType||((0,o.showSnackbar)({kind:"error",title:"Missing Cancel Reason Type",subtitle:"Please add a cancel reason type"}),!1):((0,o.showSnackbar)({kind:"error",title:"Missing Cancel Reason",subtitle:"Please add a cancel reason"}),!1)}(e={consentToken:u,cancelReasonType:null!=p?p:"",cancelReasonText:null!=A?A:"",locationUuid:c})?[4,(n=e,ee((function(){var e,t,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return e=l.sent().hieBaseUrl,t="".concat(e,"/claim-closure"),[4,(0,o.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))())]:[2,!1];case 2:return"error"in t.sent()?((0,o.showSnackbar)({title:"Error Closing claim",kind:"error",subtitle:"An error occurred while closing the claim. Kindy retry or contact support"}),a()):(0,o.showSnackbar)({title:"Sucess Closing Claim",kind:"success",subtitle:"Claim closed successfully"}),[3,5];case 3:return t.sent(),(0,o.showSnackbar)({kind:"error",title:"Error Closing Claim",subtitle:"An error occurred while closing the claim. Kindy retry or contact support"}),[3,5];case 4:return d(!1),[7];case 5:return[2]}var n}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){yt(a,r,l,i,o,"next",e)}function o(e){yt(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:m?"Closing Claim...":"Close Claim",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:ft.closeClaimModalLayout},l().createElement("div",{className:ft.closeClaimModalRow},l().createElement(i.l6P,{id:"cancel_reason_type",labelText:"Cancel Reason Type",onChange:function(e){return function(e){y(e)}(e.target.value)}},l().createElement(i.ebT,{value:"",text:"Select"}),";",b.map((function(e){return l().createElement(i.ebT,{value:e,text:e})})))),l().createElement("div",{className:ft.closeClaimModalRow},l().createElement(i.ksK,{id:"cancel_reason_text",labelText:"Cancel Reason",onChange:function(e){return function(e){v(e)}(e.target.value)}}))))))};function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}const Et=function(e){var t,n,a=e.open,c=e.onClose,u=e.onSuccess,s=e.locationUuid,m=e.claimsVisit,d=e.invoiceNumber,f=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=f[0],y=f[1],h=(0,r.useMemo)((function(){return!d||!m}),[d,m]);return l().createElement(l().Fragment,null,l().createElement(i.aFV,{modalHeading:"Submit Claim",open:a,size:"md",onSecondarySubmit:c,onRequestClose:c,onRequestSubmit:h?null:p?function(){}:function(){return(e=function(){var e;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(t){switch(t.label){case 0:y(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),e={consentToken:m.authorization_code,invoiceNumber:d,locationUuid:s},[4,(n=e,ee((function(){var e,t,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,J.bo)()];case 1:return e=l.sent().hieBaseUrl,t="".concat(e,"/claim-submission"),[4,(0,o.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)})];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:null]}}))}))())];case 2:return"error"in t.sent()?((0,o.showSnackbar)({title:"Error submitting claim",kind:"error",subtitle:"An error occurred while submitting the claim. Kindy retry or contact support"}),u()):(0,o.showSnackbar)({title:"Success submitting claim",kind:"success",subtitle:"Claim submitted successfully"}),[3,5];case 3:return t.sent(),(0,o.showSnackbar)({kind:"error",title:"Error submitting claim",subtitle:"An error occurred while submitting the claim. Kindy retry or contact support"}),[3,5];case 4:return y(!1),[7];case 5:return[2]}var n}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){bt(a,r,l,i,o,"next",e)}function o(e){bt(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},primaryButtonText:h?null:p?"Submitting claim...":"Submit claim",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("p",null,"Are you sure you want to submit the claim?"))))};function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const _t=function(e){var t=e.claimsVisit,n=e.locationUuid,a=e.patientBillDetails,c=function(){d(!1)},u=function(){y(!1)},s=wt((0,r.useState)(),2),m=s[0],d=s[1],f=wt((0,r.useState)(!1),2),p=f[0],y=f[1],h=(0,r.useMemo)((function(){return a?a.receipt_number:""}),[a]);return t?l().createElement(l().Fragment,null,l().createElement("div",{className:We.cvLayout},l().createElement("div",{className:We.cvHeaderSection},l().createElement("div",{className:We.headerTitle},l().createElement("h4",null,"Claim Visit Details")),l().createElement("div",{className:We.headerAction},l().createElement(i.$nd,{kind:"primary",onClick:function(){d(!0)}},"Close Claim"))),l().createElement("div",{className:We.cvContentSection},l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvWidth},l().createElement("ul",{className:We.claimList},l().createElement("li",null,l().createElement("strong",null,"State :")," ",t.workflow_state," "),l().createElement("li",null,l().createElement("strong",null,"Status : "),t.claim_auth_status),l().createElement("li",null,l().createElement("strong",null,"Name :")," ",t.patient_name),l().createElement("li",null,l().createElement("strong",null,"Member Number :")," ",t.member_number),l().createElement("li",null,l().createElement("strong",null,"Scheme Code :")," ",t.scheme_code),l().createElement("li",null,l().createElement("strong",null,"Scheme Name :")," ",t.scheme_name),l().createElement("li",null,l().createElement("strong",null,"Service Type :")," ",t.service_type),l().createElement("li",null,l().createElement("strong",null,"Provider :")," ",t.provider_name),l().createElement("li",null,l().createElement("strong",null,"Visit Start :")," ",(0,o.formatDate)((0,o.parseDate)(t.visit_start))," "))),l().createElement("div",{className:We.cvWidth},l().createElement("ul",{className:We.claimList},l().createElement("li",null,l().createElement("strong",null,"Total Amount :")," ",t.total_claim_amount),l().createElement("li",null,l().createElement("strong",null,"Total Net Amount :")," ",t.total_claim_net_amount),l().createElement("li",null,l().createElement("strong",null,"Total Co-Pay :")," ",t.total_claim_copay),l().createElement("li",null,l().createElement("strong",null,"Total Claim Discount:")," ",t.total_claim_discount),l().createElement("li",null,l().createElement("strong",null,"Total Claim Splits:")," ",t.total_claim_splits),l().createElement("li",null,l().createElement("strong",null,"No of Invoices : "),t.number_of_invoices),l().createElement("li",null,l().createElement("strong",null,"Diagnosis Count :")," ",t.diagnoses_count),l().createElement("li",null,l().createElement("strong",null,"Attachments Count :")," ",t.claim_attachments_count),l().createElement("li",null,l().createElement("strong",null,"Invoice Attachment Count :")," ",t.invoice_attachments_count)))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvRow},l().createElement("h6",null,"Invoices")),l().createElement("div",{className:We.cvRow},t.invoices&&l().createElement(ct,{claimInvoices:t.invoices,consentToken:t.authorization_code}))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvRow},l().createElement("h6",null,"Interventions")),l().createElement("div",{className:We.cvRow},t.interventions&&l().createElement(ut,{claimInterventions:t.interventions}))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.cvRow},l().createElement("h6",null,"Diagnosis")),l().createElement("div",{className:We.cvRow},t.claim_diagnoses&&l().createElement(st,{claimDiagnosiss:t.claim_diagnoses}))),l().createElement("div",{className:We.cvRow},l().createElement("div",{className:We.claimSubmitBtn},l().createElement(i.$nd,{kind:"tertiary",onClick:function(){y(!0)}},"Submit claim"))))),m&&l().createElement(At,{locationUuid:n,open:m,onClose:c,onSuccess:c,consentToken:t.authorization_code}),p&&l().createElement(Et,{locationUuid:n,open:p,onClose:u,onSuccess:u,claimsVisit:t,invoiceNumber:h})):l().createElement(l().Fragment,null,"No Data")};function Ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function St(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function kt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ct(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const xt=function(e){var t=e.consentToken,n=e.locationUuid,a=e.patientBillDetails,c=function(){return(e=function(){var e,t;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(n){switch(n.label){case 0:y(!0),e=u(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,ne(e)];case 2:return t=n.sent(),d(t||null),[3,5];case 3:return n.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching provider preview",subtitle:"An error was encountered while fetching the claim preview, retry or contact support"}),[3,5];case 4:return y(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){St(a,r,l,i,o,"next",e)}function o(e){St(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},u=function(){return{locationUuid:n,consentToken:t}},s=kt((0,r.useState)(null),2),m=s[0],d=s[1],f=kt((0,r.useState)(!1),2),p=f[0],y=f[1],h=kt((0,r.useState)(),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){var e;t&&n&&(e=a.find((function(e){return e.consent_token===t})),v(e),c())}),[t,n]),p?l().createElement(i.OuH,{description:"Loading data...please wait"}):l().createElement(l().Fragment,null,l().createElement("div",{className:Ge.pcLayout},m&&l().createElement(_t,{patientBillDetails:A,claimsVisit:m,locationUuid:n})))};function It(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Nt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function Tt(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Nt(a,r,l,i,o,"next",e)}function o(e){Nt(a,r,l,i,o,"throw",e)}i(void 0)}))}}function Pt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return It(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?It(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Dt(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const Ut=function(e){var t=e.patientUuid,n=e.locationUuid,a=e.billingDate,c=Pt((0,r.useState)([]),2),u=c[0],s=c[1],m=Pt((0,r.useState)(""),2),d=m[0],f=m[1],p=Pt((0,r.useState)([]),2),y=p[0],h=p[1],A=(0,r.useMemo)((function(){var e;return null!==(e=u[0])&&void 0!==e?e:null}),[u]),v=(0,r.useMemo)((function(){return function(e){return e.length>0?e.some((function(e){return"POSTED"===e.paid_status}))?"PARTIALLY PAID":e.some((function(e){return"PENDING"===e.paid_status}))?"PENDING":"PAID":status}(u)}),[u]),b=Pt((0,r.useState)([]),2),E=b[0],g=b[1];return(0,r.useEffect)((function(){n&&t&&a&&(Tt((function(){var e,r;return Dt(this,(function(l){switch(l.label){case 0:e={locationUuid:n,billingDate:a,patientUuid:t},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,(i=e,ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,X.SW)()];case 1:return e=l.sent(),t="".concat(e,"/facility/patient/bill?locationUuid=").concat(i.locationUuid,"&billingDate=").concat(i.billingDate,"&patientUuid=").concat(i.patientUuid),[4,(0,o.openmrsFetch)(t)];case 2:return[4,l.sent().json()];case 3:return n=l.sent(),[2,null!==(r=n.results)&&void 0!==r?r:[]]}}))}))())];case 2:return(r=l.sent())&&(s(r),f(r[0].consent_token)),[3,4];case 3:return l.sent(),(0,me.tdF)({title:"Error fetching patient bill details",kind:"error",subtitle:"An error occurred while generat"}),[3,4];case 4:return[2]}var i}))}))(),Tt((function(){var e,n;return Dt(this,(function(r){switch(r.label){case 0:e={patientUuid:t,billingDate:a},r.label=1;case 1:return r.trys.push([1,3,,4]),[4,(l=e,ee((function(){var e,t,n,r;return te(this,(function(a){switch(a.label){case 0:return[4,(0,X.SW)()];case 1:return e=a.sent(),t="".concat(e,"/bill/patient/payment?billingDate=").concat(l.billingDate,"&patientUuid=").concat(l.patientUuid),[4,(0,o.openmrsFetch)(t)];case 2:return[4,a.sent().json()];case 3:return n=a.sent(),[2,null!==(r=n.results)&&void 0!==r?r:[]]}}))}))())];case 2:return(n=r.sent())&&n.length>0?h(n):h([]),[3,4];case 3:return r.sent(),(0,me.tdF)({title:"Error fetching patient bill payments",kind:"error",subtitle:"An error occurred while fetching the patient bill payments"}),[3,4];case 4:return[2]}var l}))}))(),Tt((function(){var e,r;return Dt(this,(function(l){switch(l.label){case 0:e={patientUuid:t,visitDate:a,locationUuid:n},l.label=1;case 1:return l.trys.push([1,3,,4]),[4,(i=e,ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return[4,(0,X.SW)()];case 1:return e=l.sent(),t="".concat(e,"/patient/diagnosis?visitDate=").concat(i.visitDate,"&patientUuid=").concat(i.patientUuid,"&locationUuid=").concat(i.locationUuid),[4,(0,o.openmrsFetch)(t)];case 2:return[4,l.sent().json()];case 3:return n=l.sent(),[2,null!==(r=n.results)&&void 0!==r?r:[]]}}))}))())];case 2:return(r=l.sent())&&r.length>0?g(r):g([]),[3,4];case 3:return l.sent(),(0,me.tdF)({title:"Error fetching patient diagnosis",kind:"error",subtitle:"An error occurred while fetching the patient diagnosis"}),[3,4];case 4:return[2]}var i}))}))())}),[n,t,a]),l().createElement(l().Fragment,null,l().createElement("div",{className:se.bdLayout},l().createElement("div",{className:se.bdHeader},A?l().createElement(l().Fragment,null,l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"Name:")," ",A.patient_name),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"CashPoint:")," ",A.cash_point),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"Bill Date:")," ",A.bill_date),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"CR:")," ",A.cr_no),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"AMRS Universl ID:")," ",A.amrs_universal_id),l().createElement("div",{className:se.pdCol},l().createElement("strong",null,"Bill Status:")," ",null!=v?v:"")):l().createElement(l().Fragment,null)),l().createElement("div",null,l().createElement(i.tUM,null,l().createElement(i.wbY,{scrollDebounceWait:200},l().createElement(i.ozo,null,"Bill Details"),l().createElement(i.ozo,null,"Claim")),l().createElement(i.T2N,null,l().createElement(i.KpK,null,u&&l().createElement(qe,{patientBillDetails:u,patientPayments:y,amrsVisitDiagnosis:E,locationUuid:n,consentToken:d})),l().createElement(i.KpK,null,n&&d?l().createElement(l().Fragment,null,l().createElement(xt,{locationUuid:n,patientBillDetails:u,consentToken:d})):l().createElement(l().Fragment,null)))))))};function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ft(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ot=function(e){var t=e.billingDate,n=e.locationUuid,a=function(){return(e=function(){var e,t;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(n){switch(n.label){case 0:e=c(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(r=e,ee((function(){var e,t,n,l;return te(this,(function(a){switch(a.label){case 0:return[4,(0,X.SW)()];case 1:return e=a.sent(),t="".concat(e,"/facility/bills?locationUuid=").concat(r.locationUuid,"&billingDate=").concat(r.billingDate),[4,(0,o.openmrsFetch)(t)];case 2:return[4,a.sent().json()];case 3:return n=a.sent(),[2,null!==(l=n.results)&&void 0!==l?l:[]]}}))}))())];case 2:return t=n.sent(),d(t||[]),[3,4];case 3:return n.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching facility bills",subtitle:"An error occurred while fetehcing facility bills, please reload or contact support"}),[3,4];case 4:return[2]}var r}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){Ft(a,r,l,i,o,"next",e)}function o(e){Ft(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},c=function(){return{locationUuid:null!=n?n:"",billingDate:t}},u=function(e,t){y(e),v(t)},s=jt((0,r.useState)([]),2),m=s[0],d=s[1],f=jt((0,r.useState)(Q.Bills),2),p=f[0],y=f[1],h=jt((0,r.useState)(""),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){n&&t&&a()}),[t,n]),l().createElement(l().Fragment,null,p===Q.Bills?l().createElement(l().Fragment,null,l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Date"),l().createElement(i.A0N,null,"Patient"),l().createElement(i.A0N,null,"Status"),l().createElement(i.A0N,null,"Cashpoint"))),l().createElement(i.BFY,null,m&&m.map((function(e,t){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.patient_uuid},l().createElement(i.nA6,null,t+1),l().createElement(i.nA6,null,e.bill_date),l().createElement(i.nA6,null,l().createElement("div",{className:oe.clickableData,onClick:function(){return u(Q.BillDetails,e.patient_uuid)}},e.patient_name)),l().createElement(i.nA6,null,function(e){var t=e.split(",");return t.length>0?t.some((function(e){return"POSTED"===e}))?"PARTIALLY PAID":t.some((function(e){return"PENDING"===e}))?"PENDING":"PAID":e}(e.paid_status)),l().createElement(i.nA6,null,e.cash_point)))}))))):l().createElement(l().Fragment,null),p===Q.BillDetails&&A?l().createElement(l().Fragment,null,l().createElement("div",null,l().createElement(i.$nd,{kind:"primary",onClick:function(){return u(Q.Bills,"")}},"Back")),l().createElement("div",null,l().createElement(Ut,{locationUuid:n,billingDate:t,patientUuid:A}))):l().createElement(l().Fragment,null))};var Lt=n(16732),Rt={};Rt.styleTagTransform=G(),Rt.setAttributes=M(),Rt.insert=R().bind(null,"head"),Rt.domAPI=O(),Rt.insertStyleElement=Y(),F()(Lt.A,Rt);const Ht=Lt.A&&Lt.A.locals?Lt.A.locals:void 0;var Mt=n(75492),qt={};qt.styleTagTransform=G(),qt.setAttributes=M(),qt.insert=R().bind(null,"head"),qt.domAPI=O(),qt.insertStyleElement=Y(),F()(Mt.A,qt);const Yt=Mt.A&&Mt.A.locals?Mt.A.locals:void 0,Kt=function(e){var t=e.open,n=e.claimsVisit,r=e.handleClose,a=e.locationUuid;return l().createElement(l().Fragment,null,l().createElement(i.aFV,{open:t,size:"lg",onSecondarySubmit:function(){},onRequestClose:r,onRequestSubmit:function(){},primaryButtonText:"",secondaryButtonText:"Close"},l().createElement(i.cwr,null,l().createElement("div",{className:Yt.cvModalLayout},l().createElement(_t,{claimsVisit:n,locationUuid:a})))))};function Gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function zt(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function Vt(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){zt(a,r,l,i,o,"next",e)}function o(e){zt(a,r,l,i,o,"throw",e)}i(void 0)}))}}function Wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qt(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}const $t=function(e){var t=e.locationUuid,n=e.billingDate,a=Wt((0,r.useState)(),2),c=a[0],u=a[1],s=Wt((0,r.useState)(null),2),m=s[0],d=s[1],f=Wt((0,r.useState)(!1),2),p=f[0],y=f[1],h=Wt((0,r.useState)(!1),2),A=h[0],v=h[1];return(0,r.useEffect)((function(){t&&n&&Vt((function(){var e,r;return Qt(this,(function(l){switch(l.label){case 0:v(!0),e={locationUuid:null!=t?t:"",visitDate:n},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,(a=e,ee((function(){var e,t,n,r;return te(this,(function(l){switch(l.label){case 0:return e={},a.consentToken&&(e.consentToken=a.consentToken),a.locationUuid&&(e.locationUuid=a.locationUuid),a.visitDate&&(e.visitDate=a.visitDate),[4,(0,J.bo)()];case 1:return t=l.sent().hieBaseUrl,n=new URLSearchParams(e).toString(),[4,(0,o.openmrsFetch)("".concat(t,"/claims-visit?").concat(n))];case 2:return[4,l.sent().json()];case 3:return[2,null!=(r=l.sent())?r:[]]}}))}))())];case 2:return(r=l.sent())&&u(r),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching facility bills",subtitle:"An error occurred while fetehcing facility bills, please reload or contact support"}),[3,5];case 4:return v(!1),[7];case 5:return[2]}var a}))}))()}),[t,n]),t&&n?l().createElement(l().Fragment,null,l().createElement("div",{className:Ht.claimVisitsLayout},l().createElement(i.XIK,{"aria-label":"sample table",size:"lg"},l().createElement(i.ndF,null,l().createElement(i.Hjg,null,l().createElement(i.A0N,null,"No"),l().createElement(i.A0N,null,"Date"),l().createElement(i.A0N,null,"Patient"),l().createElement(i.A0N,null,"Service Type"),l().createElement(i.A0N,null,"Action"))),l().createElement(i.BFY,null,c&&c.map((function(e,n){return l().createElement(l().Fragment,null,l().createElement(i.Hjg,{key:e.id},l().createElement(i.nA6,null,n+1),l().createElement(i.nA6,null,(0,o.formatDate)((0,o.parseDate)(e.visitStart))),l().createElement(i.nA6,null,l().createElement("div",null,e.patientId)),l().createElement(i.nA6,null,e.serviceType),l().createElement(i.$nd,{kind:"ghost",onClick:function(){return n=e,Vt((function(){var e,r;return Qt(this,(function(l){switch(l.label){case 0:v(!0),a=n.authorizationCode,e={locationUuid:t,consentToken:a},l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,ne(e)];case 2:return(r=l.sent())?(d(r),y(!0)):(d(null),y(!1)),[3,5];case 3:return l.sent(),(0,o.showSnackbar)({kind:"error",title:"Error fetching provider preview",subtitle:"An error was encountered while fetching the claim preview, retry or contact support"}),[3,5];case 4:return v(!1),[7];case 5:return[2]}var a}))}))();var n},size:"sm"},A?l().createElement(i.OuH,{description:"Fetching data...."}):"View Claim")))})))),p&&m?l().createElement(l().Fragment,null,l().createElement(Kt,{open:p,claimsVisit:m,handleClose:function(){y(!1),d(null)},locationUuid:t})):l().createElement(l().Fragment,null))):l().createElement(l().Fragment,null)};function Xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Jt=function(){var e,t,n,a,c=null!==(t=null===(e=(0,o.useSession)().sessionLocation)||void 0===e?void 0:e.uuid)&&void 0!==t?t:"",u=(n=(0,r.useState)((new Date).toLocaleDateString("en-CA")),a=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(n,a)||function(e,t){if(e){if("string"==typeof e)return Xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xt(e,t):void 0}}(n,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],m=u[1];return l().createElement(l().Fragment,null,l().createElement("div",{className:W.bcLayout},l().createElement("div",{className:W.bcHeader},l().createElement("div",{className:W.bcHeaderTitle},l().createElement("h4",null,"Billing and Claims Dashboard")),l().createElement("div",{className:W.bcHeaderStats})),l().createElement("div",{className:W.bcContent},l().createElement("div",{className:W.bcContentFilters},l().createElement(i.lrV,{datePickerType:"single",locale:"en",onChange:function(e){var t=new Date(e[0]).toLocaleDateString("en-CA");m(t)},onClose:function(){},onOpen:function(){}},l().createElement(i.tKA,{id:"date-picker-single",labelText:"Date",placeholder:"mm/dd/yyyy"}))),l().createElement("div",{className:W.bcContentTabs},l().createElement(i.tUM,null,l().createElement(i.wbY,{scrollDebounceWait:200},l().createElement(i.ozo,null,"Bills"),l().createElement(i.ozo,null,"Claims")),l().createElement(i.T2N,null,l().createElement(i.KpK,null,l().createElement(Ot,{locationUuid:c,billingDate:s})),l().createElement(i.KpK,null,l().createElement($t,{locationUuid:c,billingDate:s}))))))))},Zt=function(){return l().createElement(a.BrowserRouter,{basename:"".concat(window.spaBase,"/home/billing")},l().createElement(a.Routes,null,l().createElement(a.Route,{path:"",element:l().createElement(Jt,null)}),l().createElement(a.Route,{path:"/patient/:patientUuid/:billUuid",element:l().createElement(U,null)})))}},22540:(e,t,n)=>{n.d(t,{Q:()=>l,s:()=>r});var r=function(e){return e.Completed="COMPLETED",e.Waiting="WAITING",e.InService="IN SERVICE",e}({}),l=function(e){return e.Emergency="EMERGENCY",e.Priority="PRIORITY",e.NonUrgent="NON-URGENT",e}({})},23492:(e,t,n)=>{n.d(t,{bo:()=>i,y$:()=>a});var r=n(25987);function l(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}var a=function(){var e=(0,r.useConfig)({externalModuleName:"@ampath/esm-dha-workflow-app"}).hieBaseUrl,t=(0,r.useSession)().sessionLocation;return{hieBaseUrl:e,locationUuid:null==t?void 0:t.uuid}};function i(){return(e=function(){var e;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)("@ampath/esm-dha-workflow-app")];case 1:return[2,{hieBaseUrl:null!=(e=t.sent().hieBaseUrl)?e:null}]}}))},function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){l(i,r,a,o,c,"next",e)}function c(e){l(i,r,a,o,c,"throw",e)}o(void 0)}))})();var e}},36350:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__facility-bills-component__clickableData___H-XlC{color:blue}.-esm-dha-workflow__facility-bills-component__clickableData___H-XlC:hover{cursor:pointer}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/facility-bills/facility-bills.component.scss"],names:[],mappings:"AAAA,oEACI,UAAA,CAEJ,0EACI,cAAA",sourcesContent:[".clickableData{\n color: blue;\n}\n.clickableData:hover{\n cursor: pointer;\n}"],sourceRoot:""}]),i.locals={clickableData:"-esm-dha-workflow__facility-bills-component__clickableData___H-XlC"};const o=i},42737:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const o=i},47708:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-invoice-details-component__linkBtn___LOZaQ{color:blue}.-esm-dha-workflow__claim-invoice-details-component__linkBtn___LOZaQ:hover{cursor:pointer}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/claim-invoice-details/claim-invoice-details.component.scss"],names:[],mappings:"AAAA,qEACI,UAAA,CAEJ,2EACI,cAAA",sourcesContent:[".linkBtn{\n color: blue;\n}\n.linkBtn:hover{\n cursor: pointer;\n}"],sourceRoot:""}]),i.locals={linkBtn:"-esm-dha-workflow__claim-invoice-details-component__linkBtn___LOZaQ"};const o=i},61240:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__bill-item-payment-modal__biModalLayout___yNYxz{display:flex;flex-direction:column;width:100%;row-gap:15px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/modals/bill-item-payment/bill-item-payment.modal.scss"],names:[],mappings:"AAAA,mEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA",sourcesContent:[".biModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 15px;\n}"],sourceRoot:""}]),i.locals={biModalLayout:"-esm-dha-workflow__bill-item-payment-modal__biModalLayout___yNYxz"};const o=i},62214:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__eligibility-tags__eligibilityTagsLayout___VNY4e{display:flex;flex-direction:row;width:100%;column-gap:5px}","",{version:3,sources:["webpack://./src/registry/eligibility/eliigibility-tags/eligibility-tags.scss"],names:[],mappings:"AAAA,oEACI,YAAA,CACA,kBAAA,CACA,UAAA,CACA,cAAA",sourcesContent:[".eligibilityTagsLayout{\n display: flex;\n flex-direction: row;\n width: 100%;\n column-gap: 5px;\n}"],sourceRoot:""}]),i.locals={eligibilityTagsLayout:"-esm-dha-workflow__eligibility-tags__eligibilityTagsLayout___VNY4e"};const o=i},62748:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-invoice-lines-modal__claimInvoiceLinesModalLayout___qCTwI{display:flex;flex-direction:column;width:100%;row-gap:5px;padding:5px 5px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/modal/claim-invoice-lines/claim-invoice-lines.modal.scss"],names:[],mappings:"AAAA,oFACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,WAAA,CACA,eAAA",sourcesContent:[".claimInvoiceLinesModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 5px;\n padding: 5px 5px;\n}"],sourceRoot:""}]),i.locals={claimInvoiceLinesModalLayout:"-esm-dha-workflow__claim-invoice-lines-modal__claimInvoiceLinesModalLayout___qCTwI"};const o=i},62801:(e,t,n)=>{n.d(t,{E$:()=>c,SW:()=>u,Zp:()=>m,bo:()=>s,tI:()=>d});var r=n(25987),l=n(42333);function a(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var i=e.apply(t,n);function o(e){a(i,r,l,o,c,"next",e)}function c(e){a(i,r,l,o,c,"throw",e)}o(void 0)}))}}function o(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function c(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().subDomainUrl)?e:null]}}))}))()}function u(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().etlBaseUrl)?e:null]}}))}))()}function s(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().hieBaseUrl)?e:null]}}))}))()}function m(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().claimsBaseUrl)?e:null]}}))}))()}function d(){return i((function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,(0,r.getConfig)(l.moduleName)];case 1:return[2,null!=(e=t.sent().claimsKey)?e:null]}}))}))()}},64870:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__bill-details__billDetailsLayout___egS9m{display:flex;flex-direction:column;row-gap:10px;width:100%;padding:15px 15px}.-esm-dha-workflow__bill-details__billDetailsLayout___egS9m .-esm-dha-workflow__bill-details__billRow___Wt-k1{display:flex;flex-direction:column;width:100%;row-gap:10px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/bill-details/bill-details.scss"],names:[],mappings:"AAAA,4DACI,YAAA,CACA,qBAAA,CACA,YAAA,CACA,UAAA,CACA,iBAAA,CACA,8GACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA",sourcesContent:[".billDetailsLayout{\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n width: 100%;\n padding: 15px 15px;\n .billRow{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n }\n}"],sourceRoot:""}]),i.locals={billDetailsLayout:"-esm-dha-workflow__bill-details__billDetailsLayout___egS9m",billRow:"-esm-dha-workflow__bill-details__billRow___Wt-k1"};const o=i},70328:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const o=i},73637:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo{display:flex;flex-direction:column;width:100%;padding:2% 2%;row-gap:10px}.-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo .-esm-dha-workflow__billing-claims-dashboard-component__bcContent___5Lhmg{display:flex;flex-direction:column;width:100%;row-gap:10px}.-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo .-esm-dha-workflow__billing-claims-dashboard-component__bcContent___5Lhmg .-esm-dha-workflow__billing-claims-dashboard-component__bcContentFilters___n\\+tCo{display:flex;flex-direction:row;justify-content:flex-end}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/billing-claims-dashboard.component.scss"],names:[],mappings:"AAAA,yEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,aAAA,CACA,YAAA,CACA,mJACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA,CACA,qOACI,YAAA,CACA,kBAAA,CACA,wBAAA",sourcesContent:[".bcLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 2% 2%;\n row-gap: 10px;\n .bcContent{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n .bcContentFilters{\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n }\n }\n}"],sourceRoot:""}]),i.locals={bcLayout:"-esm-dha-workflow__billing-claims-dashboard-component__bcLayout___8F0Qo",bcContent:"-esm-dha-workflow__billing-claims-dashboard-component__bcContent___5Lhmg",bcContentFilters:"-esm-dha-workflow__billing-claims-dashboard-component__bcContentFilters___n+tCo"};const o=i},73837:(e,t,n)=>{n.d(t,{E:()=>i});var r=n(25987),l=n(62801);function a(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function i(e){return(t=function(){var t,n;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(a){switch(a.label){case 0:return[4,(0,l.bo)()];case 1:return t=a.sent(),n="".concat(t,"/eligibility"),[4,(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 2:return[2,a.sent().json()]}}))},function(){var e=this,n=arguments;return new Promise((function(r,l){var i=t.apply(e,n);function o(e){a(i,r,l,o,c,"next",e)}function c(e){a(i,r,l,o,c,"throw",e)}o(void 0)}))})();var t}},75492:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__claim-visit-details-modal__cvModalLayout___TY-U4{display:flex;flex-direction:column;width:100%;row-gap:10px}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/claim-visits/modal/claim-visit-details/claim-visit-details.modal.scss"],names:[],mappings:"AAAA,qEACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,YAAA",sourcesContent:[".cvModalLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n row-gap: 10px;\n}"],sourceRoot:""}]),i.locals={cvModalLayout:"-esm-dha-workflow__claim-visit-details-modal__cvModalLayout___TY-U4"};const o=i},83983:(e,t,n)=>{n.d(t,{B3:()=>d,EI:()=>s,Uv:()=>m,pC:()=>f,x_:()=>u});var r=n(25987),l=n(62801),a=n(18548);function i(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function o(e){i(a,r,l,o,c,"next",e)}function c(e){i(a,r,l,o,c,"throw",e)}o(void 0)}))}}function c(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function u(){return o((function(){var e,t,n;return c(this,(function(l){switch(l.label){case 0:return e="".concat(r.restBaseUrl,"/billing/paymentMode"),[4,(0,r.openmrsFetch)(e)];case 1:return[4,l.sent().json()];case 2:return t=l.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()}function s(){return o((function(){var e,t,n;return c(this,(function(l){switch(l.label){case 0:return e="".concat(r.restBaseUrl,"/billing/billableService"),[4,(0,r.openmrsFetch)("".concat(e,"?v=").concat("full"))];case 1:return[4,l.sent().json()];case 2:return t=l.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()}function m(e){return o((function(){var t;return c(this,(function(n){switch(n.label){case 0:return t="".concat(r.restBaseUrl,"/billing/bill"),[4,(0,r.openmrsFetch)(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)})];case 1:return[2,n.sent().data]}}))}))()}function d(){return o((function(){var e,t,n;return c(this,(function(l){switch(l.label){case 0:return e="".concat(r.restBaseUrl,"/billing/cashPoint?v=").concat("full"),[4,(0,r.openmrsFetch)(e)];case 1:return[4,l.sent().json()];case 2:return t=l.sent(),[2,null!==(n=t.results)&&void 0!==n?n:[]]}}))}))()}var f=function(e){return o((function(){var t,n;return c(this,(function(r){switch(r.label){case 0:return[4,(0,l.bo)()];case 1:return t=r.sent(),n="".concat(t,"/bill-order"),[2,(0,a.B2)(n,e)]}}))}))()}},84176:(e,t,n)=>{n.d(t,{A:()=>x});var r=n(16072),l=n.n(r),a=n(93323),i=n(44455),o=n(73837),c=n(85072),u=n.n(c),s=n(97825),m=n.n(s),d=n(77659),f=n.n(d),p=n(55056),y=n.n(p),h=n(10540),A=n.n(h),v=n(41113),b=n.n(v),E=n(62214),g={};g.styleTagTransform=b(),g.setAttributes=y(),g.insert=f().bind(null,"head"),g.domAPI=m(),g.insertStyleElement=A(),u()(E.A,g);const w=E.A&&E.A.locals?E.A.locals:void 0;var _=n(25987);function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const x=function(e){var t=e.crId,n=e.locationUuid,c=function(){return(e=function(){var e,r;return function(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}(this,(function(l){switch(l.label){case 0:if(y(!0),e=function(){var e={requestIdNumber:"",requestIdType:"",locationUuid:n};return t&&(e.requestIdNumber=t,e.requestIdType="3"),e}(),!u(e))return y(!1),[2];l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,(0,o.E)(e)];case 2:return r=l.sent(),d(r),[3,5];case 3:return l.sent(),(0,_.showSnackbar)({kind:"error",title:"Failed getting eligibility status",subtitle:"An error occurred while fetching eligibility status. Please try again or contact support"}),[3,5];case 4:return y(!1),[7];case 5:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function i(e){S(a,r,l,i,o,"next",e)}function o(e){S(a,r,l,i,o,"throw",e)}i(void 0)}))})();var e},u=function(e){return!!e.locationUuid&&!!e.requestIdNumber&&!!e.requestIdType},s=k((0,r.useState)(),2),m=s[0],d=s[1],f=k((0,r.useState)(!1),2),p=f[0],y=f[1],h=k((0,r.useState)(!1),2);return h[0],h[1],(0,r.useEffect)((function(){c()}),[t]),t?l().createElement(l().Fragment,null,l().createElement("div",{className:w.eligibilityTagsLayout},p?l().createElement(l().Fragment,null,l().createElement(i.OuH,{description:"Fetching Eligibility data..."})):l().createElement(l().Fragment,null,m?l().createElement(l().Fragment,null,m.schemes&&m.schemes.length>0?l().createElement(l().Fragment,null,m.schemes.map((function(e){return l().createElement("div",null,l().createElement(i.vwO,{className:"some-class",size:"md",title:"Status",type:(0,a.HT)(e.coverage.status)},e.schemeName," : ","1"===e.coverage.status?"Active":"Not Active"))}))):l().createElement("div",null,l().createElement(i.vwO,{className:"some-class",size:"md",title:"Status",type:"gray"},"No Insurance schemes found"))):l().createElement(l().Fragment,null)))):l().createElement(l().Fragment,null)}},86375:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,".-esm-dha-workflow__patient-bill-details__bdLayout___5g-5o{display:flex;flex-direction:column;width:100%;padding:15px 15px;row-gap:5px}.-esm-dha-workflow__patient-bill-details__bdHeader___vtzgp{display:flex;flex-direction:row;column-gap:10px;padding:15px 15px;background:#f4f4f4;flex-wrap:wrap}.-esm-dha-workflow__patient-bill-details__pdCol___WnSrk{padding:5px 5px;width:30%}","",{version:3,sources:["webpack://./src/billing/dashboard/v2/patient-bill-details/patient-bill-details.scss"],names:[],mappings:"AAAA,2DACI,YAAA,CACA,qBAAA,CACA,UAAA,CACA,iBAAA,CACA,WAAA,CAGJ,2DACI,YAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CACA,kBAAA,CACA,cAAA,CAEJ,wDACI,eAAA,CACA,SAAA",sourcesContent:[".bdLayout{\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 15px 15px;\n row-gap: 5px;\n}\n\n.bdHeader{\n display: flex;\n flex-direction: row;\n column-gap: 10px;\n padding: 15px 15px;\n background: #f4f4f4;\n flex-wrap: wrap;\n}\n.pdCol{\n padding: 5px 5px;\n width: 30%;\n}"],sourceRoot:""}]),i.locals={bdLayout:"-esm-dha-workflow__patient-bill-details__bdLayout___5g-5o",bdHeader:"-esm-dha-workflow__patient-bill-details__bdHeader___vtzgp",pdCol:"-esm-dha-workflow__patient-bill-details__pdCol___WnSrk"};const o=i},93323:(e,t,n)=>{n.d(t,{EU:()=>a,HT:()=>l});var r=n(22540);function l(e){return 1===e||"1"===e?"green":"red"}var a=function(e){var t;switch(e){case r.Q.Emergency:t="emergencyTag";break;case r.Q.Priority:t="priorityTag";break;case r.Q.NonUrgent:t="nonUrgentTag";break;case"".concat(r.Q.Emergency," PRIORITY"):t="emergencyTag";break;case"".concat(r.Q.NonUrgent," PRIORITY"):t="nonUrgentTag";break;case"".concat(r.Q.Priority," PRIORITY"):case"NORMAL PRIORITY":t="priorityTag";break;case"NOT URGENT":t="nonUrgentTag";break;default:t="gray"}return t}},95636:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(72996),l=n.n(r),a=n(70159),i=n.n(a)()(l());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const o=i},97209:(e,t,n)=>{n.d(t,{$k:()=>p,Gn:()=>y,MQ:()=>f,tA:()=>m,wH:()=>d,wh:()=>v,x_:()=>h,yj:()=>A});var r=n(25987),l=n(62801);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t,n,r,l,a,i){try{var o=e[a](i),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(r,l)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(r,l){var a=e.apply(t,n);function o(e){i(a,r,l,o,c,"next",e)}function c(e){i(a,r,l,o,c,"throw",e)}o(void 0)}))}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],i=!0,o=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,l=e}finally{try{i||null==n.return||n.return()}finally{if(o)throw l}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&o[0]?r.return:o[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,o[1])).done)return l;switch(r=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){a.label=o[1];break}if(6===o[0]&&a.label<l[1]){a.label=l[1],l=o;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(o);break}l[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2?arguments[2]:void 0;return o((function(){var a,i,o,s,m,d,f;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),[4,Promise.all([(0,l.Zp)(),(0,l.tI)()])];case 1:return a=c.apply(void 0,[u.sent(),2]),i=a[0],o=a[1],[4,(0,r.openmrsFetch)("".concat(i).concat(e),{method:t,headers:{"AMPATH-CLAIMS-KEY":o,"Content-Type":"application/json"},body:n?JSON.stringify(n):void 0})];case 2:return[2,null==(s=u.sent())?void 0:s.data];case 3:return[2,{success:!1,data:null,message:(null==(m=u.sent())||null===(f=m.response)||void 0===f||null===(d=f.data)||void 0===d?void 0:d.message)||(null==m?void 0:m.message)||"Claims API request failed"}];case 4:return[2]}}))}))()}function m(e){return o((function(){return u(this,(function(t){return e?[2,s("/claims/".concat(e),"POST")]:[2,{success:!1,data:null,message:"Bill ID is required to raise a SHA claim"}]}))}))()}function d(e){return o((function(){return u(this,(function(t){return[2,s("/bill-item/status","POST",e)]}))}))()}function f(e){return o((function(){return u(this,(function(t){return e?[2,s("/daily-bills?locationUuId=090089ea-1352-11df-a1f1-0026b9348838&billDate=".concat(e))]:[2,{success:!1,data:null,message:"Bill date is required"}]}))}))()}function p(e){return o((function(){return u(this,(function(t){return e?[2,s("/claims/".concat(e,"/status"))]:[2,{success:!1,data:null,message:"Bill UUID is required"}]}))}))()}function y(e){return o((function(){return u(this,(function(t){switch(t.label){case 0:return[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/billing/bill/").concat(e))];case 1:return[2,t.sent().data]}}))}))()}function h(){return o((function(){return u(this,(function(e){switch(e.label){case 0:return[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/billing/paymentMode"))];case 1:return[2,e.sent().data]}}))}))()}function A(e){return o((function(){return u(this,(function(t){return e?[2,s("/bills/".concat(e,"/status"),"POST")]:[2,{success:!1,data:null,message:"Bill UUID is required"}]}))}))()}function v(e,t){return o((function(){return u(this,(function(n){return[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/billing/bill/").concat(e,"/payment"),{method:"POST",headers:{"Content-Type":"application/json"},body:t})]}))}))()}}}]);
|