@openmrs/esm-stock-management-app 1.0.1-pre.475 → 1.0.1-pre.479
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/271.js +1 -0
- package/dist/319.js +1 -0
- package/dist/460.js +1 -0
- package/dist/474.js +1 -1
- package/dist/474.js.map +1 -1
- package/dist/574.js +1 -1
- package/dist/757.js +1 -0
- package/dist/788.js +1 -0
- package/dist/807.js +1 -0
- package/dist/833.js +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +163 -9
- package/dist/routes.json +1 -1
- package/i18next-parser.config.js +1 -1
- package/package.json +2 -2
- package/src/core/components/card/metrics-card-component.tsx +3 -3
- package/src/core/components/privilages-component/privilages.component.tsx +7 -1
- package/src/core/components/table/table.component.tsx +1 -1
- package/src/core/components/tabs/vertical-tabs.scss +2 -3
- package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.component.tsx +3 -2
- package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +2 -2
- package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +4 -4
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rule-button.component.tsx +1 -1
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +2 -2
- package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-delete.component.tsx +2 -2
- package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +1 -1
- package/src/stock-items/stock-item.utils.tsx +22 -9
- package/src/stock-items/stock-items-table.component.tsx +1 -1
- package/src/stock-locations/add-locations-form.component.tsx +8 -2
- package/src/stock-locations/location-admin-form.component.tsx +8 -5
- package/src/stock-locations/stock-locations-table.component.tsx +4 -14
- package/src/stock-locations/stock-locations-table.resource.tsx +9 -21
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +1 -0
- package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +1 -7
- package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +0 -1
- package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +10 -8
- package/src/stock-operations/add-stock-operation/stock-items-addition-row.component.tsx +2 -1
- package/src/stock-operations/add-stock-operation/stock-items-addition.component.tsx +2 -2
- package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +3 -0
- package/src/stock-operations/stock-operation.utils.tsx +28 -12
- package/src/stock-operations/stock-operations-dialog/stock-operations-issue-stock-button.component.tsx +1 -1
- package/src/stock-operations/stock-operations-table.component.tsx +9 -2
- package/src/stock-reports/generate-report/create-stock-report.component.tsx +33 -18
- package/src/stock-sources/add-stock-source-button.component.tsx +1 -1
- package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +2 -2
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +2 -2
- package/src/stock-user-role-scopes/add-stock-user-role-scope-button.component.tsx +5 -2
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +10 -8
- package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx +3 -2
- package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +1 -3
- package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +1 -1
- package/src/utils.ts +0 -10
- package/translations/am.json +292 -0
- package/translations/ar.json +292 -0
- package/translations/en.json +75 -57
- package/translations/es.json +292 -0
- package/translations/fr.json +292 -0
- package/translations/he.json +292 -0
- package/translations/km.json +292 -0
- package/translations/zh.json +292 -0
package/dist/474.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[474],{3432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__metrics-card__tileContainer___SG_bT{border:.0625rem solid #e0e0e0;flex-grow:1;height:7.875rem;padding:0 .75rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;margin-bottom:20px}.-esm-stock-management__metrics-card__tileHeader___sMfyg{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.-esm-stock-management__metrics-card__headerLabel___HyNJ3{font-size:var(--cds-label-02-font-size, 0.875rem);font-weight:var(--cds-label-02-font-weight, 400);line-height:var(--cds-label-02-line-height, 1.28572);letter-spacing:var(--cds-label-02-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__metrics-card__totalsLabel___hyLWP{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-stock-management__metrics-card__totalsValue___CCj27{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);color:#161616}.-esm-stock-management__metrics-card__headerLabelContainer___bVkOu{display:flex;align-items:center;height:2rem;justify-content:space-between;width:100%}.-esm-stock-management__metrics-card__link___qIBqZ{text-decoration:none;display:flex;align-items:flex-end}.-esm-stock-management__metrics-card__metricsGrid___sM6gq{display:grid;grid-template-columns:1fr 1fr}.-esm-stock-management__metrics-card__countGrid___XC66g{display:grid;grid-template-columns:1fr 1fr;justify-self:flex-end;column-gap:.5rem}.-esm-stock-management__metrics-card__countGrid___XC66g>span{font-size:.625rem !important;margin:0;color:#525252}.-esm-stock-management__metrics-card__countGrid___XC66g>p{margin:0}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/card/metrics-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,4DACE,6BAAA,CACA,WAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,kBAAA,CAGF,yDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,mBCCW,CDCb,0DE40BI,iDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF10BF,aGwBQ,CHtBV,0DEw0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CFt0BF,aDvBQ,CCyBV,0DEo0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CFl0BF,aD5BM,CC8BR,mEACE,YAAA,CACA,kBAAA,CACA,WCIW,CDHX,6BAAA,CACA,UAAA,CAEF,mDACE,oBAAA,CACA,YAAA,CACA,oBAAA,CAEF,0DACE,YAAA,CACA,6BAAA,CAEF,wDACE,YAAA,CACA,6BAAA,CACA,qBAAA,CACA,gBCjCW,CDkCX,6DACE,4BAAA,CACA,QAAA,CACA,aGVM,CHYR,0DACE,QAAA",sourceRoot:""}]),i.locals={tileContainer:"-esm-stock-management__metrics-card__tileContainer___SG_bT",tileHeader:"-esm-stock-management__metrics-card__tileHeader___sMfyg",headerLabel:"-esm-stock-management__metrics-card__headerLabel___HyNJ3",totalsLabel:"-esm-stock-management__metrics-card__totalsLabel___hyLWP",totalsValue:"-esm-stock-management__metrics-card__totalsValue___CCj27",headerLabelContainer:"-esm-stock-management__metrics-card__headerLabelContainer___bVkOu",link:"-esm-stock-management__metrics-card__link___qIBqZ",metricsGrid:"-esm-stock-management__metrics-card__metricsGrid___sM6gq",countGrid:"-esm-stock-management__metrics-card__countGrid___XC66g"};const l=i},2296:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__overlay__desktopOverlay___lvJaK{position:fixed;top:3rem;width:100%;right:0;bottom:0;z-index:9;border-left:1px solid #a8a8a8;background-color:#fff;overflow-y:auto;height:calc(100vh - 3rem)}.-esm-stock-management__overlay__desktopOverlay___lvJaK::after{height:100%;border-left:1px solid #a8a8a8}.-esm-stock-management__overlay__tabletOverlay___ThdtE{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#f4f4f4;overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none}.-esm-stock-management__overlay__tabletOverlay___ThdtE::-webkit-scrollbar{width:0}.-esm-stock-management__overlay__tabletOverlay___ThdtE>div{margin-top:3rem}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O button{background-color:#005d5d;background-color:var(--brand-01)}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O .-esm-stock-management__overlay__headerContent___YYBKM{color:#fff}.-esm-stock-management__overlay__desktopHeader___Ueq0h{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8;position:sticky;position:-webkit-sticky;width:100%;z-index:1000;top:0}.-esm-stock-management__overlay__headerContent___YYBKM{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-stock-management__overlay__closeButton___JYFSq{background-color:#fff;color:#161616;fill:#161616}.omrs-breakpoint-gt-tablet .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.omrs-breakpoint-lt-desktop .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.cds--list-box__menu{z-index:20000}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/overlay/overlay.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,wDACE,cAAA,CACA,QC6CW,CD5CX,UAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,6BAAA,CACA,qBAAA,CACA,eAAA,CACA,yBAAA,CAGF,+DACE,WAAA,CACA,6BAAA,CAGF,uDACE,cAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,wBD7BM,CC8BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCYS,CDPX,oEDNA,wBAAA,CACA,gCAAA,CCSA,oHACE,UDhDI,CCoDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDvDM,CCwDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEgyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF9xBF,cAAA,CACA,aDjEM,CCoER,qDACE,qBDlEc,CCmEd,aDtEM,CCuEN,YDvEM,CC4EN,mFACE,eAAA,CACA,eAAA,CAMF,oFACE,eAAA,CACA,eAAA,CAKJ,qBACE,aAAA",sourceRoot:""}]),i.locals={desktopOverlay:"-esm-stock-management__overlay__desktopOverlay___lvJaK",tabletOverlay:"-esm-stock-management__overlay__tabletOverlay___ThdtE",tabletOverlayHeader:"-esm-stock-management__overlay__tabletOverlayHeader___T3x8O",headerContent:"-esm-stock-management__overlay__headerContent___YYBKM",desktopHeader:"-esm-stock-management__overlay__desktopHeader___Ueq0h",closeButton:"-esm-stock-management__overlay__closeButton___JYFSq",overlayContent:"-esm-stock-management__overlay__overlayContent___QyXjy"};const l=i},7149:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__privilages__content___UE9bQ{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__privilages__helper___EblpR{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__privilages__tileContainer___K6_qc{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__privilages__tile___zojuU{margin:auto;width:fit-content}.-esm-stock-management__privilages__tileContent___hG2dp{display:flex;flex-direction:column;align-items:center}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/privilages-component/privilages.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,oDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,mDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,0DACE,qBDfM,CCgBN,4BAAA,CACA,cAAA,CAGF,iDACE,WAAA,CACA,iBAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__privilages__content___UE9bQ",helper:"-esm-stock-management__privilages__helper___EblpR",tileContainer:"-esm-stock-management__privilages__tileContainer___K6_qc",tile:"-esm-stock-management__privilages__tile___zojuU",tileContent:"-esm-stock-management__privilages__tileContent___hG2dp"};const l=i},4655:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__table__widgetContainer___cZm_L{background-color:#fff}.-esm-stock-management__table__widgetHeaderContainer___mn6uH{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem}.-esm-stock-management__table__widgetHeaderContainer___mn6uH>h4:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-01)}.-esm-stock-management__table__toggleButtons___cvBSx{width:fit-content;margin:0 .5rem}.-esm-stock-management__table__searchField___XUf8e{width:100%;max-width:250px;border:0px !important}.-esm-stock-management__table__searchBox___pXQzl{width:100%;display:flex;justify-content:right}.-esm-stock-management__table__container___Kypy0{margin-top:16px;margin-left:inherit;width:100%;overflow-y:hidden}.-esm-stock-management__table__tabContainer___E9h5_{margin-top:16px;padding-left:1rem;background-color:#fff}.-esm-stock-management__table__itemListSearch___I6xcT{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__itemListSearch___I6xcT input{background-color:#fff !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tileContainer___ZrvLt{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__table__tile___peYeA{margin:auto;width:fit-content}.-esm-stock-management__table__tileContent___WuPqi{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__table__menuItem___Sy4dM{max-width:none}.-esm-stock-management__table__radioButtonGroup___jCXKy{display:flex;flex-direction:column;align-items:flex-start;margin-top:.5rem;min-height:4rem;width:100%;font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-stock-management__table__radioButton____RBAw{padding:.25rem .25rem;margin:.5rem 0}.-esm-stock-management__table__section___tNn_U{margin:.5rem}.-esm-stock-management__table__sectionTitle___UBtqA{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__table__modalBody___QNIO4{padding-bottom:1rem}.-esm-stock-management__table__tabContainer___E9h5_ div[role=tabpanel]{padding:0 !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tableContainer___rZgtk{margin:0;padding:0}.-esm-stock-management__table__search___ybQU1{max-width:16rem}.-esm-stock-management__table__search___ybQU1 input{background-color:#fff !important}.-esm-stock-management__table__tableContainer___rZgtk{background-color:#f4f4f4}.-esm-stock-management__table__tableContainer___rZgtk a{text-decoration:none}.-esm-stock-management__table__tableContainer___rZgtk tr{width:.125rem}.-esm-stock-management__table__tableContainer___rZgtk .-esm-stock-management__table__toolbarContent___XsHBI{height:3rem}.-esm-stock-management__table__cds--table-sort__description___Gup5c{display:none}.-esm-stock-management__table__itemListDownload___loZ4q{margin-top:10px}.-esm-stock-management__table__content___qLKKH{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__table__helper___ZKdW1{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/table/table.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDACE,qBDCc,CCEhB,6DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CAGF,sEACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,qDACE,iBAAA,CACA,cAAA,CAGF,mDACE,UAAA,CACA,eAAA,CACA,qBAAA,CAGF,iDACE,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,iDACE,eAAA,CACA,mBAAA,CACA,UAAA,CACA,iBAAA,CAGF,oDACE,eAAA,CACA,iBAAA,CACA,qBAAA,CAGF,sDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,qBAAA,CAGF,qDACE,qBDpEM,CCqEN,4BAAA,CACA,cAAA,CAGF,4CACE,WAAA,CACA,iBAAA,CAGF,mDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,gDACE,cAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,gBCxEW,CDyEX,eCtCW,CDuCX,UAAA,CEmwBE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CF/vBJ,mDACE,qBAAA,CACA,cAAA,CAGF,+CACE,YCpFW,CDuFb,oDEsvBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFpvBF,aG9DQ,CH+DR,oBCrFW,CDwFb,iDACE,mBCpFW,CDuFb,uEACE,oBAAA,CAGF,8DACE,qBAAA,CAGF,sDACE,QAAA,CACA,SAAA,CAGF,8CACE,eAAA,CAEA,oDACE,gCAAA,CAIJ,sDACE,wBD5IM,CC8IN,wDACE,oBAAA,CAGF,yDACE,aCxIS,CD2IX,4GACE,WCpGS,CDwGb,oEACE,YAAA,CAGF,wDACE,eAAA,CAGF,+CE+rBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF7rBF,aDhKQ,CCiKR,mBAAA,CAGF,8CEyrBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFvrBF,aDtKQ",sourceRoot:""}]),i.locals={widgetContainer:"-esm-stock-management__table__widgetContainer___cZm_L",widgetHeaderContainer:"-esm-stock-management__table__widgetHeaderContainer___mn6uH",toggleButtons:"-esm-stock-management__table__toggleButtons___cvBSx",searchField:"-esm-stock-management__table__searchField___XUf8e",searchBox:"-esm-stock-management__table__searchBox___pXQzl",container:"-esm-stock-management__table__container___Kypy0",tabContainer:"-esm-stock-management__table__tabContainer___E9h5_",itemListSearch:"-esm-stock-management__table__itemListSearch___I6xcT",tileContainer:"-esm-stock-management__table__tileContainer___ZrvLt",tile:"-esm-stock-management__table__tile___peYeA",tileContent:"-esm-stock-management__table__tileContent___WuPqi",menuItem:"-esm-stock-management__table__menuItem___Sy4dM",radioButtonGroup:"-esm-stock-management__table__radioButtonGroup___jCXKy",radioButton:"-esm-stock-management__table__radioButton____RBAw",section:"-esm-stock-management__table__section___tNn_U",sectionTitle:"-esm-stock-management__table__sectionTitle___UBtqA",modalBody:"-esm-stock-management__table__modalBody___QNIO4",tableContainer:"-esm-stock-management__table__tableContainer___rZgtk",search:"-esm-stock-management__table__search___ybQU1",toolbarContent:"-esm-stock-management__table__toolbarContent___XsHBI","cds--table-sort__description":"-esm-stock-management__table__cds--table-sort__description___Gup5c",itemListDownload:"-esm-stock-management__table__itemListDownload___loZ4q",content:"-esm-stock-management__table__content___qLKKH",helper:"-esm-stock-management__table__helper___ZKdW1"};const l=i},5260:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__vertical-tabs__heading___dsNAK{font-size:var(--cds-productive-heading-02-font-size, 1rem);font-weight:var(--cds-productive-heading-02-font-weight, 600);line-height:var(--cds-productive-heading-02-line-height, 1.375);letter-spacing:var(--cds-productive-heading-02-letter-spacing, 0);color:#525252;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__heading___dsNAK:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__vertical-tabs__mainContainer___V_jej{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__vertical-tabs__title___hZ4AW{padding:1rem;font-size:1.2rem}.-esm-stock-management__vertical-tabs__desktopContainer____twGN{width:50%}.-esm-stock-management__vertical-tabs__tabletContainer___FQsU6{width:90%}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab-content{width:100% !important;padding:0}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab--list{flex-direction:column}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:active,.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--col{padding-left:0;width:100%}.-esm-stock-management__vertical-tabs__tabletTab___PHxHJ{width:25%}.-esm-stock-management__vertical-tabs__desktopTab___jh9Dp{width:20%}.-esm-stock-management__vertical-tabs__tab___IFWR5{display:flex}.-esm-stock-management__vertical-tabs__tabContainer___hu3KQ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__optionCell___oFvY9{padding:0 !important}.-esm-stock-management__vertical-tabs__optionHeader___avuuO{width:1.5rem !important}.-esm-stock-management__vertical-tabs__text___VSinM{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/tabs/vertical-tabs.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHnBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDtBM,CCuBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,SAAA,CAGF,6EACE,qBAAA,CAGF,wEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,+EACE,WAAA,CACA,eAAA,CAGF,6FACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,uGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,kFAQE,eAAA,CANA,iLAEE,oBAAA,CACA,2BAAA,CAMJ,uEACE,cAAA,CACA,UAAA,CAIJ,yDACE,SAAA,CAGF,0DACE,SAAA,CAGF,mDACE,YAAA,CAGF,4DACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,0DACE,oBAAA,CAGF,4DACE,uBAAA,CAGF,oDACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__vertical-tabs__heading___dsNAK",mainContainer:"-esm-stock-management__vertical-tabs__mainContainer___V_jej",title:"-esm-stock-management__vertical-tabs__title___hZ4AW",desktopContainer:"-esm-stock-management__vertical-tabs__desktopContainer____twGN",tabletContainer:"-esm-stock-management__vertical-tabs__tabletContainer___FQsU6",cohortBuilder:"-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy",tabletTab:"-esm-stock-management__vertical-tabs__tabletTab___PHxHJ",desktopTab:"-esm-stock-management__vertical-tabs__desktopTab___jh9Dp",tab:"-esm-stock-management__vertical-tabs__tab___IFWR5",tabContainer:"-esm-stock-management__vertical-tabs__tabContainer___hu3KQ",optionCell:"-esm-stock-management__vertical-tabs__optionCell___oFvY9",optionHeader:"-esm-stock-management__vertical-tabs__optionHeader___avuuO",text:"-esm-stock-management__vertical-tabs__text___VSinM"};const l=i},3011:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ{display:flex}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD{display:flex;flex-grow:1;flex-direction:column;margin:0;margin-left:16rem;background-color:#f4f4f4}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD a{width:100%}.-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx{flex-grow:1}.-esm-stock-management__home-dashboard__logoSection___oYB2c{display:flex;justify-content:center}","",{version:3,sources:["webpack://./src/dashboard/home-dashboard.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAGA,gEACE,YAAA,CAGF,mEACE,YAAA,CACA,WAAA,CACA,qBAAA,CACA,QAAA,CACA,iBAAA,CACA,wBC6BQ,CD3BR,qEACE,UAAA,CAIJ,yEACE,WAAA,CAGF,4DACE,YAAA,CACA,sBAAA",sourceRoot:""}]),i.locals={homePageWrapper:"-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ",dashboardContainer:"-esm-stock-management__home-dashboard__dashboardContainer___FvpUD",dashboardContainerTablet:"-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx",logoSection:"-esm-stock-management__home-dashboard__logoSection___oYB2c"};const l=i},49:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__root__productiveHeading01___qz04k{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__root__productiveHeading02___P86oI{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading03___ad2Jr{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading04____lfRk{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading05___BiHXj{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading06___fCUbs{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__root__bodyShort01___qFZKo{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__root__helperText01___l9eBE{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__root__bodyShort02___e318z{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__root__bodyLong01___hajrO{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__root__bodyLong02___rbPh9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__root__label01___B9Vra{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__root__text02___HK43C{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__root__container___Rf8rX{padding:2rem}.-esm-stock-management__root__formContainer___YM692{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__root__verticalForm___EFCw7{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__root__verticalForm___EFCw7 .cds--form-item{flex:none !important}.-esm-stock-management__root__verticalForm___EFCw7 .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0DC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,0DC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,0DCs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,0DCk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,0DC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,0DC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,kDCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,mDCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,kDC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,iDC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,iDCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,8CCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,6CACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,gDACE,YEpCW,CFuCb,oDACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,mDACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,mEACE,oBAAA,CAGF,+DACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__root__productiveHeading01___qz04k",productiveHeading02:"-esm-stock-management__root__productiveHeading02___P86oI",productiveHeading03:"-esm-stock-management__root__productiveHeading03___ad2Jr",productiveHeading04:"-esm-stock-management__root__productiveHeading04____lfRk",productiveHeading05:"-esm-stock-management__root__productiveHeading05___BiHXj",productiveHeading06:"-esm-stock-management__root__productiveHeading06___fCUbs",bodyShort01:"-esm-stock-management__root__bodyShort01___qFZKo",helperText01:"-esm-stock-management__root__helperText01___l9eBE",bodyShort02:"-esm-stock-management__root__bodyShort02___e318z",bodyLong01:"-esm-stock-management__root__bodyLong01___hajrO",bodyLong02:"-esm-stock-management__root__bodyLong02___rbPh9",label01:"-esm-stock-management__root__label01___B9Vra",text02:"-esm-stock-management__root__text02___HK43C",container:"-esm-stock-management__root__container___Rf8rX",formContainer:"-esm-stock-management__root__formContainer___YM692",verticalForm:"-esm-stock-management__root__verticalForm___EFCw7"};const l=i},7813:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__item__customTile___pTLBA{background-color:#f0f0f0;border-radius:4px;padding:20px;width:50px;height:100px;text-align:center;margin:2px}.-esm-stock-management__item__customTileTitle___DoQk8{font-size:14px;color:#333}","",{version:3,sources:["webpack://./src/stock-app-menu-item/item.scss"],names:[],mappings:"AACA,iDACI,wBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,YAAA,CACA,iBAAA,CACA,UAAA,CAGF,sDACE,cAAA,CACA,UAAA",sourceRoot:""}]),i.locals={customTile:"-esm-stock-management__item__customTile___pTLBA",customTileTitle:"-esm-stock-management__item__customTileTitle___DoQk8"};const l=i},8629:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home-detail-card__container___mESY0,.-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT,.-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk{margin:2rem 0}.-esm-stock-management__stock-home-detail-card__tilesContainer___blppR{background-color:#fff;border:1px solid #e0e0e0;border-bottom:none;width:100%;margin:0 auto;max-width:95vw;padding-bottom:0}.-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem;background-color:#fff}.-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL section{position:relative}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL a{text-decoration:none}.-esm-stock-management__stock-home-detail-card__pagination___sPPID{overflow:hidden}.-esm-stock-management__stock-home-detail-card__pagination___sPPID.cds--pagination{border-top:none}.-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa{display:none}.-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc{width:100%;max-width:768px;margin:1rem auto}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1>td>div{max-height:max-content !important}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 td{padding:0 2rem}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 th[colspan] td[colspan]>div:first-child{padding:0 1rem}.-esm-stock-management__stock-home-detail-card__action___Ul5A5{margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__illo___Wm7vk{margin-top:1rem}.-esm-stock-management__stock-home-detail-card__content___Q2X06{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h{text-align:left;text-transform:capitalize}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4:after,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid;border-bottom-color:#007d79;border-bottom-color:var(--brand-03)}.-esm-stock-management__stock-home-detail-card__tile___apXYV{text-align:center;border:1px solid #e0e0e0}.-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM{display:flex;justify-content:center;align-items:center;padding:1rem;margin:3rem;text-align:center}.-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i{margin:auto}.-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N{display:flex;margin:0 auto}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N>*{flex:1;margin:8px 8px}.-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm{display:flex;flex-direction:column}.-esm-stock-management__stock-home-detail-card__card___WYEgl{display:flex;border:1px solid #ccc;margin:10px;background-color:#f4f4f4}.-esm-stock-management__stock-home-detail-card__icon___JI7mq{margin-right:23px}.-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky{width:5px;background-color:#f1c21b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF{width:5px;background-color:#0f62fe;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z{width:5px;background-color:#ff832b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU{width:5px;background-color:#198038;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB{width:5px;background-color:#da1e28;margin-right:10px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr{margin-top:5px;margin-bottom:5px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr p{font-size:.9em;color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home-detail-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,sNACE,aAAA,CAQF,uEACE,qBDbM,CCcN,wBAAA,CACA,kBAAA,CACA,UAAA,CACA,aAAA,CACA,cAAA,CACA,gBAAA,CAGF,wEACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CACA,qBD3BM,CC8BR,wFACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,+EACE,iBAAA,CAGF,yEACE,oBAAA,CAGF,mEACE,eAAA,CAEA,mFACE,eAAA,CAIJ,kEACE,YAAA,CAGF,iEACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,8EACE,UAAA,CACA,eAAA,CACA,gBAAA,CAGF,sFACE,iCAAA,CAGF,kFACE,cAAA,CAGF,uHACE,cAAA,CAGF,+DACE,mBC9DW,CDiEb,6DACE,eCxDW,CD2Db,gEEwwBI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CFtwBF,aDvFQ,CCwFR,eC9DW,CD+DX,mBCzEW,CD4Eb,6IAEE,eAAA,CACA,yBAAA,CAEA,mJE4vBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF1vBA,aDnGM,CCqGN,+JACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2BAAA,CD/DJ,2BAAA,CACA,mCAAA,CCoEF,6DACE,iBAAA,CACA,wBAAA,CAGF,yEACE,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,YC/FW,CDgGX,WC5EW,CD6EX,iBAAA,CAGF,6EACE,WAAA,CAGF,gFE2tBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFztBF,aDpIQ,CCqIR,mBAAA,CAGF,+EEqtBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFntBF,aD1IQ,CC6IV,sEACE,YAAA,CACA,aAAA,CAGF,wEACE,MAAA,CACA,cAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CAGF,6DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,wBAAA,CAGF,6DACE,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,sEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,uEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,qEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,iEACE,cAAA,CACA,iBAAA,CAGF,mEACE,cAAA,CACA,aAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-home-detail-card__container___mESY0",emptyStateContainer:"-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT",loaderContainer:"-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk",tilesContainer:"-esm-stock-management__stock-home-detail-card__tilesContainer___blppR",headerContainer:"-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV",backgroundDataFetchingIndicator:"-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_",tableContainer:"-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL",pagination:"-esm-stock-management__stock-home-detail-card__pagination___sPPID",hiddenRow:"-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa",emptyRow:"-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s",visitSummaryContainer:"-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc",expandedActiveVisitRow:"-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1",action:"-esm-stock-management__stock-home-detail-card__action___Ul5A5",illo:"-esm-stock-management__stock-home-detail-card__illo___Wm7vk",content:"-esm-stock-management__stock-home-detail-card__content___Q2X06",desktopHeading:"-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3",tabletHeading:"-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h",tile:"-esm-stock-management__stock-home-detail-card__tile___apXYV",filterEmptyState:"-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM",filterEmptyStateTile:"-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i",filterEmptyStateContent:"-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0",filterEmptyStateHelper:"-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN",cardContainer:"-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N",cardContainerBig:"-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm",card:"-esm-stock-management__stock-home-detail-card__card___WYEgl",icon:"-esm-stock-management__stock-home-detail-card__icon___JI7mq",colorLineYellow:"-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky",colorLineBlue:"-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF",colorLineOrange:"-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z",colorLineGreen:"-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU",colorLineRed:"-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB",cardText:"-esm-stock-management__stock-home-detail-card__cardText____XcXr"};const l=i},2426:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home__cardContainer___n7Lxz{background-color:#fff;display:flex;justify-content:space-between;margin:0 1rem 0 1rem;flex-flow:row wrap;column-gap:1rem;row-gap:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,0DACE,qBCIM,CDHN,YAAA,CACA,6BAAA,CACA,oBAAA,CACA,kBAAA,CACA,eEqBW,CFpBX,YEoBW",sourceRoot:""}]),i.locals={cardContainer:"-esm-stock-management__stock-home__cardContainer___n7Lxz"};const l=i},4158:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__packaging-units__packingTable___ceosy{min-height:15rem;display:block}.-esm-stock-management__packaging-units__packingTableCell___KYLlI{display:flex;align-items:center}.-esm-stock-management__packaging-units__packagingTableBody___o7eKF{min-height:10rem}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6{padding-bottom:1rem;min-height:15rem;display:block}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6 .cds--data-table-content{overflow-x:visible}.-esm-stock-management__packaging-units__searchAndSave___iglHk{display:flex;flex-direction:column;align-items:flex-start}.-esm-stock-management__packaging-units__searchAndSave___iglHk .-esm-stock-management__packaging-units__submitButton___DIyGx{margin-top:1rem}.-esm-stock-management__packaging-units__deleteModal___T_iKq .cds--modal-container.cds--modal-container--sm .cds--modal-content .cds--form-item{margin-top:1rem}.-esm-stock-management__packaging-units__packageUnitsBtn___uapVg{display:flex;justify-content:flex-end;margin-right:2rem}cds--form-item{margin-top:1rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACE,gBAAA,CACA,aAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CAGF,oEACE,gBCwDW,CDrDb,yEACE,mBAAA,CACA,gBAAA,CACA,aAAA,CAEA,kGACE,kBAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,6HACE,eAAA,CAOE,gJACE,eAAA,CAMR,iEACE,YAAA,CACA,wBAAA,CACA,iBAAA,CAGF,eACE,eAAA",sourceRoot:""}]),i.locals={packingTable:"-esm-stock-management__packaging-units__packingTable___ceosy",packingTableCell:"-esm-stock-management__packaging-units__packingTableCell___KYLlI",packagingTableBody:"-esm-stock-management__packaging-units__packagingTableBody___o7eKF",packagingTableContainer:"-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6",searchAndSave:"-esm-stock-management__packaging-units__searchAndSave___iglHk",submitButton:"-esm-stock-management__packaging-units__submitButton___DIyGx",deleteModal:"-esm-stock-management__packaging-units__deleteModal___T_iKq",packageUnitsBtn:"-esm-stock-management__packaging-units__packageUnitsBtn___uapVg"};const l=i},501:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-item-references__referencesTable___WAMHe{min-height:15rem;display:block}.-esm-stock-management__stock-item-references__referencesTableCell___NGIOb{display:flex;align-items:center}.-esm-stock-management__stock-item-references__referencesTableBody___HreAO{min-height:10rem}.-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw{min-height:15rem;display:block}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,uEACE,gBAAA,CACA,aAAA,CAGF,2EACE,YAAA,CACA,kBAAA,CAGF,2EACE,gBCwDW,CDpDb,gFACE,gBAAA,CACA,aAAA",sourceRoot:""}]),i.locals={referencesTable:"-esm-stock-management__stock-item-references__referencesTable___WAMHe",referencesTableCell:"-esm-stock-management__stock-item-references__referencesTableCell___NGIOb",referencesTableBody:"-esm-stock-management__stock-item-references__referencesTableBody___HreAO",referencesTableContainer:"-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw"};const l=i},4563:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-rules__section___ggL6B{margin:.5rem}.-esm-stock-management__add-stock-rules__sectionTitle___fsf7E{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-rules__modalBody___DXCqE{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,yDACE,YCgBW,CDbb,8DE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,2DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-rules__section___ggL6B",sectionTitle:"-esm-stock-management__add-stock-rules__sectionTitle___fsf7E",modalBody:"-esm-stock-management__add-stock-rules__modalBody___DXCqE"};const l=i},4907:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss"],names:[],mappings:"AACI,oGACE,KAAA,CAGF,8FACE,WAAA,CAGF,iHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-rules-filter__filterContainer___eskQ5"};const l=i},1048:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__filter-stock-items__spacing___pZHZK{margin:0 16px}","",{version:3,sources:["webpack://./src/stock-items/components/filter-stock-items/filter-stock-items.scss"],names:[],mappings:"AAAA,4DACI,aAAA",sourceRoot:""}]),i.locals={spacing:"-esm-stock-management__filter-stock-items__spacing___pZHZK"};const l=i},1535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}:root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-items-table__productiveHeading01___MPnNp{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__productiveHeading02___E1KiC{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading03___N33sp{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading04___lh7n8{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading05___ieA0n{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading06___JPMyX{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__helperText01___uOks4{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__bodyShort02___d7A67{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyLong01____Gl3H{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__bodyLong02___Dwoe9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__label01___ANQCM{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__text02___ac1IL{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-items-table__container___VONiZ{padding:2rem}.-esm-stock-management__stock-items-table__formContainer___o0XL5{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-items-table__verticalForm___oOj2I{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--form-item{flex:none !important}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-items-table__tileContainer___N1eHZ{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-items-table__tile___ZZNjt{margin:auto;width:fit-content}.-esm-stock-management__stock-items-table__tileContent___SC542{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-items-table__content___zdm4U{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-items-table__helper___kKhcQ{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-items-table__separator___JXP1R{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-items-table__separator___JXP1R::before,.-esm-stock-management__stock-items-table__separator___JXP1R::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-items-table__separator___JXP1R::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-items-table__separator___JXP1R::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-items-table__toolbarContent___oBPmt{display:flex;align-items:center}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center}.-esm-stock-management__stock-items-table__dateAlign___RNWUI{padding-top:.5rem;height:100%}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL{padding-bottom:.5rem}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL .cds--list-box__menu{min-width:15rem;z-index:1}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-items/stock-items-table.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CAHF,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,uEC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,uEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,uECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,uECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,uEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,uEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,+DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,gECkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,+DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,8DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,8DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,2DCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,0DACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,6DACE,YEpCW,CFuCb,iEACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,gEACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,gFACE,oBAAA,CAGF,4EACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGpGJ,sEACE,qBHEc,CGDd,YDwBW,CCvBX,gBAAA,CAGF,iEACE,qBHPM,CGQN,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,2DFs0BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CEp0BF,aJzBQ,CI0BR,mBAAA,CAGF,0DFg0BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CE9zBF,aJ/BQ,CIkCV,6DF2zBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CEzzBF,aJpCQ,CIqCR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBJ3CM,CI4CN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,qEACE,WAAA,CACA,gBAAA,CAGF,oEACE,UAAA,CACA,iBAAA,CAIJ,kEACE,YAAA,CACA,kBAAA,CAGF,mEACE,YAAA,CACA,kBAAA,CAGF,6DACE,iBD3DW,CC4DX,WAAA,CAGF,gEACE,oBDhEW,CCkEX,qFACE,eAAA,CACA,SAAA,CAIJ,mEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,kBDlEW",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-items-table__productiveHeading01___MPnNp",productiveHeading02:"-esm-stock-management__stock-items-table__productiveHeading02___E1KiC",productiveHeading03:"-esm-stock-management__stock-items-table__productiveHeading03___N33sp",productiveHeading04:"-esm-stock-management__stock-items-table__productiveHeading04___lh7n8",productiveHeading05:"-esm-stock-management__stock-items-table__productiveHeading05___ieA0n",productiveHeading06:"-esm-stock-management__stock-items-table__productiveHeading06___JPMyX",bodyShort01:"-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK",helperText01:"-esm-stock-management__stock-items-table__helperText01___uOks4",bodyShort02:"-esm-stock-management__stock-items-table__bodyShort02___d7A67",bodyLong01:"-esm-stock-management__stock-items-table__bodyLong01____Gl3H",bodyLong02:"-esm-stock-management__stock-items-table__bodyLong02___Dwoe9",label01:"-esm-stock-management__stock-items-table__label01___ANQCM",text02:"-esm-stock-management__stock-items-table__text02___ac1IL",container:"-esm-stock-management__stock-items-table__container___VONiZ",formContainer:"-esm-stock-management__stock-items-table__formContainer___o0XL5",verticalForm:"-esm-stock-management__stock-items-table__verticalForm___oOj2I",headerBtnContainer:"-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p",tileContainer:"-esm-stock-management__stock-items-table__tileContainer___N1eHZ",tile:"-esm-stock-management__stock-items-table__tile___ZZNjt",tileContent:"-esm-stock-management__stock-items-table__tileContent___SC542",content:"-esm-stock-management__stock-items-table__content___zdm4U",helper:"-esm-stock-management__stock-items-table__helper___kKhcQ",separator:"-esm-stock-management__stock-items-table__separator___JXP1R",toolbarContent:"-esm-stock-management__stock-items-table__toolbarContent___oBPmt",filterContainer:"-esm-stock-management__stock-items-table__filterContainer___hAyU2",dateAlign:"-esm-stock-management__stock-items-table__dateAlign___RNWUI",filtersAlign:"-esm-stock-management__stock-items-table__filtersAlign___TaNrL"};const l=i},2761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_{margin-bottom:150px}","",{version:3,sources:["webpack://./src/stock-locations/stock-locations-table.scss"],names:[],mappings:"AAAA,uEACE,mBAAA",sourceRoot:""}]),i.locals={loaderContainer:"-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_"};const l=i},965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-management-header__header___eKmgW{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;height:6rem;background-color:#fff;display:flex;padding-left:8px;justify-content:space-between}.-esm-stock-management__stock-management-header__left-justified-items___VpNpP{display:flex;flex-direction:row;align-items:center;cursor:pointer}.-esm-stock-management__stock-management-header__right-justified-items___IOVey{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;margin:.5rem}.-esm-stock-management__stock-management-header__page-name___CPqh1{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-management-header__page-labels___qR7PY{margin:1rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__date-and-location___Uxut9{display:flex;justify-content:flex-end;align-items:center;margin-right:1rem}.-esm-stock-management__stock-management-header__value___eLYN8{margin-left:.25rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__view___f_vFK{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-management-header/stock-management-header.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,gEC61BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD31BF,aEyCQ,CFxCR,WG0DW,CHzDX,qBDRM,CCSN,YAAA,CACA,gBAAA,CACA,6BAAA,CAGF,8EACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,cAAA,CAGF,+EC40BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD10BF,aEwBQ,CFvBR,YAAA,CAGF,mECs0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CDl0BJ,qEACE,WAAA,CAGF,gEACE,cAAA,CAGF,2EACE,YAAA,CACA,wBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,+DACE,kBAAA,CAGF,gEACE,cAAA,CAGF,8DC2yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA",sourceRoot:""}]),i.locals={header:"-esm-stock-management__stock-management-header__header___eKmgW","left-justified-items":"-esm-stock-management__stock-management-header__left-justified-items___VpNpP","right-justified-items":"-esm-stock-management__stock-management-header__right-justified-items___IOVey","page-name":"-esm-stock-management__stock-management-header__page-name___CPqh1","page-labels":"-esm-stock-management__stock-management-header__page-labels___qR7PY",middot:"-esm-stock-management__stock-management-header__middot___gwifp","date-and-location":"-esm-stock-management__stock-management-header__date-and-location___Uxut9",value:"-esm-stock-management__stock-management-header__value___eLYN8",view:"-esm-stock-management__stock-management-header__view___f_vFK"};const l=i},2496:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-operation__sectionTitle___t2vui{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-operation__modalBody___YyRxm{padding-bottom:1rem}.-esm-stock-management__add-stock-operation__actionsContainer___SDbLm{display:flex;justify-content:space-between;margin:5px}.-esm-stock-management__add-stock-operation__statusContainer___MzxxK{display:flex;margin-top:4px;gap:1rem}.-esm-stock-management__add-stock-operation__textHeading___eg7oM{font-weight:bold}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe{margin-top:4px}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe .-esm-stock-management__add-stock-operation__text___DFlMr{margin-right:4px}.-esm-stock-management__add-stock-operation__actionButtons___XhL8k{margin:10px;display:flex;flex-direction:row}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-operations/add-stock-operation/add-stock-operation.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCpDF,kEC+1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD71BA,aAAA,CACA,oBEoBS,CFjBb,+DACI,mBEqBS,CFlBb,sEACI,YAAA,CACA,6BAAA,CACA,UAAA,CAGJ,qEACI,YAAA,CACA,cAAA,CACA,QAAA,CAGJ,iEACI,gBAAA,CAGJ,wEACI,cAAA,CACA,kIACI,gBAAA,CAIR,mEACI,WAAA,CACA,YAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-operation__sectionTitle___t2vui",modalBody:"-esm-stock-management__add-stock-operation__modalBody___YyRxm",actionsContainer:"-esm-stock-management__add-stock-operation__actionsContainer___SDbLm",statusContainer:"-esm-stock-management__add-stock-operation__statusContainer___MzxxK",textHeading:"-esm-stock-management__add-stock-operation__textHeading___eg7oM",statusDescriptions:"-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe",text:"-esm-stock-management__add-stock-operation__text___DFlMr",actionButtons:"-esm-stock-management__add-stock-operation__actionButtons___XhL8k"};const l=i},6781:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const l=i},6360:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN .cds--data-table-content{height:calc(100vh - 150px)}","",{version:3,sources:["webpack://./src/stock-operations/add-stock-operation/stock-items-addition.component.scss"],names:[],mappings:"AACE,wGACE,0BAAA",sourceRoot:""}]),i.locals={tableContainer:"-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN"};const l=i},1256:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-operations-dialog__section___fLTYQ{margin:.5rem}.-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp{margin-bottom:.75rem}.-esm-stock-management__stock-operations-dialog__modalBody___xG3z2{padding-bottom:1rem}","",{version:3,sources:["webpack://./src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAGA,iEACE,YCiBW,CDdb,sEACE,oBCkBW,CDfb,mEACE,mBCmBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__stock-operations-dialog__section___fLTYQ",sectionTitle:"-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp",modalBody:"-esm-stock-management__stock-operations-dialog__modalBody___xG3z2"};const l=i},557:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__create-stock-report__reportContainer___pFGwm{min-height:15rem;display:flex;flex-direction:column;row-gap:1rem;padding:1rem}.-esm-stock-management__create-stock-report__reportButton___T0m6Q{padding:1rem}.-esm-stock-management__create-stock-report__sectionTitle___y25tl{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__subTitle___Pgm2N{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__modalBody___VVZO6{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/generate-report/create-stock-report.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,qEACE,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CACA,YAAA,CAEF,kEACE,YAAA,CAGF,kECm1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDj1BF,aDZQ,CCaR,oBEQW,CFLb,8DACE,cAAA,CACA,oBEGW,CAAA,+DFCX,mBEIW",sourceRoot:""}]),i.locals={reportContainer:"-esm-stock-management__create-stock-report__reportContainer___pFGwm",reportButton:"-esm-stock-management__create-stock-report__reportButton___T0m6Q",sectionTitle:"-esm-stock-management__create-stock-report__sectionTitle___y25tl",subTitle:"-esm-stock-management__create-stock-report__subTitle___Pgm2N",modalBody:"-esm-stock-management__create-stock-report__modalBody___VVZO6"};const l=i},5861:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-reports__content___A4qFU{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-reports__helper___J9F35{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-reports__separator___yNdhd{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-reports__separator___yNdhd::before,.-esm-stock-management__stock-reports__separator___yNdhd::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-reports__separator___yNdhd::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-reports__separator___yNdhd::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-reports__tileContainer___nLbej{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-reports__tile___L1giA{margin:auto;width:fit-content}.-esm-stock-management__stock-reports__tileContent___J975x{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/report-list/stock-reports.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,uDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,sDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,yDCm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-reports__content___A4qFU",helper:"-esm-stock-management__stock-reports__helper___J9F35",separator:"-esm-stock-management__stock-reports__separator___yNdhd",tileContainer:"-esm-stock-management__stock-reports__tileContainer___nLbej",tile:"-esm-stock-management__stock-reports__tile___L1giA",tileContent:"-esm-stock-management__stock-reports__tileContent___J975x"};const l=i},2033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-settings__productiveHeading01___L9i81,.-esm-stock-management__stock-settings__title____W_Wx{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__productiveHeading02___hss5P{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading03___fPfXI{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading04___nygs1{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading05___oSN3A{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading06___DHu2c{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyShort01___tYpmd{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__helperText01___ZY1nd{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__bodyShort02___iosfZ{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyLong01___HhqRS{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__bodyLong02___jSFlj{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__label01___lbC3K{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__text02___Vqsry{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-settings__container___BnGf9{padding:2rem}.-esm-stock-management__stock-settings__formContainer___nHBLE{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-settings__verticalForm___S9Wbd{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--form-item{flex:none !important}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-settings__StockSettings___IhIeT{display:flex;justify-content:center;flex-direction:column;justify-content:flex-end;min-height:12.5rem;border:1px solid #e0e0e0;margin:.5rem;align-items:center;background-color:#fff}.-esm-stock-management__stock-settings__StockSettings___IhIeT>button{margin-bottom:2rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-settings/stock-settings.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_layout.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0HC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,oEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,oECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,oECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,oEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,oEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,4DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,6DCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,4DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,2DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,2DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,wDCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,uDACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,0DACE,YEpCW,CFuCb,8DACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,6DACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,6EACE,oBAAA,CAGF,yEACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGrGJ,8DACI,YAAA,CACA,sBAAA,CACA,qBAAA,CACA,wBAAA,CACA,kBAAA,CACA,wBAAA,CACA,YDUS,CCTT,kBAAA,CACA,qBC6GM,CD3GN,qEACI,kBEKI",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-settings__productiveHeading01___L9i81",title:"-esm-stock-management__stock-settings__title____W_Wx",productiveHeading02:"-esm-stock-management__stock-settings__productiveHeading02___hss5P",productiveHeading03:"-esm-stock-management__stock-settings__productiveHeading03___fPfXI",productiveHeading04:"-esm-stock-management__stock-settings__productiveHeading04___nygs1",productiveHeading05:"-esm-stock-management__stock-settings__productiveHeading05___oSN3A",productiveHeading06:"-esm-stock-management__stock-settings__productiveHeading06___DHu2c",bodyShort01:"-esm-stock-management__stock-settings__bodyShort01___tYpmd",helperText01:"-esm-stock-management__stock-settings__helperText01___ZY1nd",bodyShort02:"-esm-stock-management__stock-settings__bodyShort02___iosfZ",bodyLong01:"-esm-stock-management__stock-settings__bodyLong01___HhqRS",bodyLong02:"-esm-stock-management__stock-settings__bodyLong02___jSFlj",label01:"-esm-stock-management__stock-settings__label01___lbC3K",text02:"-esm-stock-management__stock-settings__text02___Vqsry",container:"-esm-stock-management__stock-settings__container___BnGf9",formContainer:"-esm-stock-management__stock-settings__formContainer___nHBLE",verticalForm:"-esm-stock-management__stock-settings__verticalForm___S9Wbd",StockSettings:"-esm-stock-management__stock-settings__StockSettings___IhIeT"};const l=i},8098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-sources__section___NMR9P{margin:.5rem}.-esm-stock-management__add-stock-sources__sectionTitle___mIFZm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-sources__modalBody___QeuLr{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/add-stock-sources/add-stock-sources.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,2DACE,YCgBW,CDbb,gEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,6DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-sources__section___NMR9P",sectionTitle:"-esm-stock-management__add-stock-sources__sectionTitle___mIFZm",modalBody:"-esm-stock-management__add-stock-sources__modalBody___QeuLr"};const l=i},5551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-sources/stock-sources-filter/stock-sources-filter.scss"],names:[],mappings:"AACI,sGACE,KAAA,CAGF,gGACE,WAAA,CAGF,mHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5"};const l=i},6940:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-sources__container___WSslj{background-color:#f4f4f4}.-esm-stock-management__stock-sources__headerContainer___Ze03U{display:flex;justify-content:space-between;align-items:center;padding:1rem;background-color:#fff}.-esm-stock-management__stock-sources__headerButtons___diHXv{display:flex;flex-flow:column}.-esm-stock-management__stock-sources__heading___eDFEL{font-size:20px;font-weight:bold}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown--inline .cds--list-box__field{min-width:12rem}.-esm-stock-management__stock-sources__tooltip___CZOKY .cds--tooltip__trigger.cds--tooltip__trigger--definition{border-bottom:none}.-esm-stock-management__stock-sources__tag___KdICQ{margin:.25rem 0}.-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-sources__search___skZQ1{max-width:16rem}.-esm-stock-management__stock-sources__search___skZQ1 input{background-color:#fff !important}.-esm-stock-management__stock-sources__tableContainer___lpDEm{background-color:#f4f4f4;margin:0 1rem;padding:0}.-esm-stock-management__stock-sources__tableContainer___lpDEm a{text-decoration:none}.-esm-stock-management__stock-sources__tableContainer___lpDEm th{color:#525252}.-esm-stock-management__stock-sources__tableContainer___lpDEm .cds--data-table{background-color:#e0e0e0}.-esm-stock-management__stock-sources__tableContainer___lpDEm .-esm-stock-management__stock-sources__toolbarContent___gZ2MJ{height:2rem;margin-bottom:.25rem}.-esm-stock-management__stock-sources__emptyRow___wlFNH{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-sources__stockSourcesTable___KNEf1 tr:last-of-type td{border-bottom:none}.-esm-stock-management__stock-sources__content___EBUcR{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-sources__helper___Pxp0P{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-sources__separator___NUg2A{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-sources__separator___NUg2A::before,.-esm-stock-management__stock-sources__separator___NUg2A::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-sources__separator___NUg2A::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-sources__separator___NUg2A::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-sources__tileContainer___p2Nnr{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-sources__tile___ZRgFn{margin:auto;width:fit-content}.-esm-stock-management__stock-sources__tileContent___dm3Qq{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-sources__menuItem___Brdql{max-width:none}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__desktopHeading___tb1eK,.-esm-stock-management__stock-sources__tabletHeading___rIkv3{text-align:left;text-transform:capitalize;margin-bottom:1rem}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4:after,.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__stock-sources__statusContainer___meWIY{display:flex;align-items:center}.-esm-stock-management__stock-sources__statusContainer___meWIY svg{margin-right:.5rem}.-esm-stock-management__stock-sources__visitType___HhWht{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0)}.-esm-stock-management__stock-sources__headerBtnContainer___zSCLg{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q{margin-left:1rem;height:3rem}.-esm-stock-management__stock-sources__editIcon___A00kf{color:#0f62fe;margin-top:.5rem;cursor:pointer}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/stock-sources.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,yDACE,wBDNM,CCSR,+DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,YAAA,CACA,qBDPc,CCUhB,6DACE,YAAA,CACA,gBAAA,CAGF,uDACE,cAAA,CACA,gBAAA,CAIA,+FACE,KAAA,CAGF,yFACE,WAAA,CAGF,4GACE,eAAA,CAIJ,gHACE,kBAAA,CAGF,mDACE,eAAA,CAGF,+EACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,sDACE,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,wBDjEM,CCkEN,aAAA,CACA,SAAA,CAEA,gEACE,oBAAA,CAGF,iEACE,aC1BM,CD6BR,+EACE,wBD5EI,CC+EN,4HACE,WEzCS,CF0CT,oBEnES,CFuEb,wDACE,cAAA,CACA,YAAA,CACA,kBAAA,CAIA,oFACE,kBAAA,CAKJ,uDG8vBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH5vBF,aCtDQ,CDuDR,mBAAA,CAGF,sDGwvBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CHtvBF,aC5DQ,CD+DV,yDGmvBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CHjvBF,aCjEQ,CDkER,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnHM,CCoHN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7IM,CC8IN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,wDACE,cAAA,CAIA,iEG+rBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH7rBA,aCrHM,CD0HR,gEGwrBE,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CHtrBA,aC5HM,CDgIV,2HAEE,eAAA,CACA,yBAAA,CACA,kBErJW,CFuJX,6IACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2CAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CAEA,mEACE,kBAAA,CAIJ,yDG0pBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CHtpBJ,kEACE,qBDtMc,CCuMd,YE/KW,CFgLX,gBAAA,CAGF,mEACE,gBEpLW,CFqLX,WEjKW,CFoKb,wDACE,aDnMe,CCoMf,gBAAA,CACA,cAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-sources__container___WSslj",headerContainer:"-esm-stock-management__stock-sources__headerContainer___Ze03U",headerButtons:"-esm-stock-management__stock-sources__headerButtons___diHXv",heading:"-esm-stock-management__stock-sources__heading___eDFEL",filterContainer:"-esm-stock-management__stock-sources__filterContainer___SeMsL",tooltip:"-esm-stock-management__stock-sources__tooltip___CZOKY",tag:"-esm-stock-management__stock-sources__tag___KdICQ",backgroundDataFetchingIndicator:"-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ",search:"-esm-stock-management__stock-sources__search___skZQ1",tableContainer:"-esm-stock-management__stock-sources__tableContainer___lpDEm",toolbarContent:"-esm-stock-management__stock-sources__toolbarContent___gZ2MJ",emptyRow:"-esm-stock-management__stock-sources__emptyRow___wlFNH",stockSourcesTable:"-esm-stock-management__stock-sources__stockSourcesTable___KNEf1",content:"-esm-stock-management__stock-sources__content___EBUcR",helper:"-esm-stock-management__stock-sources__helper___Pxp0P",separator:"-esm-stock-management__stock-sources__separator___NUg2A",tileContainer:"-esm-stock-management__stock-sources__tileContainer___p2Nnr",tile:"-esm-stock-management__stock-sources__tile___ZRgFn",tileContent:"-esm-stock-management__stock-sources__tileContent___dm3Qq",menuItem:"-esm-stock-management__stock-sources__menuItem___Brdql",desktopHeading:"-esm-stock-management__stock-sources__desktopHeading___tb1eK",tabletHeading:"-esm-stock-management__stock-sources__tabletHeading___rIkv3",statusContainer:"-esm-stock-management__stock-sources__statusContainer___meWIY",visitType:"-esm-stock-management__stock-sources__visitType___HhWht",headerBtnContainer:"-esm-stock-management__stock-sources__headerBtnContainer___zSCLg",addPatientToListBtn:"-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q",editIcon:"-esm-stock-management__stock-sources__editIcon___A00kf"};const l=i},4300:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko{margin:.5rem}.-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X{padding-bottom:1rem}.-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));gap:16px}.-esm-stock-management__add-stock-user-role-scope__hr___S9Kir{border:1px solid #000}.-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts{margin:5px}.-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM{width:100%}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,mEACE,YCgBW,CDbb,wEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,oEACE,cAAA,CACA,oBCUW,CDPb,qEACE,mBCWW,CDRb,wEACE,YAAA,CACA,2DAAA,CACA,QAAA,CAGF,8DACE,qBAAA,CAGF,kEACE,UAAA,CAGF,oEACE,UAAA",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko",sectionTitle:"-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005",subTitle:"-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq",modalBody:"-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X",checkboxGrid:"-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg",hr:"-esm-stock-management__add-stock-user-role-scope__hr___S9Kir",toggle:"-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts",checkbox:"-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM"};const l=i},5104:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-user-role-scopes__content___g06Q8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-user-role-scopes__helper___VOKFX{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before,.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-user-role-scopes__tile___C5KRv{margin:auto;width:fit-content}.-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/stock-user-role-scopes.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,+DCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,kECm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,mJAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,0EACE,WAAA,CACA,gBAAA,CAGF,yEACE,UAAA,CACA,iBAAA,CAIJ,sEACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,6DACE,WAAA,CACA,iBAAA,CAGF,oEACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-user-role-scopes__content___g06Q8",helper:"-esm-stock-management__stock-user-role-scopes__helper___VOKFX",separator:"-esm-stock-management__stock-user-role-scopes__separator___M4cpF",tileContainer:"-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd",tile:"-esm-stock-management__stock-user-role-scopes__tile___C5KRv",tileContent:"-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa"};const l=i},2894:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deletePackagingUnitButton:()=>Fs,deletePackagingUnitModal:()=>zs,deleteStockModal:()=>Us,deleteUserScopeModal:()=>js,importBulkStockItemsDialog:()=>Ls,importTranslation:()=>ps,root:()=>Bs,startupApp:()=>Ms,stockItems:()=>bs,stockItemsLink:()=>ys,stockLocations:()=>Ss,stockLocationsLink:()=>Ds,stockManagement:()=>Ts,stockManagementAdminCardLink:()=>As,stockManagementAppMenuItem:()=>Rs,stockNavMenu:()=>gs,stockOperationDialog:()=>Ps,stockOperations:()=>_s,stockOperationsLink:()=>hs,stockOverview:()=>fs,stockOverviewLink:()=>vs,stockReports:()=>Os,stockReportsLink:()=>xs,stockSettings:()=>Ns,stockSettingsLink:()=>Is,stockSources:()=>Es,stockSourcesLink:()=>ws,stockUserScopes:()=>ks,stockUserScopesLink:()=>Cs});var r=n(7248),o={printItemCost:{type:r.Type.Boolean,_default:!1,_description:"Whether to print item costs on the print out"},printBalanceOnHand:{type:r.Type.Boolean,_default:!1,_description:"Whether to print balance on hand on the print out"},packagingUnitsUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the packaging unit",_default:"bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2"},stockAdjustmentReasonUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock adjustment reasons",_default:"3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25"},stockSourceTypeUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock source types",_default:"2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d"},dispensingUnitsUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock dispensing units uuid",_default:"162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},stockItemCategoryUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock item category",_default:"6d24eb6e-b42f-4706-ab2d-ae4472161f6a"},logo:{src:{_type:r.Type.String,_default:null,_description:"A path or URL to an image."},alt:{_type:r.Type.String,_default:"Logo",_description:"Alt text, shown on hover"},name:{_type:r.Type.String,_default:null,_description:"The organization name displayed when image is absent"}}},a=n(6478),i=n(1672),l=n.n(i),c=n(7410),s=n.n(c),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),f=n(2434),v=n.n(f),_=n(1422),h=n.n(_),b=n(7813),y={};y.styleTagTransform=h(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(b.Z,y);const k=b.Z&&b.Z.locals?b.Z.locals:void 0;var C=n(601);var E=n(3397);function w(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function S(){var e;return e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){return t=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){w(a,r,o,i,l,"next",e)}function l(e){w(a,r,o,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function D(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}var O=n(49),x={};x.styleTagTransform=h(),x.setAttributes=g(),x.insert=p().bind(null,"head"),x.domAPI=d(),x.insertStyleElement=v(),s()(O.Z,x);const N=O.Z&&O.Z.locals?O.Z.locals:void 0;var I=n(1256),T={};T.styleTagTransform=h(),T.setAttributes=g(),T.insert=p().bind(null,"head"),T.domAPI=d(),T.insertStyleElement=v(),s()(I.Z,T);const B=I.Z&&I.Z.locals?I.Z.locals:void 0;var P,U=n(9820);function j(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var r=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var r=e[t];return n&&(!1===r||!0===r||r)||!n&&(""===r||!1===r||!0===r||r)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r.toString())):null})).filter((function(e){return null!=e})).join("&");return r.length>0?"?"+r:""}function z(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function F(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function L(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function R(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e.uuid),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Default="default",e.Full="full",e.REF="ref"}(P||(P={}));var M=function(e){switch(e){case"NEW":return"#0f62fe";case"SUBMITTED":return"#4589ff";case"DISPATCHED":return"#8a3ffc";case"COMPLETED":return"#24a148";case"CANCELLED":return"#da1e28";case"RETURNED":return"#eb6200"}};function q(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}var G={isOverlayOpen:!1,component:Function,header:""},H=function(){return(0,r.getGlobalStore)("dispensing-store",G)},Z=function(e,t){H().setState({isOverlayOpen:!0,component:t,header:e})},Y=function(){H().setState({component:null,isOverlayOpen:!1})},Q=n(2653),J=n.n(Q),W=function(e,t){return e?J()(e).format(null!=t?t:"DD-MMM-YYYY"):""},V=("".concat(window.getOpenmrsSpaBase),J()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),K="d/m/Y",X=function(e){return W(e,V)},$=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},ee=Object.freeze({SOURCES:"Sources",OPERATION:"Operation",STATUS:"Status"}),te="Main Store",ne="/openmrs/",re=!0;function oe(e){var t,n,r,o,a,i=null==e||null===(n=e.responseBody)||void 0===n||null===(t=n.error)||void 0===t?void 0:t.fieldErrors;return i?Object.values(i).flatMap((function(e){return e.map((function(e){return e.message}))})):[null!==(a=null==e||null===(o=e.responseBody)||void 0===o||null===(r=o.error)||void 0===r?void 0:r.message)&&void 0!==a?a:null==e?void 0:e.message]}"".concat(ne,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var ae=function(e){(0,U.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!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 le(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ce(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||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}}(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.")}()}var se=n(8115);var ue=n(1657);const de=function(e){var t=e.row,n=(0,i.useCallback)((function(){var e=(0,r.showModal)("delete-packaging-unit-modal",{closeModal:function(){return e()},row:t})}),[t]);return l().createElement("div",null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:ue.ZN,onClick:n}))};function me(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function pe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ae(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockbatch").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function ge(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading,l=n.mutate;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a,mutate:l}}function fe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e,"?v=full"),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{item:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function ve(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem"),n=new AbortController;return delete e.isDrug,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function _e(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e.uuid),n=new AbortController;return delete e.isDrug,delete e.dateCreated,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}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 be(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}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.")}()}function ye(e){var t=be((0,i.useState)({startIndex:0,v:e||P.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=be((0,i.useState)(),2),a=o[0],l=o[1];(0,i.useEffect)((function(){r({startIndex:0,v:P.Default,totalCount:!0,stockItemUuid:a})}),[a]);var c=ge(n),s=c.items,u=c.isLoading,d=c.isError,m=c.mutate;return{items:s.results,totalCount:s.totalCount,isLoading:u,isError:d,setStockItemUuid:l,mutate:m}}var ke=n(4158),Ce={};Ce.styleTagTransform=h(),Ce.setAttributes=g(),Ce.insert=p().bind(null,"head"),Ce.domAPI=d(),Ce.insertStyleElement=v(),s()(ke.Z,Ce);const Ee=ke.Z&&ke.Z.locals?ke.Z.locals:void 0;function we(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}var Se=n(1914),De=n(965),Oe={};Oe.styleTagTransform=h(),Oe.setAttributes=g(),Oe.insert=p().bind(null,"head"),Oe.domAPI=d(),Oe.insertStyleElement=v(),s()(De.Z,Oe);const xe=De.Z&&De.Z.locals?De.Z.locals:void 0,Ne=function(){return l().createElement("svg",{width:"72",height:"72",viewBox:"0 0 62 58",xmlns:"http://www.w3.org/2000/svg"},l().createElement("defs",null,l().createElement("path",{id:"whv9q6f4ta",d:"M0 0h62v30.508H0z"}),l().createElement("path",{id:"hp71ojgcnc",d:"M0 0h24.603v26.571H0z"})),l().createElement("g",{fill:"none"},l().createElement("g",{opacity:".193",transform:"matrix(-1 0 0 1 62 26.571)"},l().createElement("path",{d:"M62 0c0 16.85-13.916 30.508-31.037 30.508S0 16.849 0 0h62z",fill:"var(--brand-03)",mask:"url(#rt0c8mo6eb)"})),l().createElement("g",{opacity:".396",transform:"matrix(-1 0 0 1 60.032 0)"},l().createElement("path",{d:"m24.603 26.571-13.35-23.51C9.592.141 5.884-.869 3.011.817.138 2.503-.855 6.272.804 9.193l9.874 17.378",fill:"var(--brand-03)",mask:"url(#hgianthqwd)"}))))};var Ie=n(9375),Te=n(2411),Be=function(){var e,t=(0,E.useTranslation)().t,n=(0,r.useSession)(),o=null==n||null===(e=n.sessionLocation)||void 0===e?void 0:e.display;return l().createElement("div",{className:xe.header},l().createElement("div",{className:xe["left-justified-items"]},l().createElement(Ne,null),l().createElement("div",{className:xe["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:xe["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:xe["right-justified-items"]},l().createElement("div",{className:xe["date-and-location"]},l().createElement(Ie.Ye,{size:16}),l().createElement("span",{className:xe.value},o),l().createElement("span",{className:xe.middot},"·"),l().createElement(Te.f,{size:16}),l().createElement("span",{className:xe.value},(0,r.formatDate)(new Date,{mode:"standard"})))))};const Pe=function(e){var t=e.dashboardSlot,n=e.title;return l().createElement(l().Fragment,null,l().createElement(Be,null),l().createElement(r.ExtensionSlot,{name:t,state:{dashboardTitle:n}}))};var Ue=n(3011),je={};je.styleTagTransform=h(),je.setAttributes=g(),je.insert=p().bind(null,"head"),je.domAPI=d(),je.insertStyleElement=v(),s()(Ue.Z,je);const ze=Ue.Z&&Ue.Z.locals?Ue.Z.locals:void 0;var Fe=n(6194),Le=n(2296),Re={};Re.styleTagTransform=h(),Re.setAttributes=g(),Re.insert=p().bind(null,"head"),Re.domAPI=d(),Re.insertStyleElement=v(),s()(Le.Z,Re);const Me=Le.Z&&Le.Z.locals?Le.Z.locals:void 0,qe=function(){var e=function(){var e,t,n=(e=(0,i.useState)(),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return q(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)?q(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.")}()),r=n[0],o=n[1];return(0,i.useEffect)((function(){var e=function(e){o(e)};e(H().getState()),H().subscribe(e)}),[]),{isOverlayOpen:null==r?void 0:r.isOverlayOpen,component:null==r?void 0:r.component,header:null==r?void 0:r.header}}(),t=e.header,n=e.component,o=e.isOverlayOpen,c=(0,r.useLayoutType)(),s=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,o&&l().createElement("div",{className:"tablet"!==c?Me.desktopOverlay:Me.tabletOverlay},"tablet"!==c?l().createElement("div",{className:Me.desktopHeader},l().createElement("div",{className:Me.headerContent},t),l().createElement(a.zxk,{className:Me.closePanelButton,onClick:function(){return Y()},kind:"ghost",hasIconOnly:!0},l().createElement(Fe.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Y()},"aria-label":s("tabletOverlay","Tablet overlay"),className:Me.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(se.Xd,{size:16})),l().createElement("div",{className:Me.headerContent},t)),l().createElement("div",null,n)))};function Ge(){var e,t=(0,Se.useParams)(),n=(0,r.useExtensionStore)(),o=(0,r.useLayoutType)(),a=(null===(e=n.slots["stock-page-dashboard-slot"])||void 0===e?void 0:e.assignedExtensions.map((function(e){return e.meta})).filter((function(e){return Object.keys(e).length})))||[],i=a.find((function(e){return e.name===(null==t?void 0:t.dashboard)}))||a[0];return l().createElement(l().Fragment,null,l().createElement(qe,null),l().createElement("div",{className:ze.homePageWrapper},l().createElement("section",{className:(0,r.isDesktop)(o)?ze.dashboardContainer:ze.dashboardContainerTablet},(0,r.isDesktop)(o)&&l().createElement(r.ExtensionSlot,{name:"stock-sidebar-slot",key:o}),l().createElement(Pe,{title:null==i?void 0:i.name,dashboardSlot:null==i?void 0:i.slot})),l().createElement(r.WorkspaceContainer,{overlay:!0,contextKey:"stock-management"})))}var He=n(2426),Ze={};Ze.styleTagTransform=h(),Ze.setAttributes=g(),Ze.insert=p().bind(null,"head"),Ze.domAPI=d(),Ze.insertStyleElement=v(),s()(He.Z,Ze);const Ye=He.Z&&He.Z.locals?He.Z.locals:void 0;var Qe=n(3432),Je={};Je.styleTagTransform=h(),Je.setAttributes=g(),Je.insert=p().bind(null,"head"),Je.domAPI=d(),Je.insertStyleElement=v(),s()(Qe.Z,Je);const We=Qe.Z&&Qe.Z.locals?Qe.Z.locals:void 0;var Ve=n(9697),Ke=n(7412),Xe=n.n(Ke);J().extend(Xe());const $e=function(e){var t,n,o,i,c,s=e.label,u=e.value,d=e.headerLabel,m=e.children,p=e.view,A=e.count,g=e.outofstockCount,f=e.disposedCount,v=(0,E.useTranslation)().t;return l().createElement(a.n9L,{className:We.tileContainer},l().createElement("div",{className:We.tileHeader},l().createElement("div",{className:We.headerLabelContainer},l().createElement("label",{className:We.headerLabel},d),m),p&&l().createElement(r.ConfigurableLink,{className:We.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(se.ol,{size:16,className:We.viewListBtn}))),l().createElement("div",{className:We.metricsGrid},l().createElement("div",null,l().createElement("label",{className:We.totalsLabel},s),l().createElement("p",{className:We.totalsValue},u)),!(0,Ve.Z)(A)&&l().createElement("div",{className:We.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("in6months","In 6 months")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=A.expiry6months)||void 0===t?void 0:t.length)),!(0,Ve.Z)(g)&&l().createElement("div",{className:We.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},v("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(n=g.itemsbelowmin)||void 0===n?void 0:n.length),l().createElement("p",{style:{color:"#319227"}},null===(o=g.itemsabovemax)||void 0===o?void 0:o.length)),!(0,Ve.Z)(f)&&l().createElement("div",{className:We.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},v("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(i=f.expired)||void 0===i?void 0:i.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(c=f.poorquality)||void 0===c?void 0:c.length))))};function et(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){var t,n,r,o=(n=(0,i.useState)({v:e||P.Default,q:null,totalCount:!0}),r=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(n,r)||function(e,t){if(e){if("string"==typeof e)return et(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)?et(e,t):void 0}}(n,r)||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.")}()),a=o[0],l=o[1],c=me(a),s=c.items,u=c.isLoading,d=c.isError;return(0,i.useEffect)((function(){l({v:P.Default,totalCount:!0})}),[]),{items:null!==(t=null==s?void 0:s.results)&&void 0!==t?t:[],isLoading:u,isError:d}}function nt(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 rt(){var e,t,n=(e=(0,i.useState)({startIndex:0,v:P.Default,q:null,includeStockItemName:"true"}),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nt(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)?nt(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.")}()),r=n[0],o=n[1];(0,i.useEffect)((function(){o({v:P.Default,includeStockItemName:"true"})}),[]);var a,l=Ae(r),c=l.items,s=l.isLoading,u=l.isError;return{items:null!==(a=c.results)&&void 0!==a?a:[],isLoading:s,isError:u}}function ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const at=function(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockitem?v=default&totalCount=true"),t=(0,U.ZP)(e,r.openmrsFetch),n=t.data,o=t.error,a=null==n?void 0:n.data.results.map((function(e){return{uuid:e.uuid,hasExpiration:e.hasExpiration,expiryNotice:e.expiryNotice}}));return{stockList:null!=a?a:[],isLoading:!n&&!o,error:o}}(),o=n.stockList,i=n.isLoading,c=n.error,s=rt(),u=s.items,d=(s.isLoading,tt().items),m=new Date,p=u.map((function(e){var t=null==d?void 0:d.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(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){ot(e,t,n[t])}))}return e}({},e,t)}));p=p.filter((function(e){return e.hasExpiration}));var A=p.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),r=Math.ceil((n.getTime()-m.getTime())/864e5);return r<=t||r<0})),g=A.filter((function(e){return e.hasExpiration&&e.expiryNotice<=180})),f=function(e){var t,n=z(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:o,isError:a}}({v:P.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(c)return l().createElement(r.ErrorState,{headerTitle:t("errorStockMetric"),error:c});var v=f&&f.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),_=f&&f.filter((function(e){return"Poor Quality"===e.reasonName}));return l().createElement(l().Fragment,null,l().createElement("div",{className:Ye.cardContainer},l().createElement($e,{label:t("stocks","Expiring stock"),value:(null==A?void 0:A.length)||0,headerLabel:t("expiringStock","Expiring Stock"),view:"items",count:{expiry6months:g}}),l().createElement($e,{label:t("outofstock","Out of Stock"),value:null==o?void 0:o.length,headerLabel:t("highestServiceVolume","Out of Stock "),view:"items",outofstockCount:{itemsbelowmin:["0"],itemsabovemax:["0"]}}),l().createElement($e,{label:t("disposedstock","Disposed Stock"),value:(null==f?void 0:f.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:v,poorquality:_}})))};var it=n(8629),lt={};lt.styleTagTransform=h(),lt.setAttributes=g(),lt.insert=p().bind(null,"head"),lt.domAPI=d(),lt.insertStyleElement=v(),s()(it.Z,lt);const ct=it.Z&&it.Z.locals?it.Z.locals:void 0;var st=n(4797);function ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),rt()),n=t.items,o=t.isLoading,i=tt(),c=i.items;if(i.isLoading||o)return l().createElement(l().Fragment,null);if(0===(null==c?void 0:c.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:ct.content},e("inventoryAlertNull","No inventory alerts to display")));var s=new Date,u=n.map((function(e){var t=null==c?void 0:c.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(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){ut(e,t,n[t])}))}return e}({},e,t)}));u=u.filter((function(e){return e.hasExpiration}));var d=u.filter((function(e){var t=new Date(e.expiration),n=Math.ceil((t.getTime()-s.getTime())/864e5);return n<=180&&n>=0})).slice(0,5);return l().createElement(l().Fragment,null,d.map((function(e,t){return l().createElement("div",{className:ct.card,key:t},l().createElement("div",{className:ct.colorLineRed}),l().createElement("div",{className:ct.icon},l().createElement(st.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:ct.cardText},l().createElement("p",null,"EXPIRING STOCK"),l().createElement("p",null,l().createElement("strong",null,null==e?void 0:e.drugName)," ",null==e?void 0:e.dispensingUnitName)))})),l().createElement(a.zxk,{onClick:function(){(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/expired-stock")})},kind:"ghost"},"View All"))};var mt=n(8748);const pt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=z(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"receipt"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:o,isError:a}}({v:P.Full,totalCount:!0})),n=t.items;return t.isLoading?l().createElement(l().Fragment,null):0===(null==n?void 0:n.length)?l().createElement(l().Fragment,null,l().createElement("p",{className:ct.content},e("receivedNull","No received to display"))):l().createElement(l().Fragment,null,null==n?void 0:n.map((function(e,t){return null==e?void 0:e.stockOperationItems.map((function(n){return l().createElement("div",{className:ct.card,key:t},l().createElement("div",{className:ct.colorLineBlue}),l().createElement("div",{className:ct.icon},l().createElement(mt.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:ct.cardText},l().createElement("p",null,null==e?void 0:e.status," · ",null==e?void 0:e.sourceName," · ",null==e?void 0:e.destinationName),l().createElement("p",null,l().createElement("strong",null,null==n?void 0:n.stockItemName)," ",null==n?void 0:n.stockItemPackagingUOMName,", ",null==n?void 0:n.quantity)))}))})),l().createElement(a.zxk,{onClick:function(){(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/orders")})},kind:"ghost"},e("receivedView","View All")))};var At=n(2327);const gt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=z(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"stockissue"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:o,isError:a}}({v:P.Full,totalCount:!0})),n=t.items;if(t.isLoading)return l().createElement(l().Fragment,null);if(0===(null==n?void 0:n.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:ct.content},e("issuingNull","No issued to display")));var o=null==n?void 0:n.map((function(e,t){return((null==e?void 0:e.stockOperationItems)||[]).map((function(n,r){return{status:null==e?void 0:e.status,sourceName:null==e?void 0:e.sourceName,destinationName:null==e?void 0:e.destinationName,stockItemName:null==n?void 0:n.stockItemName,stockItemPackagingUOMName:null==n?void 0:n.stockItemPackagingUOMName,quantity:null==n?void 0:n.quantity,key:"".concat(t,"-").concat(r)}}))})),i=null==o?void 0:o.flat().slice(0,10);return l().createElement(l().Fragment,null,null==i?void 0:i.map((function(e,t){return l().createElement("div",{className:ct.card,key:t},l().createElement("div",{className:ct.colorLineGreen}),l().createElement("div",{className:ct.icon},l().createElement(At.rs,{size:40,color:"#198038"})),l().createElement("div",{className:ct.cardText},l().createElement("p",null,null==e?void 0:e.status," · ",null==e?void 0:e.sourceName," · ",null==e?void 0:e.destinationName),l().createElement("p",null,l().createElement("strong",null,null==e?void 0:e.stockItemName)," ",null==e?void 0:e.stockItemPackagingUOMName,", ",null==e?void 0:e.quantity)))})),l().createElement(a.zxk,{onClick:function(){(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/requisitions")})},kind:"ghost"},"View All"))},ft=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:ct.cardContainer},l().createElement("div",{className:ct.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?ct.tabletHeading:ct.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(dt,null)))),l().createElement("div",{className:ct.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?ct.tabletHeading:ct.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(pt,null)))),l().createElement("div",{className:ct.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?ct.tabletHeading:ct.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(gt,null)))))};function vt(e){var t=e.dashboardLinkConfig,n=t.name,o=t.title,a=(0,Se.useLocation)(),c="".concat(window.spaBase,"/stock-management"),s=(0,i.useMemo)((function(){var e=a.pathname.split("/"),t=e[e.length-1];return decodeURIComponent(t)}),[a.pathname]);return l().createElement(r.ConfigurableLink,{to:"".concat(c,"/").concat(n),className:"cds--side-nav__link ".concat(s.match(n)&&"active-left-nav-link")},o)}var _t=function(e){return function(){return l().createElement(Se.BrowserRouter,null,l().createElement(vt,{dashboardLinkConfig:e}))}};function ht(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){var t,n,o=z(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ht(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)?ht(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.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,E.useTranslation)().t,v=(0,i.useMemo)((function(){return[{id:0,header:f("type","Type"),key:"operationTypeName"},{id:1,header:f("number","Number"),key:"operationNumber"},{id:2,header:f("status","Status"),key:"status"},{id:3,header:f("location","Location"),key:"location"},{id:4,header:f("responsiblePerson","Responsible Person"),key:"responsiblePerson"},{id:5,header:f("date","Date"),key:"operationDate"},{id:6,key:"details"},{key:"actions",header:""}]}),[f]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:v}}var yt=n(1535),kt={};kt.styleTagTransform=h(),kt.setAttributes=g(),kt.insert=p().bind(null,"head"),kt.domAPI=d(),kt.insertStyleElement=v(),s()(yt.Z,kt);const Ct=yt.Z&&yt.Z.locals?yt.Z.locals:void 0;var Et="RETURNED",wt="CANCELLED",St="REJECTED",Dt=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Et,wt,St],Ot=n(6817),xt=n(4642);function Nt(){var e,t,n="".concat(r.fhirBaseUrl,"/Location?_summary=data&_tag=main store,main pharmacy,dispensary "),o=(0,U.ZP)(n,r.openmrsFetch),a=o.data,l=o.error,c=o.isLoading,s=(0,i.useMemo)((function(){var e,t,n;return null!==(n=null==a||null===(t=a.data)||void 0===t||null===(e=t.entry)||void 0===e?void 0:e.map((function(e){return e.resource})))&&void 0!==n?n:[]}),[null==a||null===(e=a.data)||void 0===e?void 0:e.entry]);return{stockLocations:null!==(t=(0,xt.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}function It(e){var t="".concat(r.restBaseUrl,"/role").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Tt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default"),t=(0,U.ZP)(e,r.openmrsFetch),n=t.data,o=t.isLoading,a=t.error;return{types:(null==n?void 0:n.data)||{},isLoading:o,isError:a}}function Bt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default");return(0,r.openmrsFetch)(e)}function Pt(e){var t="".concat(r.restBaseUrl,"/user").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ut(e){var t="".concat(r.restBaseUrl,"/concept/").concat(e),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function jt(){var e="".concat(r.restBaseUrl,"/stockmanagement/userrolescope");return(0,r.openmrsFetch)(e)}function zt(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 Ft=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Tt(),c=o.types.results,s=o.isLoading,u=o.isError,d=function(){var e,t=(0,r.useSession)().user,n="".concat(r.restBaseUrl,"/stockmanagement/userrolescope"),o=(0,U.ZP)(n,r.openmrsFetch),a=o.data,i=o.isLoading,l=o.error;return{userRoles:null==a||null===(e=a.data)||void 0===e?void 0:e.results.find((function(e){return e.userUuid===t.uuid})),isLoading:i,error:l}}().userRoles,m=(0,i.useMemo)((function(){var e,t,n=(null==d||null===(e=d.operationTypes)||void 0===e?void 0:e.map((function(e){return e.operationTypeUuid})))||[],r=function(e){if(Array.isArray(e))return zt(e)}(t=new Set(n))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return zt(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)?zt(e,t):void 0}}(t)||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.")}();return(null==c?void 0:c.filter((function(e){return r.includes(e.uuid)})))||[]}),[c,d]);return(0,i.useEffect)((function(){null==n||n(m)}),[m,n]),s||u?l().createElement(a.Db,null):l().createElement(a.PQB,{renderIcon:function(){return l().createElement(l().Fragment,null,"Start New ",l().createElement(Ot.r4,{size:16}))},menuOffset:{right:"-100px"},style:{backgroundColor:"#007d79",backgroundImage:"none",color:"#fff",minHeight:"1rem",padding:".95rem !important",width:"8rem",marginRight:"0.5rem",whiteSpace:"nowrap"}},m.sort((function(e,t){return e.name.localeCompare(t.name)})).map((function(e){return l().createElement(a.laM,{key:e.uuid,itemText:e.name,onClick:function(){null==t||t(e)}})})))};var Lt=n(5260),Rt={};Rt.styleTagTransform=h(),Rt.setAttributes=g(),Rt.insert=p().bind(null,"head"),Rt.domAPI=d(),Rt.insertStyleElement=v(),s()(Lt.Z,Rt);const Mt=Lt.Z&&Lt.Z.locals?Lt.Z.locals:void 0,qt=function(e){var t=e.tabs,n=e.title,r=e.hasContainer,o=e.selectedIndex,i=e.onChange;return l().createElement("div",{className:"\n ".concat(r?Mt.tabContainer:"","\n ").concat(Mt.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Mt.heading},n),l().createElement("div",{className:Mt.tab},l().createElement(a.mQc,{className:"".concat(Mt.verticalTabs),selectedIndex:o,onChange:function(e){var t=e.selectedIndex;return null==i?void 0:i(t)}},l().createElement(a.tdY,{"aria-label":"navigation"},t.map((function(e,t){return l().createElement(a.OK9,{key:t,disabled:e.disabled},e.name)}))),l().createElement(a.nPR,null,t.map((function(e,t){return l().createElement(a.x45,{key:t},e.component)}))))))};var Gt,Ht;function Zt(e){return"transferout"===(e=e.toLowerCase())?"transferout":"disposed"===e?"disposed":"stockissue"===e?"stockissue":"stocktake"===e?"stocktake":"requisition"===e?"requisition":"receipt"===e?"receipt":"return"===e?"return":"adjustment"===e?"adjustment":"initial"===e?"initial":void 0}(Ht=Gt||(Gt={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Ht.DISPOSED_OPERATION_TYPE="disposed",Ht.STOCK_ISSUE_OPERATION_TYPE="stockissue",Ht.STOCK_TAKE_OPERATION_TYPE="stocktake",Ht.REQUISITION_OPERATION_TYPE="requisition",Ht.OPENING_STOCK_OPERATION_TYPE="initial",Ht.RECEIPT_OPERATION_TYPE="receipt",Ht.RETURN_OPERATION_TYPE="return",Ht.ADJUSTMENT_OPERATION_TYPE="adjustment";var Yt=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Qt=function(e){return!Jt(e)&&"requisition"!==e},Jt=function(e){return"receipt"===e||"initial"===e},Wt=function(e){return"requisition"===e},Vt=function(e){return"receipt"===e||"initial"===e},Kt=function(e){return"stockissue"===e||"return"===e},Xt=function(e){return"stockissue"===e||$t(e)||en(e)||tn(e)},$t=function(e){return"requisition"===e},en=function(e){return"receipt"===e},tn=function(e){return"transferout"===e},nn=n(7536),rn=n(6312),on=n(1604),an=on.z.object({id:on.z.string().nullish(),uuid:on.z.string().nullish(),stockItemUuid:on.z.string().nullish(),packagingUomName:on.z.string().nullish(),packagingUomUuid:on.z.string().nullish(),factor:on.z.number().nullish(),isDefaultStockOperationsUoM:on.z.boolean().nullish(),isDispensingUnit:on.z.boolean().nullish()}),ln=on.z.object({canView:on.z.boolean(),canEdit:on.z.boolean(),canApprove:on.z.boolean().nullish(),canReceiveItems:on.z.boolean().nullish(),canDisplayReceivedItems:on.z.boolean().nullish(),isRequisitionAndCanIssueStock:on.z.boolean().nullish(),canUpdateBatchInformation:on.z.boolean().nullish()}),cn=on.z.object({itemIndex:on.z.number().nullish(),id:on.z.string().nullish(),uuid:on.z.string().nullish(),stockItemUuid:on.z.string().nullish(),stockItemName:on.z.string().nullish(),stockItemPackagingUOMUuid:on.z.string().nullish(),stockItemPackagingUOMName:on.z.string().nullish(),stockBatchUuid:on.z.string().nullish(),batchNo:on.z.string().nullish(),expiration:on.z.coerce.date().nullish(),quantity:on.z.number().nullish(),purchasePrice:on.z.number().nullish(),permission:ln.nullish(),edit:on.z.boolean().nullish(),hasExpiration:on.z.boolean().nullish(),packagingUnits:an.array(),quantityReceived:on.z.number().nullish(),quantityReceivedPackagingUOMName:on.z.string().nullish(),quantityReceivedPackagingUOMUuid:on.z.string().nullish(),quantityRequested:on.z.number().nullish(),quantityRequestedPackagingUOMUuid:on.z.string().nullish(),quantityRequestedPackagingUOMName:on.z.string().nullish(),commonName:on.z.string().nullish(),acronym:on.z.string().nullish()}),sn=(on.z.object({uuid:on.z.string().nullish(),cancelReason:on.z.string().nullish(),cancelledBy:on.z.coerce.number(),cancelledByGivenName:on.z.string().nullish(),cancelledByFamilyName:on.z.string().nullish(),cancelledDate:on.z.coerce.date(),completedBy:on.z.coerce.number(),completedByGivenName:on.z.string().nullish(),completedByFamilyName:on.z.string().nullish(),completedDate:on.z.coerce.date(),destinationUuid:on.z.string().nullish(),destinationName:on.z.string().nullish(),externalReference:on.z.string().nullish(),atLocationUuid:on.z.string().nullish(),atLocationName:on.z.string().nullish(),operationDate:on.z.coerce.date(),submitted:on.z.boolean(),submittedBy:on.z.string().nullish(),submittedByGivenName:on.z.string().nullish(),submittedByFamilyName:on.z.string().nullish(),locked:on.z.boolean(),operationNumber:on.z.string().nullish(),operationOrder:on.z.coerce.number(),remarks:on.z.string().nullish(),sourceUuid:on.z.string().nullish(),sourceName:on.z.string().nullish(),status:on.z.enum(Dt),returnReason:on.z.string().nullish(),rejectionReason:on.z.string().nullish(),operationTypeUuid:on.z.string().nullish(),operationType:on.z.string().nullish(),operationTypeName:on.z.string().nullish(),responsiblePerson:on.z.coerce.number(),responsiblePersonUuid:on.z.string().nullish(),responsiblePersonGivenName:on.z.string().nullish(),responsiblePersonFamilyName:on.z.string().nullish(),responsiblePersonOther:on.z.string().nullish(),creator:on.z.coerce.number(),dateCreated:on.z.coerce.date(),creatorGivenName:on.z.string().nullish(),creatorFamilyName:on.z.string().nullish(),permission:ln.nullish(),reasonUuid:on.z.string().nullish(),reasonName:on.z.string().nullish(),approvalRequired:on.z.boolean().nullish(),stockOperationItems:cn.array(),submittedDate:on.z.coerce.date(),returnedByGivenName:on.z.string().nullish(),returnedByFamilyName:on.z.string().nullish(),returnedDate:on.z.coerce.date(),rejectedByGivenName:on.z.string().nullish(),rejectedByFamilyName:on.z.string().nullish(),rejectedDate:on.z.coerce.date(),dispatchedByGivenName:on.z.string().nullish(),dispatchedByFamilyName:on.z.string().nullish(),dispatchedDate:on.z.coerce.date(),requisitionStockOperationUuid:on.z.string()}),on.z.object({operationDate:on.z.coerce.date(),sourceUuid:on.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:on.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:on.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:on.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:on.z.string().nullish(),remarks:on.z.string().nullish()})),un=function(e){switch(e){case Gt.OPENING_STOCK_OPERATION_TYPE:return sn.omit({destinationUuid:!0,reasonUuid:!0});case Gt.STOCK_TAKE_OPERATION_TYPE:case Gt.ADJUSTMENT_OPERATION_TYPE:case Gt.DISPOSED_OPERATION_TYPE:return sn.omit({destinationUuid:!0});case Gt.TRANSFER_OUT_OPERATION_TYPE:case Gt.STOCK_ISSUE_OPERATION_TYPE:return sn.omit({reasonUuid:!0}).merge(on.z.object({destinationUuid:on.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Gt.RETURN_OPERATION_TYPE:case Gt.REQUISITION_OPERATION_TYPE:case Gt.RECEIPT_OPERATION_TYPE:return sn.omit({reasonUuid:!0}).merge(on.z.object({sourceUuid:on.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const dn=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:e.parties,onChange:function(t){var n,r;null===(n=e.onPartyChange)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null===(n=e.parties)||void 0===n?void 0:n.find((function(t){return t.uuid===e.partyUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:i,invalid:e.invalid,invalidText:e.invalidText})}})};function mn(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 pn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mn(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)?mn(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 An(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 gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(0,i.useRef)();return(0,i.useEffect)((function(){return function(){n.current&&clearTimeout(n.current)}}),[]),function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var i=setTimeout((function(){var t;e.apply(void 0,function(e){if(Array.isArray(e))return An(e)}(t=o)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return An(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)?An(e,t):void 0}}(t)||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.")}())}),t);clearTimeout(n.current),n.current=i}}var fn=function(){return{atLocationName:"",atLocationUuid:"",cancelReason:"",cancelledBy:0,cancelledByFamilyName:"",cancelledByGivenName:"",cancelledDate:void 0,completedBy:0,completedByFamilyName:"",completedByGivenName:"",completedDate:void 0,creator:0,creatorFamilyName:"",creatorGivenName:"",dateCreated:void 0,destinationName:"",destinationUuid:"",dispatchedByFamilyName:"",dispatchedByGivenName:"",dispatchedDate:void 0,externalReference:"",locked:!1,operationDate:new Date,operationNumber:"",operationOrder:0,operationType:"",operationTypeName:"",operationTypeUuid:"",permission:void 0,reasonName:"",reasonUuid:"",rejectedByFamilyName:"",rejectedByGivenName:"",rejectedDate:void 0,rejectionReason:"",remarks:"",requisitionStockOperationUuid:"",responsiblePerson:0,responsiblePersonFamilyName:"",responsiblePersonGivenName:"",responsiblePersonOther:"",responsiblePersonUuid:"",returnReason:"",returnedByFamilyName:"",returnedByGivenName:"",returnedDate:void 0,sourceName:"",sourceUuid:"",status:void 0,stockOperationItems:[],submitted:!1,submittedBy:"",submittedByFamilyName:"",submittedByGivenName:"",submittedDate:void 0,uuid:""}},vn={uuid:"Other",display:"Other",person:{display:"Other"}};function _n(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const hn=function(e){var t=function(e){var t=pn((0,i.useState)({v:P.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=Pt(n),a=o.items.results,l=o.isLoading,c=pn((0,i.useState)(null),2),s=c[0],u=c[1],d=pn((0,i.useState)(10),2),m=d[0],p=d[1],A=pn((0,i.useState)(P.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s})}),[s,m,g]),{userList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(),n=t.isLoading,r=t.userList,o=t.setSearchString,c=gn((function(e){o(e)}),1e3);return r&&r.push(vn),l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,s=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:r||[],onChange:function(t){var n,r;null===(n=e.onUserChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:null!==(n=null==r?void 0:r.find((function(t){return t.uuid===e.userUuid})))&&void 0!==n?n:"",itemToString:_n,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};function bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yn=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.oil,(n=function(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){bn(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.id,ref:s,value:null!=c?c:e.value})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n))}})},kn=function(e){var t=Ut((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{labelText:e.title,placeholder:e.placeholder,name:e.name,controllerName:e.controllerName,id:e.name,size:"md",items:i,initialSelectedItem:(null==i?void 0:i.find((function(t){return t.uuid===e.reasonUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},onChange:function(t){var n,o;null===(n=e.onReasonChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),r(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};function Cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const En=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.Kx8,(n=function(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){Cn(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.name,ref:s,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n))}})};function wn(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}var Sn=(0,i.createContext)(null),Dn=function(){return(0,i.useContext)(Sn)},On=function(e){var t,n,r=e.children,o=(t=(0,i.useState)(null),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return wn(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)?wn(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.")}()),a={formContext:o[0],setFormContext:o[1]};return l().createElement(Sn.Provider,{value:a},r)},xn=[Gt.ADJUSTMENT_OPERATION_TYPE,Gt.RECEIPT_OPERATION_TYPE,Gt.STOCK_ISSUE_OPERATION_TYPE,Gt.STOCK_TAKE_OPERATION_TYPE,Gt.RETURN_OPERATION_TYPE,Gt.DISPOSED_OPERATION_TYPE,Gt.OPENING_STOCK_OPERATION_TYPE,Gt.TRANSFER_OUT_OPERATION_TYPE],Nn=[Gt.ADJUSTMENT_OPERATION_TYPE,Gt.DISPOSED_OPERATION_TYPE,Gt.STOCK_TAKE_OPERATION_TYPE,Gt.OPENING_STOCK_OPERATION_TYPE];function In(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 Tn(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return In(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)?In(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 Un=function(e){var t,n,r,o,c,s,u,d,m,p,A,g,f,v=e.model,_=e.onSave,h=e.operation,b=e.canEdit,y=e.isEditing,k=e.setup,C=k.requiresStockAdjustmentReason,w=k.shouldLockSource,S=k.shouldLockDestination,D=k.sourcePartyList,O=k.destinationPartyList,x=(0,E.useTranslation)().t,I=(Dn().setFormContext,bt({v:P.Full,totalCount:!0})),T=I.isLoading,B=(I.items,Zt(null==h?void 0:h.operationType)),U=(d=(u=v).sourceUuid,m=u.sourceName,p=u.destinationUuid,A=u.destinationName,g=function(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){Bn(e,t,n[t])}))}return e}({},u),f=null!=(f={sourceUuid:p,sourceName:A,destinationUuid:d,destinationName:m})?f:{},Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(f)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(f)).forEach((function(e){Object.defineProperty(g,e,Object.getOwnPropertyDescriptor(f,e))})),g),j=(0,nn.cI)({defaultValues:"stockissue"===B?U:v,mode:"all",resolver:(0,rn.F)(un(B))}),z=j.handleSubmit,F=j.control,L=j.formState.errors,R=j.setValue,M=Pn((0,i.useState)(),2),q=M[0],G=M[1],H=Pn((0,i.useState)(!1),2),Z=H[0],Y=H[1];if(T)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Q,J,W,ee,te,ne,re=function(){var e,t=(e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),Y(!0),t=function(e,t,n){var r=Object.assign(e,t);return function(e,t){["submitted","cancelledByFamilyName","atLocationName","completedByGivenName","cancelledBy","submittedByFamilyName","operationOrder","dispatchedByGivenName","submittedByGivenName","returnedByGivenName","operationNumber","responsiblePersonFamilyName","returnReason","atLocationUuid","cancelReason","rejectedByGivenName","reasonName","submittedBy","creator","completedByFamilyName","operationTypeName","rejectedByFamilyName","responsiblePerson","creatorFamilyName","returnedByFamilyName","cancelledByGivenName","operationType","responsiblePersonGivenName","sourceName","rejectionReason","completedBy","creatorGivenName","dispatchedByFamilyName","uuid"].forEach((function(t){delete e[t]}))}(r),function(e){return xn.includes(e)}(n)&&delete r.destinationName,function(e){return Nn.includes(e)}(n)&&delete r.destinationUuid,r}(v,e,B),[4,_(t)];case 1:case 2:return n.sent(),[3,4];case 3:return Y(!1),[7];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Tn(a,r,o,i,l,"next",e)}function l(e){Tn(a,r,o,i,l,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return l().createElement("div",{style:{margin:"10px"}},l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},b&&l().createElement(nn.Qr,{control:F,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:function(e){var t=Pn(e,1)[0];n(t)}},l().createElement(a.aj6,{invalid:!!L.operationDate,invalidText:null==L||null===(t=L.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:x("operationDate","Operation Date"),defaultValue:X(null==v?void 0:v.operationDate)}))},name:"operationDate"}),!b&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:X(null==v?void 0:v.operationDate),readOnly:!0,labelText:"Operation Date"})),y&&(null==v?void 0:v.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==v?void 0:v.operationNumber,readOnly:!0,labelText:"Operation Number"}),b&&!w&&(null==h?void 0:h.hasSource)&&l().createElement(dn,{controllerName:"sourceUuid",name:"sourceUuid",control:F,title:(null==h?void 0:h.hasDestination)?x("from","From"):x("location:","Location"),placeholder:h.hasDestination?x("chooseASource","Choose a source"):x("chooseALocation","Choose a location"),invalid:!!L.sourceUuid,invalidText:L.sourceUuid&&(null==L||null===(t=L.sourceUuid)||void 0===t?void 0:t.message),parties:D||[]}),(!b||y||w)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:"stockissue"===B?U.sourceName:null!==(Q=null==v?void 0:v.sourceName)&&void 0!==Q?Q:"",readOnly:!0,labelText:(null==h||h.hasDestination,"From")}),b&&!S&&(null==h?void 0:h.hasDestination)&&l().createElement(dn,{controllerName:"destinationUuid",name:"destinationUuid",control:F,title:(null==h?void 0:h.hasSource)?"To":"Location",placeholder:(null==h?void 0:h.hasSource)?x("chooseADestination","Choose a destination"):"Location",invalid:!!L.destinationUuid,invalidText:L.destinationUuid&&(null==L||null===(n=L.destinationUuid)||void 0===n?void 0:n.message),parties:O||[]}),(!b||y||S)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:"stockissue"===B?U.destinationName:null!==(J=null==v?void 0:v.destinationName)&&void 0!==J?J:"",readOnly:!0,labelText:(null==h||h.hasSource,"To")}),b&&l().createElement(hn,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:F,title:x("responsiblePerson:","Responsible Person"),placeholder:x("filter","Filter ..."),invalid:!!L.responsiblePersonUuid,invalidText:L.responsiblePersonUuid&&(null==L||null===(r=L.responsiblePersonUuid)||void 0===r?void 0:r.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===vn.uuid&&G(!0)}}),q&&l().createElement(yn,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:F,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(W=null==v?void 0:v.responsiblePersonOther)&&void 0!==W?W:""),labelText:x("responsiblePerson","Responsible Person"),placeholder:x("pleaseSpecify","Please Specify"),invalid:!!L.responsiblePersonOther,invalidText:L.responsiblePersonOther&&(null==L||null===(o=L.responsiblePersonOther)||void 0===o?void 0:o.message)}),!b&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(ee=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==vn.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==ee?ee:"",readOnly:!0,labelText:"Responsible Person"}),C&&b&&l().createElement(kn,{controllerName:"reasonUuid",name:"reasonUuid",control:F,placeholder:x("chooseAReason","Choose a reason"),title:x("reason","Reason"),invalid:!!L.reasonUuid,invalidText:L.reasonUuid&&(null==L||null===(c=L.reasonUuid)||void 0===c?void 0:c.message),onReasonChange:function(e){R("reasonUuid",e.uuid)}}),C&&!b&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(te=null==v?void 0:v.reasonName)&&void 0!==te?te:"",readOnly:!0,labelText:"Reason:"}),l().createElement(En,{id:"remarks",name:"remarks",control:F,controllerName:"remarks",maxLength:255,value:"".concat(null!==(ne=null==v?void 0:v.remarks)&&void 0!==ne?ne:""),labelText:x("remarks:","Remarks"),invalid:!!L.remarks,invalidText:L.remarks&&(null==L||null===(s=L.remarks)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:z(re),kind:"primary",renderIcon:se.ol},Z?l().createElement(a.lSo,null):x("next","Next")))))};var jn={stockItemUuid:on.z.string().min(1,{message:"Required"}),stockItemName:on.z.string().min(1).nullish(),stockItemPackagingUOMUuid:on.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:on.z.string().min(1).nullish(),batchNo:on.z.string().min(1,{message:"Required"}),stockBatchUuid:on.z.string().optional(),expiration:on.z.coerce.date({required_error:"Required"}),quantity:on.z.coerce.number().min(1,{message:"Required"}),purchasePrice:on.z.coerce.number().nullish(),hasExpiration:on.z.boolean().nullish()},zn=on.z.object(jn),Fn=(zn.omit({expiration:!0}),on.z.object({stockItems:on.z.array(zn)})),Ln=n(6781),Rn={};Rn.styleTagTransform=h(),Rn.setAttributes=g(),Rn.insert=p().bind(null,"head"),Rn.domAPI=d(),Rn.insertStyleElement=v(),s()(Ln.Z,Rn);const Mn=Ln.Z&&Ln.Z.locals?Ln.Z.locals:void 0;function qn(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 Gn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qn(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)?qn(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 Hn(e){return e.drugName||e.conceptName}const Zn=function(e){var t=function(e){var t=Gn((0,i.useState)(e||{v:P.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=me(n),a=o.items.results,l=o.isLoading,c=Gn((0,i.useState)(null),2),s=c[0],u=c[1],d=Gn((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Gn((0,i.useState)((null==e?void 0:e.v)||P.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s})}),[s,m,g]),{stockItemsList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}({}),n=t.isLoading,r=t.stockItemsList,o=t.setSearchString,c=gn((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,s=(o.value,o.ref);return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:r||[],onChange:function(t){var n,r;null===(n=e.onStockItemChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:null!==(n=null==r?void 0:r.find((function(t){return t.uuid===e.stockItemUuid})))&&void 0!==n?n:"",itemToString:Hn,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Yn=function(e){var t,n=fe(e.stockItemUuid),r=n.isLoading,o=n.isError,c=n.item,s=(0,i.useMemo)((function(){var e;return(null==c||null===(e=c.packagingUnits)||void 0===e?void 0:e.length)>0?c.packagingUnits[0]:null}),[null==c?void 0:c.packagingUnits]);return r||o?l().createElement(a.N2B,null):l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=s.uuid)&&void 0!==t?t:"",render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(n=null==c?void 0:c.packagingUnits)&&void 0!==n?n:[],onChange:function(t){var n,r;null===(n=e.onStockPackageChanged)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:s,itemToString:function(e){return e.packagingUomName?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Qn(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 Jn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qn(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)?Qn(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 Wn(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 Vn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wn(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)?Wn(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 Kn(e){var t=Vn((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||P.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=Vn((0,i.useState)(10),2),a=o[0],l=o[1],c=Vn((0,i.useState)(null),2),s=c[0],u=c[1],d=Vn((0,i.useState)(1),2),m=d[0],p=d[1],A=Vn((0,i.useState)(null==e?void 0:e.stockItemUuid),2),g=A[0],f=A[1],v=Vn((0,i.useState)(null==e?void 0:e.partyUuid),2),_=v[0],h=v[1],b=Vn((0,i.useState)(null==e?void 0:e.locationUuid),2),y=b[0],k=b[1],C=Vn((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:P.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E,includeBatchNo:!0})}),[s,m,a,g,_,y,E]);var S,D=pe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}function Xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $n=function(e){var t=function(e){var t=Jn((0,i.useState)({v:P.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=Ae(n),a=o.items.results,l=o.isLoading,c=Jn((0,i.useState)(null),2),s=c[0],u=c[1],d=Jn((0,i.useState)(10),2),m=d[0],p=d[1],A=Jn((0,i.useState)(P.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s,stockItemUuid:e})}),[s,m,g,e]),{stockItemBatchNos:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(e.stockItemUuid),n=t.isLoading,r=t.stockItemBatchNos,o=(0,i.useMemo)((function(){var t;return null!==(t=null==r?void 0:r.find((function(t){return t.uuid===e.batchUuid})))&&void 0!==t?t:""}),[r,e.batchUuid]),c=Kn(),s=c.items,u=c.setStockItemUuid;(0,i.useEffect)((function(){u(e.stockItemUuid)}),[e.stockItemUuid,u]);var d=null==r?void 0:r.map((function(e){var t,n,r,o=null==s?void 0:s.find((function(t){return t.batchNumber===e.batchNo}));return o?(n=function(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){Xn(e,t,n[t])}))}return e}({},e),r=null!=(r={quantity:null!==(t=o.quantity)&&void 0!==t?t:""})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n):e}));return n?l().createElement(a.lSo,{status:"active"}):l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,i=n.ref;return l().createElement(a.CtY,{style:{flexGrow:"1"},titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:d||[],onChange:function(t){var n,o;null===(n=e.onBatchNoChanged)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:o,itemToString:function(e){var t;return(null==e?void 0:e.batchNo)?"".concat(null==e?void 0:e.batchNo," | Qty: ").concat(null!==(t=null==e?void 0:e.quantity)&&void 0!==t?t:""):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),n&&l().createElement(a.lSo,{status:"active"}))};function er(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 tr(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return er(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)?er(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 nr=function(e){var t=e.canEdit,n=e.showQuantityRequested,o=e.requiresActualBatchInformation,c=e.requiresBatchUuid,s=e.canUpdateBatchInformation,u=e.canCapturePurchasePrice,d=e.batchBalance,m=e.control,p=e.setValue,A=e.errors,g=e.remove,f=e.fields,v=tr((0,i.useState)(),2),_=(v[0],v[1]),h=tr((0,i.useState)(),2),b=(h[0],h[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,h,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,ee,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Mn.desktopRow:Mn.tabletRow,key:null==e?void 0:e.uuid},l().createElement(a.pj1,null,t&&(null==e?void 0:e.uuid.startsWith("new-item"))&&l().createElement(Zn,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:re,control:m,invalid:!!(null==A||null===(h=A.stockItems)||void 0===h||null===(v=h[i])||void 0===v?void 0:v.stockItemUuid),onStockItemChanged:function(e){var t;!function(e,t){if(t){var n=f[e];if(n){var r,o,a,i;n.stockItemName=null!==(a=(null==t?void 0:t.drugName)?"".concat(null==t?void 0:t.drugName).concat((null!==(r=null==t?void 0:t.commonName)&&void 0!==r?r:null==t?void 0:t.conceptName)?" (".concat(null!==(o=null==t?void 0:t.commonName)&&void 0!==o?o:null==t?void 0:t.conceptName,")"):""):null)&&void 0!==a?a:null==t?void 0:t.conceptName;var l=null===(i=null==t?void 0:t.hasExpiration)||void 0===i||i;n.hasExpiration=l,l||(n.expiration=null),n.stockItemUuid=null==t?void 0:t.uuid,n.stockItemPackagingUOMUuid=null,n.stockItemPackagingUOMName=null,n.stockBatchUuid=null}}}(i,e),p("stockItems.".concat(i,".packagingUnits"),null==e?void 0:e.packagingUnits),_(null!==(t=null==e?void 0:e.uuid)&&void 0!==t?t:"")}}),(!t||!e.uuid.startsWith("new-item"))&&l().createElement(a.rUS,{target:"_blank",to:(ne=null==e?void 0:e.stockItemUuid,"".concat("/stock-items","/").concat(ne).concat(""))},"".concat(null==e?void 0:e.stockItemName))),n&&l().createElement(a.pj1,null,null!==(Y=null==e||null===(y=e.quantityRequested)||void 0===y?void 0:y.toLocaleString())&&void 0!==Y?Y:""," ",null!==(Q=null==e?void 0:e.quantityRequestedPackagingUOMName)&&void 0!==Q?Q:""),(o||c)&&l().createElement(a.pj1,null,o&&(t||s&&(null==e||null===(k=e.permission)||void 0===k?void 0:k.canUpdateBatchInformation))&&l().createElement(a.oil,{size:"sm",maxLength:50,onChange:function(e){return p("stockItems.".concat(i,".batchNo"),e.target.value)},defaultValue:e.batchNo,invalidText:"",invalid:null==A||null===(E=A.stockItems)||void 0===E||null===(C=E[i])||void 0===C?void 0:C.batchNo}),c&&!o&&t&&l().createElement($n,{batchUuid:null==e?void 0:e.stockBatchUuid,onBatchNoChanged:function(e){p("stockItems.".concat(i,".batchNo"),null==e?void 0:e.batchNo),p("stockItems.".concat(i,".expiration"),null==e?void 0:e.expiration),b(null==e?void 0:e.expiration)},placeholder:"Filter...",invalid:!!(null==A||null===(S=A.stockItems)||void 0===S||null===(w=S[i])||void 0===w?void 0:w.stockBatchUuid),control:m,controllerName:"stockItems.".concat(i,".stockBatchUuid"),name:"stockItems.".concat(i,".stockBatchUuid"),stockItemUuid:e.stockItemUuid}),!(s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:X($()),locale:"en",dateFormat:K,onChange:function(e){var t=tr(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:V,defaultValue:X(null==e?void 0:e.expiration),invalid:!!(null==A||null===(N=A.stockItems)||void 0===N||null===(x=N[i])||void 0===x?void 0:x.expiration)})),(!(s&&(null==e||null===(I=e.permission)||void 0===I?void 0:I.canUpdateBatchInformation))&&!t||c)&&X(e.expiration)),l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{className:"small-placeholder-text",size:"sm",id:"qty-".concat(null==e?void 0:e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".quantity"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(J=null==e?void 0:e.quantity)&&void 0!==J?J:"",invalidText:null==A||null===(P=A.stockItems)||void 0===P||null===(B=P[i])||void 0===B||null===(T=B.quantity)||void 0===T?void 0:T.message,placeholder:c&&!o&&(null==e?void 0:e.stockBatchUuid)in d?"Bal: ".concat(null!==(W=null===(j=d[null==e?void 0:e.stockBatchUuid])||void 0===j||null===(U=j.quantity)||void 0===U?void 0:U.toLocaleString())&&void 0!==W?W:""," ").concat(null!==(ee=null===(z=d[null==e?void 0:e.stockBatchUuid])||void 0===z?void 0:z.quantityUoM)&&void 0!==ee?ee:""):"",invalid:!!(null==A||null===(L=A.stockItems)||void 0===L||null===(F=L[i])||void 0===F?void 0:F.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Yn,{stockItemUuid:e.stockItemUuid,onStockPackageChanged:function(e){p("stockItems.".concat(i,".stockItemPackagingUOMUuid"),null==e?void 0:e.uuid)},placeholder:"Filter...",invalid:!!(null==A||null===(q=A.stockItems)||void 0===q||null===(M=q[i])||void 0===M?void 0:M.stockItemPackagingUOMUuid),control:m,controllerName:"stockItems.".concat(i,".stockItemPackagingUOMUuid"),name:"stockItems.".concat(i,".stockItemPackagingUOMUuid")}),!t&&(null==e?void 0:e.stockItemPackagingUOMName)),u&&l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{size:"sm",invalid:!!(null==A||null===(H=A.stockItems)||void 0===H||null===(G=H[i])||void 0===G?void 0:G.purchasePrice),invalidText:"",id:"purchaseprice-".concat(e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".purchasePrice"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(te=null==e?void 0:e.purchasePrice)&&void 0!==te?te:"",title:""}),!t&&(null==e||null===(Z=e.purchasePrice)||void 0===Z?void 0:Z.toLocaleString())),t&&l().createElement(a.pj1,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:ue.ZN,onClick:function(){return g(i)}})))})))};var rr=n(6360),or={};or.styleTagTransform=h(),or.setAttributes=g(),or.insert=p().bind(null,"head"),or.domAPI=d(),or.insertStyleElement=v(),s()(rr.Z,or);const ar=rr.Z&&rr.Z.locals?rr.Z.locals:void 0;function ir(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 lr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function cr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sr(e){return function(e){if(Array.isArray(e))return ir(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ur(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 ur(e,t){if(e){if("string"==typeof e)return ir(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)?ir(e,t):void 0}}const dr=function(e){var t,n,o,c,s,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,f=u.batchNos,v=u.canUpdateItemsBatchInformation,_=u.itemUoM,h=e.canEdit,b=void 0===h||h,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,D=Dn().formContext,O=function(e){if("requisition"===e){var t=zn.omit({batchNo:!0,expiration:!0});return on.z.object({stockItems:on.z.array(t)})}return Fn}(S),x=(t=function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return 0==e.stockItems.length?("No stock items","You haven't added any stock items, tap the add button to add some.",(0,r.showSnackbar)({isLowContrast:!0,title:"No stock items",kind:"error",subtitle:"You haven't added any stock items, tap the add button to add some."}),[2]):(y.stockOperationItems=null==e?void 0:e.stockItems,[4,null==k?void 0:k(y)]);case 1:return t.sent(),[2]}}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){lr(a,r,o,i,l,"next",e)}function l(e){lr(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,nn.cI)({resolver:(0,rn.F)(O),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,B=N.setValue,P=N.formState.errors,U=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||ur(c,s)||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.")}())[0],j=(0,nn.Dq)({name:"stockItems",control:T}),z=j.fields,F=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==D?void 0:D.stockItems){var e=null==D?void 0:D.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==D?void 0:D.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(sr(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),sr(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),sr(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),sr(m?[{key:"expiry",header:w("expiry","Expiry")}]:[]),[{key:"quantity",header:d?w("qtyIssued","Qty Issued"):w("qty","Qty")},{key:"quantityuom",header:w("quantityUom","Qty UoM")}],sr(A?[{key:"purchaseprice",header:w("purchasePrice","Purchase Price")}]:[])),q=function(){var e="new-item-".concat("".concat((new Date).getTime(),"-").concat(Math.random().toString(36).substring(2,16)));F({uuid:e,id:e})};return l().createElement("div",{style:{margin:"10px"}},l().createElement("div",{className:ar.tableContainer},l().createElement(a.wQF,{rows:null!==(R=null==y?void 0:y.stockOperationItems)&&void 0!==R?R:[{uuid:"new-item-1",id:"new-item-1"}],headers:M,isSortable:!1,useZebraStyles:!0,styles:{width:"100%"},render:function(e){var t,n=e.headers,o=e.getHeaderProps,i=e.getTableProps;return l().createElement(a.xJi,null,l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){var t,n,i,c;return l().createElement(a.xDH,(i=function(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){cr(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?ar.desktopHeader:ar.tabletHeader,style:null==e?void 0:e.styles,key:"".concat(e.key)})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))})),i),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:null==e?void 0:e.header)})),b&&l().createElement(a.xDH,{style:{width:"3% !important"}},l().createElement("div",{style:{width:"3% !important",display:"flex",flexDirection:"row",gap:"8px"}},l().createElement(a.zxk,{renderIcon:se.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:se.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(nr,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:f,control:T,setValue:B,errors:P,remove:L,append:F,canEdit:b,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:z})," ")))}})))};var mr=n(8808);function pr(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 Ar(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function gr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ar(a,r,o,i,l,"next",e)}function l(e){Ar(a,r,o,i,l,"throw",e)}i(void 0)}))}}function fr(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pr(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)?pr(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 vr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const _r=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=fr((0,i.useState)(!1),2),d=u[0],m=u[1],p=fr((0,i.useState)(null),2),A=p[0],g=p[1];return l().createElement("div",{style:{margin:"10px"}},t&&!n&&l().createElement("div",{style:{margin:"10px"}},l().createElement(a.SYO,{name:"rbgApprovelRequired",legendText:s("doesThisTransactionRequireApproval","Does the transaction require approval ?"),onChange:function(e){g(e)},defaultSelected:A},l().createElement(a.EUY,{value:!0,id:"rbgApprovelRequired-true",labelText:s("yes","Yes")}),l().createElement(a.EUY,{value:!1,id:"rbgApprovelRequired-false",labelText:s("no","No")}))),!t&&l().createElement(l().Fragment,null,l().createElement(a.oil,{style:{margin:"5px"},id:"rbgApproveRequiredLbl",value:A?s("yes","Yes"):s("no","No"),readOnly:!0,labelText:s("doesThisTransactionRequireApproval","Does the transaction require approval ?")})),t&&!n&&l().createElement("div",{className:"stkpg-form-buttons",style:{margin:"10px"}},null!=A&&l().createElement(l().Fragment,null,!o&&!A&&l().createElement(a.zxk,{name:"complete",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:gr((function(){return vr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onComplete(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:Ie.X4},s("complete","Complete")),o&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:gr((function(){return vr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onDispatch(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:mt.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:mr.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:gr((function(){return vr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r)];case 1:return e.sent(),m(!1),[2]}}))})),kind:"secondary",renderIcon:mr.vc},d?l().createElement(a.lSo,null):s("save","Save")),!d&&l().createElement(a.zxk,{type:"button",style:{margin:"4px"},className:"cancelButton",kind:"tertiary",onClick:c.onGoBack,renderIcon:ue.WP},s("goBack","Go Back"))))};var hr="Location",br="Other";function yr(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 kr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Cr(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,V,K;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(X){switch(X.label){case 0:return A=!!t,g=[],f=!1,[4,new Promise((function(e,t){(0,r.getCurrentUser)().subscribe({next:function(t){var n,r=null==t||null===(n=t.user)||void 0===n?void 0:n.uuid;e(r)},error:function(e){return t(e)}})}))];case 1:return v=X.sent(),_=n,b=null!==(h=null==t||null===(o=t.permission)||void 0===o?void 0:o.isRequisitionAndCanIssueStock)&&void 0!==h&&h,k=null!==(y=null==e||null===(a=e.stockOperationTypeLocationScopes)||void 0===a?void 0:a.filter((function(t){return(null==e?void 0:e.hasSource)&&t.isSource})).map((function(e){return e.locationTag})))&&void 0!==y?y:[],C=1===k.length&&k[0]===te,w=null!==(E=null==e||null===(i=e.stockOperationTypeLocationScopes)||void 0===i?void 0:i.filter((function(t){return(null==e?void 0:e.hasDestination)&&t.isDestination})).map((function(e){return e.locationTag})))&&void 0!==E?E:[],S=1===w.length&&w[0]===te,D=null,A?(p=structuredClone(fn()),p=Object.assign(p,{operationDate:$(),operationTypeName:null==e?void 0:e.name,operationTypeUuid:null==e?void 0:e.uuid,operationType:null==e?void 0:e.operationType}),[4,(re="".concat(r.restBaseUrl,"/stockmanagement/party?v=default"),(0,r.openmrsFetch)(re))]):[3,4];case 2:return P=X.sent(),[4,jt()];case 3:if(U=X.sent(),j=null===(I=U.data)||void 0===I||null===(N=I.results)||void 0===N?void 0:N.filter((function(e){return e.userUuid===v})),ne=new Set(j.flatMap((function(e){var t;return null==e||null===(t=e.locations)||void 0===t?void 0:t.map((function(e){return e.locationUuid}))}))),z=function(e){if(Array.isArray(e))return yr(e)}(ne)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(ne)||function(e,t){if(e){if("string"==typeof e)return yr(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)?yr(e,t):void 0}}(ne)||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.")}(),!P.ok)throw Error("Error loading parties");return F=null===(B=P.data)||void 0===B||null===(T=B.results)||void 0===T?void 0:T.filter((function(e){return z.includes(e.locationUuid)||null!==e.stockSourceUuid})),O=null==F?void 0:F.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===hr&&(0===k.length||t.tags&&k.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===br})),(null==e?void 0:e.hasSource)&&A&&C&&(null==O?void 0:O.length)>0&&(L=O[0],p.sourceUuid=L.uuid,p.sourceName=L.name,D=null==L?void 0:L.locationUuid),(null==e?void 0:e.hasDestination)&&(x=null==P||null===(M=P.data)||void 0===M||null===(R=M.results)||void 0===R?void 0:R.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===hr&&(0===w.length||t.tags&&w.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===br})),A&&S&&(null==x?void 0:x.length)>0&&(q=x[0],p.destinationUuid=q.uuid,p.destinationName=q.name)),[3,6];case 4:return[4,Bt()];case 5:if(!(G=X.sent()).ok)throw Error("Error loading operation types");_=G.data.results,X.label=6;case 6:return H=Zt(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(ee=H,"adjustment"===ee),requiresBatchUuid:Qt(H),requiresActualBatchInfo:Jt(H),isQuantityOptional:Wt(H),canCaptureQuantityPrice:Vt(H),requiresStockAdjustmentReason:Yt(H),requiresDispatchAcknowledgement:Kt(H),allowExpiredBatchNumbers:null!==(Z=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==Z&&Z,canEditModel:null!==(Y=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==Y&&Y,canViewModel:null!==(Q=null==t||null===(c=t.permission)||void 0===c?void 0:c.canView)&&void 0!==Q&&Q,canApproveModel:null!==(J=null==t||null===(s=t.permission)||void 0===s?void 0:s.canApprove)&&void 0!==J&&J,canIssueStock:b,canReceiveItems:null!==(W=null==t||null===(u=t.permission)||void 0===u?void 0:u.canReceiveItems)&&void 0!==W&&W,canDisplayReceivedItems:null!==(V=null==t||null===(d=t.permission)||void 0===d?void 0:d.canDisplayReceivedItems)&&void 0!==V&&V,canUpdateItemsBatchInformation:null!==(K=null==t||null===(m=t.permission)||void 0===m?void 0:m.canUpdateBatchInformation)&&void 0!==K&&K,canPrint:b||Xt(H),sourceTags:k,destinationTags:w,shouldLockDestination:S,shouldLockSource:C,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===hr&&(0===k.length||t.tags&&k.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===br},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===hr&&(0===w.length||t.tags&&w.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===br},location:D,sourcePartyList:O,destinationPartyList:x,stockOperationTypes:_,hasQtyRequested:f}]}var ee,ne,re}))},Cr=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){kr(a,r,o,i,l,"next",e)}function l(e){kr(a,r,o,i,l,"throw",e)}i(void 0)}))},Cr.apply(this,arguments)}function Er(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 wr(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Er(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)?Er(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.")}()}var Sr=n(3133);function Dr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Or=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(Sr.Wz,function(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){Dr(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function xr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Reject",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"",renderIcon:function(e){return l().createElement(C.wA,function(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){xr(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Ir(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Return",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(Fe.eL,function(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){Ir(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};function Br(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Pr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Cancel",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"danger--ghost",renderIcon:function(e){return l().createElement(At.jj,function(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){Br(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function Ur(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var jr,zr,Fr=(jr=function(e,t,n,r,o){var a,i,l,c,s,u,d,m,p,A,g;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(f){return a={},Gt.REQUISITION_OPERATION_TYPE!==e.operationType&&(a.authorizedBy=(null==e?void 0:e.dispatchedDate)?"".concat(null!==(i=e.dispatchedByFamilyName)&&void 0!==i?i:""," ").concat(null!==(l=e.dispatchedByGivenName)&&void 0!==l?l:""):(null==e?void 0:e.completedDate)?"".concat(null!==(c=e.completedByFamilyName)&&void 0!==c?c:""," ").concat(null!==(s=e.completedByGivenName)&&void 0!==s?s:""):""),a.remarks=e.remarks,a.operationNumber=e.operationNumber,a.operationDate=null!==(u=null==n?void 0:n.operationDate)&&void 0!==u?u:null==e?void 0:e.operationDate,a.location=null!==(d=null==n?void 0:n.atLocationName)&&void 0!==d?d:null==e?void 0:e.atLocationName,a.source=null==e?void 0:e.sourceName,a.destination=null==e?void 0:e.destinationName,a.responsiblePerson=a.orderedBy=(null==n?void 0:n.responsiblePersonFamilyName)?"".concat(null!==(m=n.responsiblePersonFamilyName)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""):"".concat(null!==(A=e.responsiblePersonFamilyName)&&void 0!==A?A:""," ").concat(null!==(g=e.responsiblePersonGivenName)&&void 0!==g?g:""),a.organizationName="Health Center",a.documentTitle="".concat(e.operationTypeName," ").concat(e.operationNumber).concat(n?" of ".concat(n.operationTypeName," ").concat(n.operationNumber):""),a.items=t.map((function(t){var a={};if(a.itemCode=null==t?void 0:t.acronym,a.itemDescription=null==t?void 0:t.stockItemName,a.purchasePrice=null==t?void 0:t.purchasePrice,a.batchNumber=null==t?void 0:t.batchNo,a.expiryDate=null==t?void 0:t.expiration,n?(a.quantityRequired=null==t?void 0:t.quantityRequested,a.quantityRequiredUoM=null==t?void 0:t.quantityRequestedPackagingUOMName,a.quantityIssued=null==t?void 0:t.quantity,a.quantityIssuedUoM=null==t?void 0:t.stockItemPackagingUOMName):Gt.STOCK_ISSUE_OPERATION_TYPE===e.operationType?(a.quantityIssued=null==t?void 0:t.quantity,a.quantityIssuedUoM=null==t?void 0:t.stockItemPackagingUOMName):(a.quantityRequired=null==t?void 0:t.quantity,a.quantityRequiredUoM=null==t?void 0:t.stockItemPackagingUOMName),r){var i=r.find((function(e){return e.uuid===t.uuid}));i&&(a.unitCost=i.unitCost,a.unitCostUoM=i.unitCostUOMName,a.totalCost=i.totalCost)}if(o){var l=o.find((function(e){return e.stockItemUuid===t.stockItemUuid}));l&&(a.balanceOnHand=l.quantity,a.balanceOnHandUoM=l.quantityUoM)}return a})),[2,a]}))},zr=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=jr.apply(e,t);function a(e){Ur(o,n,r,a,i,"next",e)}function i(e){Ur(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return zr.apply(this,arguments)});function Lr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var Rr=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Lr(a,r,o,i,l,"next",e)}function l(e){Lr(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,t,n;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(o){switch(o.label){case 0:return[4,(0,r.getConfig)("@openmrs/esm-stock-management-app")];case 1:return t=o.sent(),n=null==t||null===(e=t.logo)||void 0===e?void 0:e.src,[2,new Promise((function(e,t){var r;if(n){var o=document.getElementById("hdnTxtPrintLogo");if(o&&(null===(r=o.value)||void 0===r?void 0:r.length)>0){var a=o.getAttribute("isSvg");e({image:o.value,isSvg:"1"===a})}else if(n.toLowerCase().endsWith(".svg"))fetch(n,{headers:{"Disable-WWW-Authenticate":"true"}}).then((function(e){if(!e.ok)throw new Error("Print logo fetch network response was not OK");return e.text()})).then((function(t){o&&(o.value=t,o.setAttribute("isSvg","1")),e({image:t,isSvg:!0})})).catch((function(e){console.error("Error fetching print logo: ",e),t("Error fetching print logo")}));else{var i=new Image;i.addEventListener("load",(function(){try{var n=document.createElement("canvas");n.width=i.width,n.height=i.height;var r=n.getContext("2d");if(r){r.drawImage(i,0,0);var a=n.toDataURL("image/png");o&&(o.value=a,o.setAttribute("isSvg","0")),e({image:a,isSvg:!1})}else t("Failed to allocate canvas context for print logo")}catch(e){t(e)}})),i.addEventListener("error",(function(e){t(e)})),i.src=n}}else e(null)}))]}}))}));return function(){return e.apply(this,arguments)}}();function Mr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function qr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Mr(a,r,o,i,l,"next",e)}function l(e){Mr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Gr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Hr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return'<html>\n<head>\n<meta http-equiv=Content-Type content="text/html; charset=utf8">\n<title>'.concat(null!=t?t:"","</title>\n<style>\n").concat('\n/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the main element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on h1 elements within section and\n * article contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent sub and sup elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type="button"],\n[type="reset"],\n[type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type="button"]::-moz-focus-inner,\n[type="reset"]::-moz-focus-inner,\n[type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type="button"]:-moz-focusring,\n[type="reset"]:-moz-focusring,\n[type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from fieldset elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * fieldset elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type="checkbox"],\n[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type="number"]::-webkit-inner-spin-button,\n[type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to inherit in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n/*!\n * Gutenberg\n *\n * MIT Fabien Sa\n * https://github.com/BafS/Gutenberg\n */\n\n* {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n *,\n *:before,\n *:after,\n p:first-letter,\n div:first-letter,\n blockquote:first-letter,\n li:first-letter,\n p:first-line,\n div:first-line,\n blockquote:first-line,\n li:first-line {\n background: transparent !important;\n box-shadow: none !important;\n text-shadow: none !important;\n }\n \n html {\n font-size: 16px;\n margin: 0;\n padding: 0;\n }\n \n body {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n background: #fff !important;\n color: #000 !important;\n font-family: Arial, sans-serif, "Helvetica Neue", Helvetica;\n font-size: 1rem;\n line-height: 1.5;\n margin: 0 auto;\n text-rendering: optimizeLegibility;\n }\n \n p,\n blockquote,\n table,\n ul,\n ol,\n dl {\n margin-bottom: 1.5rem;\n margin-top: 0;\n }\n \n p:last-child,\n ul:last-child,\n ol:last-child {\n margin-bottom: 0;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: #000;\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n line-height: 1.2;\n margin-bottom: 0.75rem;\n margin-top: 0;\n }\n \n h1 {\n font-size: 2.5rem;\n }\n \n h2 {\n font-size: 2rem;\n }\n \n h3 {\n font-size: 1.75rem;\n }\n \n h4 {\n font-size: 1.5rem;\n }\n \n h5 {\n font-size: 1.25rem;\n }\n \n h6 {\n font-size: 1rem;\n }\n \n a,\n a:visited {\n color: #000;\n text-decoration: underline;\n word-wrap: break-word;\n }\n \n table {\n border-collapse: collapse;\n }\n \n thead {\n display: table-header-group;\n }\n \n table,\n th,\n td {\n border-bottom: 1px solid #000;\n }\n \n td,\n th {\n padding: 0px;\n page-break-inside: avoid;\n }\n \n code,\n pre,\n kbd {\n border: 1px solid #bbb;\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n font-size: 85%;\n }\n \n code,\n kbd {\n padding: 3px;\n }\n \n pre {\n margin-bottom: 1.5rem;\n padding: 10px 12px;\n }\n \n pre code,\n pre kbd {\n border: 0;\n }\n \n ::-webkit-input-placeholder {\n color: transparent;\n }\n \n :-moz-placeholder {\n color: transparent;\n }\n \n ::-moz-placeholder {\n color: transparent;\n }\n \n :-ms-input-placeholder {\n color: transparent;\n }\n \n blockquote {\n border: 0;\n border-left: 5px solid #bbb;\n margin-left: 1px;\n padding: 12px 1.5rem;\n }\n \n [dir=\'rtl\'] blockquote {\n border-left: 0;\n border-right: 5px solid #bbb;\n margin-left: 0;\n margin-right: 1px;\n }\n \n blockquote:first-child {\n margin-top: 0;\n }\n \n blockquote p:last-child,\n blockquote ul:last-child,\n blockquote ol:last-child {\n margin-bottom: 0;\n }\n \n blockquote footer {\n display: block;\n font-size: 80%;\n }\n \n img {\n border: 0;\n display: block;\n max-width: 100% !important;\n vertical-align: middle;\n }\n \n hr {\n border: 0;\n border-bottom: 2px solid #bbb;\n height: 0;\n margin: 2.25rem 0;\n padding: 0;\n }\n \n dt {\n font-weight: bold;\n }\n \n dd {\n margin: 0;\n margin-bottom: 0.75rem;\n }\n \n abbr[title],\n acronym[title] {\n border: 0;\n text-decoration: none;\n }\n \n table,\n blockquote,\n pre,\n code,\n figure,\n li,\n hr,\n ul,\n ol,\n a,\n tr {\n page-break-inside: avoid;\n }\n \n h2,\n h3,\n h4,\n p,\n a {\n orphans: 3;\n widows: 3;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n page-break-after: avoid;\n page-break-inside: avoid;\n }\n \n h1+p,\n h2+p,\n h3+p {\n page-break-before: avoid;\n }\n \n img {\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: avoid;\n }\n \n pre {\n white-space: pre-wrap !important;\n word-wrap: break-word;\n }\n \n body {\n padding-bottom: 1cm;\n padding-left: 1cm;\n padding-right: 1cm;\n padding-top: 0.5cm;\n }\n \n a[href^=\'http\']:after,\n a[href^=\'ftp\']:after {\n content: " (" attr(href) ")";\n font-size: 80%;\n }\n \n a[href$=\'.jpg\']:after,\n a[href$=\'.jpeg\']:after,\n a[href$=\'.gif\']:after,\n a[href$=\'.png\']:after {\n display: none;\n }\n \n abbr[title]:after,\n acronym[title]:after {\n content: " (" attr(title) ")";\n }\n \n .page-break,\n .break-before,\n .page-break-before {\n page-break-before: always;\n }\n \n .break-after,\n .page-break-after {\n page-break-after: always;\n }\n \n .avoid-break-inside {\n page-break-inside: avoid;\n }\n \n .no-print {\n display: none;\n }\n \n a.no-reformat:after {\n content: \'\';\n }\n \n abbr[title].no-reformat:after,\n acronym[title].no-reformat:after {\n content: \'\';\n }\n \n .no-reformat abbr:after,\n .no-reformat acronym:after,\n .no-reformat a:after {\n content: \'\';\n }\n /*Custom CSS*/\n .right {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n margin-right: 0;\n } \n .text {\n margin-top:0in;\n margin-right:0in;\n margin-bottom:3.0pt;\n margin-left:0in;\n line-height:106%;\n font-size:12.5pt;\n } \n .logo-row {\n width: 99%;\n }\n .logo {\n width: 120; \n line-height:110%;\n text-align: center;\n margin-top: 4pt;\n }\n .logo img, .logo svg {\n width: 52;\n height: auto;\n }\n span.logo-text {\n font-size:8.0pt;\n display: block;\n white-space:nowrap;\n line-height: 110%;\n margin-top: 4pt;\n } \n .heading, .heading-row {\n margin-left:12.75pt;\n clear: both;\n }\n .heading {\n font-size:14.5pt;\n line-height:102%;\n }\n .heading-row, .heading-row table { \n font-size: 13.5pt;\n }\n .heading-row {\n margin-top: 14pt;\n }\n .heading table, .heading-row table, .heading-row td {\n border: 0;\n }\n .table-data {\n border: 0;\n border-collapse:collapse;\n margin-left:6.95pt;\n font-size:12.5pt;\n width: 99%;\n page-break-inside: auto;\n }\n .table-data td, .table-data th {\n padding:0 5.75pt 0 5.15pt;\n }\n .table-data td, .table-data th {\n border-top:none;\n border-left:none;\n border-right:solid black 1.0pt;\n vertical-align: middle;\n height: 30pt;\n }\n .table-data th {\n border-bottom:double black 1.5pt;\n } \n .table-data td {\n border-bottom:solid black 1.0pt;\n }\n .table-data th:first-child, .table-data td:first-child {\n border-left:solid black 1.0pt;\n } \n .center {\n text-align: center;\n } \n .left {\n text-align: left;\n }\n .table-data tr.footer-field td {\n height:32pt;\n vertical-align: middle;\n }\n @page { size: auto; margin: 0mm; }\n','\n</style>\n</head>\n<body onload="').concat(n?"window.print()":"","\" style='word-wrap:break-word' ").concat(r?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Zr=function(){var e=qr((function(){var e,t,n,o,a;return Gr(this,(function(i){switch(i.label){case 0:return[4,(0,r.getConfig)("@openmrs/esm-stock-management-app")];case 1:t=i.sent(),n=null==t||null===(e=t.logo)||void 0===e?void 0:e.name,o=null,i.label=2;case 2:return i.trys.push([2,4,,5]),[4,Rr()];case 3:return o=i.sent(),[3,5];case 4:return a=i.sent(),console.info(a),[3,5];case 5:return[2,o||n?'\n<div class="logo" >\n '.concat(o?o.isSvg?o.image:"<img alt='' src='".concat(o.image,"' />"):"","\n ").concat(n?"<span class='logo-text text'>".concat(n,"</span>"):"","\n</div> \n "):""]}}))}));return function(){return e.apply(this,arguments)}}(),Yr=function(){var e=qr((function(){var e;return Gr(this,(function(t){switch(t.label){case 0:return[4,Zr()];case 1:return e=t.sent(),[2,'\n<div class="logo-row right">\n'.concat(e,"\n</div> \n ")]}}))}));return function(){return e.apply(this,arguments)}}(),Qr=function(e){setTimeout((function(){!function(e){var t=window.open("","Print-Window");t&&(t.document.open(),t.document.write(e),t.document.close())}(e)}),300)};function Jr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Wr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Jr(a,r,o,i,l,"next",e)}function l(e){Jr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Vr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Kr=function(){var e=Wr((function(e){var t,n,r,o,a,i,l,c,s;return Vr(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Yr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Goods Received Note</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Delivered To: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>GRN#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Received From: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.source)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(W(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th> \n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Purchase Price</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i,l,c;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(r=e.itemCode)&&void 0!==r?r:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(null!==(a=e.batchNumber)&&void 0!==a?a:"",'</td> \n <td valign="middle" class="center">').concat(W(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(i=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==i?i:""," ").concat(null!==(l=e.quantityRequiredUoM)&&void 0!==l?l:"",'</td>\n <td valign="middle" class="center">').concat(null!==(c=null===(n=e.purchasePrice)||void 0===n?void 0:n.toLocaleString())&&void 0!==c?c:"","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",' \n <tr class="footer-field">\n <td valign="middle" colspan="6" style="border:0;padding-top: 15pt;">\n Remarks:<br/>\n ').concat(null!==(c=null==e?void 0:e.remarks)&&void 0!==c?c:"",'\n </td> \n </tr> \n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Received By:<br/>\n <b>').concat(null!==(s=null==e?void 0:e.responsiblePerson)&&void 0!==s?s:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Checked By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),Xr=function(){var e=Wr((function(e){var t;return Vr(this,(function(n){switch(n.label){case 0:return[4,Kr(e)];case 1:return t=n.sent(),Qr(Hr(t,null==e?void 0:e.documentTitle,!0,re)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function $r(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function eo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){$r(a,r,o,i,l,"next",e)}function l(e){$r(a,r,o,i,l,"throw",e)}i(void 0)}))}}function to(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var no=function(){var e=eo((function(e){var t,n,r,o,a,i,l,c,s;return to(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Yr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Inventory Transfer</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer From: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>Transfer#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer To: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.destination)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(W(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Unit Cost</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(n=e.itemCode)&&void 0!==n?n:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</td> \n <td valign="middle" class="center">').concat(null!==(o=e.batchNumber)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(W(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",' \n <tr class="footer-field">\n <td valign="middle" colspan="7" style="border:0;padding-top: 15pt;">\n Remarks:<br/>\n ').concat(null!==(c=null==e?void 0:e.remarks)&&void 0!==c?c:"",'\n </td> \n </tr> \n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;padding-top: 15pt;">\n Prepared By:<br/>\n <b>').concat(null!==(s=null==e?void 0:e.responsiblePerson)&&void 0!==s?s:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Authorized By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),ro=function(){var e=eo((function(e){var t;return to(this,(function(n){switch(n.label){case 0:return[4,no(e)];case 1:return t=n.sent(),Qr(Hr(t,null==e?void 0:e.documentTitle,!0,re)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function oo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ao(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){oo(a,r,o,i,l,"next",e)}function l(e){oo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function io(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var lo=function(){var e=ao((function(e){var t,n,r,o,a,i,l,c;return io(this,(function(s){switch(s.label){case 0:return r=Math.max(0,28-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Yr()];case 1:return o=s.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text">\n <b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Dept/section/ward/dispensary: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(W(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td colspan="4" valign="top" style=\'border:solid black 1.0pt;height:40pt\'>\n <div class=\'text\'><b>Ordered by (Name and signature):</b></div>\n <p class=\'text\' style=\'margin-top: 1pt;\'>').concat(null!==(l=e.orderedBy)&&void 0!==l?l:" ","</p>\n </td>\n <td colspan=\"4\" valign=\"top\" style='border:solid black 1.0pt;border-left:none;height:40pt'>\n <div class='text'><b>Authorized by (Name and Signature):</b></div>\n <p class='text' style='margin-top: 1pt;'>").concat(null!==(c=e.authorizedBy)&&void 0!==c?c:" ",'</p>\n </td>\n </tr> \n <tr>\n <th valign="middle" class="left"><b>Item Code No.</b></th>\n <th valign="middle" class="left"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle"><b>Balance on Hand</b></th>\n <th valign="middle"><b>Quantity Required</b></th>\n <th valign="middle"><b>Quantity Issued</b></th>\n <th valign="middle"><b>Unit Cost</b></th>\n <th valign="middle"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i,l,c;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(r=e.itemCode)&&void 0!==r?r:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat(null!==(l=null===(n=e.quantityIssued)||void 0===n?void 0:n.toLocaleString())&&void 0!==l?l:""," ").concat(null!==(c=e.quantityIssuedUoM)&&void 0!==c?c:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",'\n <tr class="footer-field">\n <td valign="middle" colspan="3">Issue date:</td>\n <td valign="middle" colspan="4">Receipt date:</td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3">Name & Signature receiver:</td>\n <td valign="middle" colspan="4">Name & Signature issuer:</td>\n </tr>\n </table>\n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),co=function(){var e=ao((function(e){var t;return io(this,(function(n){switch(n.label){case 0:return[4,lo(e)];case 1:return t=n.sent(),Qr(Hr(t,null==e?void 0:e.documentTitle,!0,re)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function so(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function uo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const mo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){so(a,r,o,i,l,"next",e)}function l(e){so(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,o,a,i,l,c,s;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),n=null,o=null,t.requisitionStockOperationUuid&&(F(t.requisitionStockOperationUuid).then((function(t){t.error||(e=t)})).catch((function(e){e.error})),!e)?[2,null]:((e||"stockissue"===(null==e?void 0:e.operationType)||"transferout"===(null==e?void 0:e.operationType))&&(a={},(null==t?void 0:t.uuid)&&(a.stockOperationUuid=t.uuid),(d=a,m="".concat(r.restBaseUrl,"/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=").concat(d),p=new AbortController,(0,r.openmrsFetch)(m,{method:"GET",headers:{"Content-Type":"application/json"},signal:p.signal})).then((function(e){e.error||(n=null==e?void 0:e.results)})).catch((function(e){e.error}))),(e||"requisition"===(null==e?void 0:e.operationType))&&(i={},null==t||t.uuid,i.locationUuid=t.atLocationUuid,i.stockOperationUuid=t.uuid,i.v=P.Default,i.groupBy="LocationStockItem",i.includeStockItemName="true",i.date=JSON.stringify(null!==(l=null==e?void 0:e.dateCreated)&&void 0!==l?l:null==t?void 0:t.dateCreated),function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(j(e)),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(o=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,Fr(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,Xr(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,ro(c)];case 4:return u.sent(),[3,7];case 5:return[4,co(c)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(c),u.label=9;case 9:return[3,11];case 10:return s=u.sent(),console.info(s),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}();return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(C.FB,function(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){uo(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print"))};function po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ao=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(mt.bS,function(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){po(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function go(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const fo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(se.aP,function(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){go(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function vo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _o(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){vo(e,t,n[t])}))}return e}const ho=function(e){var t,n,r,o,i=e.operation,c=e.operations,s=(0,E.useTranslation)().t,u={uuid:"",name:"Stock Issue",description:"",operationType:"stockissue",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1},d=(n=(t=i).uuid,r=_o({},t),o=null!=(o={requisitionStockOperationUuid:n})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r);return l().createElement(a.zxk,{onClick:function(){jo(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(mt.ei,_o({size:16},e))}},s("issueStock","Issue Stock "))};var bo=n(2496),yo={};yo.styleTagTransform=h(),yo.setAttributes=g(),yo.insert=p().bind(null,"head"),yo.domAPI=d(),yo.insertStyleElement=v(),s()(bo.Z,yo);const ko=bo.Z&&bo.Z.locals?bo.Z.locals:void 0;function Co(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 Eo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function wo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Eo(a,r,o,i,l,"next",e)}function l(e){Eo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function So(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Do(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){So(e,t,n[t])}))}return e}function Oo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function xo(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Co(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)?Co(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 No(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const Io=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,q,G,H,Z,Q,J,W,V,K,X,$,ee,te,ne,re,oe,ae,ie,le,ce,se,ue,de,me,pe,Ae,ge,fe,ve,_e,he,be,ye,ke,Ce,Ee,we,Se,De,Oe=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=wr((0,i.useState)(!0),2),n=t[0],r=t[1],o=wr((0,i.useState)(!1),2),a=o[0],l=o[1],c=wr((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return Cr.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),r(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:s}}(e),Be=Te.isLoading,Pe=Te.isError,Ue=Te.result,je=xo((0,i.useState)(null==e?void 0:e.isEditing),2),ze=je[0],Fe=je[1],Le=xo((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=xo((0,i.useState)(0),2),Ge=qe[0],He=qe[1];if(Be)return l().createElement(a.MHR,null);if(Pe)return Y(),void(0,r.showSnackbar)({kind:"error",title:Oe("error","Error"),subtitle:Oe("errorLoadingStockOperation","Error loading stock item"),timeoutInMs:5e3,isLowContrast:!0});var Ze=[{name:"".concat(xe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(Un,Oo(Do({},e),{isEditing:"Stock Issue"===(null==e||null===(o=e.operation)||void 0===o?void 0:o.name)?!xe:xe,setup:Ue,canEdit:"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?!Ne:Ne,model:xe||"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,onSave:wo((function(){return No(this,(function(e){return Fe(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(dr,Oo(Do({},e),{isEditing:xe,setup:Ue,canEdit:Ne,model:xe||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,onSave:wo((function(){return No(this,(function(e){return Me(!0),He(2),[2]}))}))})),disabled:!(xe||ze)},{name:(null==Ue?void 0:Ue.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(_r,Oo(Do({},e),{isEditing:xe,setup:Ue,canEdit:Ne,locked:!1,model:xe||"Stock Issue"===(null==e||null===(d=e.operation)||void 0===d?void 0:d.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,requiresDispatchAcknowledgement:xe?"return"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType)||"issuestock"===(null==e||null===(p=e.model)||void 0===p?void 0:p.operationType):Ue.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=wo((function(t){return No(this,(function(n){switch(n.label){case 0:return[4,Uo(t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){He(1)},onComplete:wo((function(){return No(this,(function(t){switch(t.label){case 0:return[4,zo("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:wo((function(){return No(this,(function(t){switch(t.label){case 0:return[4,zo("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:wo((function(){return No(this,(function(t){switch(t.label){case 0:return[4,zo("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||Re)}];return l().createElement(l().Fragment,null,xe||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},xe&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:ko.textHeading},Oe("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(M(null==e||null===(A=e.model)||void 0===A?void 0:A.status))}},null==e||null===(g=e.model)||void 0===g?void 0:g.status)),l().createElement("div",{className:ko.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(v=e.model)||void 0===v?void 0:v.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(_=e.model)||void 0===_?void 0:_.creatorFamilyName," ",null==e||null===(h=e.model)||void 0===h?void 0:h.creatorGivenName))),(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(y=e.model)||void 0===y?void 0:y.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByFamilyName," ",null==e||null===(C=e.model)||void 0===C?void 0:C.submittedByGivenName))),(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByFamilyName," ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(N=e.model)||void 0===N?void 0:N.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(I=e.model)||void 0===I?void 0:I.returnedByFamilyName," ",null==e||null===(T=e.model)||void 0===T?void 0:T.returnedByGivenName),l().createElement("span",{className:ko.text},null==e||null===(B=e.model)||void 0===B?void 0:B.returnReason))),(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(U=e.model)||void 0===U?void 0:U.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(j=e.model)||void 0===j?void 0:j.completedByFamilyName," ",null==e||null===(z=e.model)||void 0===z?void 0:z.completedByGivenName))),"CANCELLED"===(null==e||null===(F=e.model)||void 0===F?void 0:F.status)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(L=e.model)||void 0===L?void 0:L.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByFamilyName," ",null==e||null===(q=e.model)||void 0===q?void 0:q.cancelledByGivenName,l().createElement("span",{className:ko.text},null==e||null===(G=e.model)||void 0===G?void 0:G.cancelReason)))),"REJECTED"===(null==e||null===(H=e.model)||void 0===H?void 0:H.status)&&l().createElement("div",null,l().createElement("span",{className:ko.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:ko.statusDescriptions},l().createElement("span",{className:ko.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ko.text},"By"),l().createElement("span",{className:ko.text},null==e||null===(Q=e.model)||void 0===Q?void 0:Q.rejectedByFamilyName," ",null==e||null===(J=e.model)||void 0===J?void 0:J.rejectedByGivenName,l().createElement("span",null,null==e||null===(W=e.model)||void 0===W?void 0:W.rejectionReason)))))),(!(null==e||null===(K=e.model)||void 0===K||null===(V=K.permission)||void 0===V?void 0:V.canEdit)&&((null==e||null===($=e.model)||void 0===$||null===(X=$.permission)||void 0===X?void 0:X.canApprove)||(null==e||null===(te=e.model)||void 0===te||null===(ee=te.permission)||void 0===ee?void 0:ee.canReceiveItems))||(null==e||null===(re=e.model)||void 0===re||null===(ne=re.permission)||void 0===ne?void 0:ne.canEdit)||Ie||(null==e||null===(ae=e.model)||void 0===ae||null===(oe=ae.permission)||void 0===oe?void 0:oe.isRequisitionAndCanIssueStock))&&l().createElement("div",{style:{margin:"10px",display:"flex",flexDirection:"row"}},l().createElement(l().Fragment,null,!(null==e||null===(le=e.model)||void 0===le||null===(ie=le.permission)||void 0===ie?void 0:ie.canEdit)&&(null==e||null===(se=e.model)||void 0===se||null===(ce=se.permission)||void 0===ce?void 0:ce.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Gt.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Gt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Or,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Gt.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Gt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Ao,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Nr,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Tr,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Pr,{operation:null==e?void 0:e.model}))),!(null==e||null===(ge=e.model)||void 0===ge||null===(Ae=ge.permission)||void 0===Ae?void 0:Ae.canEdit)&&(null==e||null===(ve=e.model)||void 0===ve||null===(fe=ve.permission)||void 0===fe?void 0:fe.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(fo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Tr,{operation:null==e?void 0:e.model}))),(null==e||null===(he=e.model)||void 0===he||null===(_e=he.permission)||void 0===_e?void 0:_e.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Pr,{operation:null==e?void 0:e.model})),(null==e||null===(ye=e.model)||void 0===ye||null===(be=ye.permission)||void 0===be?void 0:be.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ho,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(Ce=e.model)||void 0===Ce||null===(ke=Ce.permission)||void 0===ke?void 0:ke.isRequisitionAndCanIssueStock)||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Gt.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Gt.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Gt.RECEIPT_OPERATION_TYPE||(null==e||null===(De=e.model)||void 0===De?void 0:De.operationType)===Gt.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(mo,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(On,null,l().createElement(qt,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function To(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Bo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){To(a,r,o,i,l,"next",e)}function l(e){To(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Po(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Uo=function(){var e=Bo((function(e,t,n,o,a){var i,l,c,s;return Po(this,(function(o){switch(o.label){case 0:i=e,o.label=1;case 1:return o.trys.push([1,3,,4]),"requisition"===n.operationType&&delete i.destinationName,n.operationType===Gt.STOCK_ISSUE_OPERATION_TYPE&&(delete i.completedDate,delete i.completedBy,delete i.completedByFamilyName,delete i.completedByGivenName,delete i.operationTypeUuid,delete i.permission,delete i.locked,i.operationTypeUuid="66666666-6666-6666-6666-666666666666"),[4,(t?R:L)(i)];case 2:return(null==(l=o.sent())?void 0:l.data)&&(ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation")),(0,r.showSnackbar)({isLowContrast:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",subtitle:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Y()),[3,4];case 3:return c=o.sent(),s=oe(c),(0,r.showSnackbar)({subtitle:s.join(", "),title:"Error on saving form",kind:"error",isLowContrast:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),jo=function(e,t,n,r,o){Z("".concat(t?"Edit":"New: "," ").concat(t?null==e?void 0:e.operationTypeName:null==n?void 0:n.name),l().createElement(Io,{model:e,onSave:function(e){return Uo(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},zo=function(){var e=Bo((function(e,t,n){var o;return Po(this,(function(a){return o=(0,r.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return o()}}),[2]}))}));return function(t,n,r){return e.apply(this,arguments)}}();function Fo(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 Lo=function(e){var t,n,r=e.operationUuid,o=e.operationNumber,c=e.model,s=e.operations,u=(t=(0,i.useState)(null),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Fo(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)?Fo(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.")}()),d=u[0],m=u[1];r&&!d&&F(r).then((function(e){return m(e.data)})).catch((function(e){return console.error("Error fetching stock operation:",e)}));var p={uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1};return l().createElement(l().Fragment,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"View",kind:"ghost",onClick:function(){jo(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Ro(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 Mo(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||qo(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 qo(e,t){if(e){if("string"==typeof e)return Ro(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)?Ro(e,t):void 0}}const Go=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Ut(t),c=o.items,s=o.isLoading,u=Mo((0,i.useState)(!1),2),d=u[0],m=u[1],p=Mo((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case ee.STATUS:g(Dt.map((function(e){return{uuid:e,display:e}})));break;case ee.SOURCES:var e;(null==c||null===(e=c.answers)||void 0===e?void 0:e.length)&&(g(function(e){if(Array.isArray(e))return Ro(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||qo(t)||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.")}()),m(s));break;case ee.OPERATION:Bt().then((function(e){var t;m(!0),(null===(t=e.data)||void 0===t?void 0:t.results.length)&&g(e.data.results.map((function(e){return{uuid:e.uuid,display:e.name}}))),m(!1)}))}var t;m(!1)}),[r,s,c.answers]),d?l().createElement(a.iTo,null):l().createElement(a.NUq,{className:Ct.filtersAlign,id:"multiSelect",label:r,size:"md",labelInline:!0,items:A,itemToString:function(e){return e?e.display:"Not Set"},onChange:function(e){var t=e.selectedItems;t&&n(t.map((function(e){return e.display})),r)},placeholder:"Filter by ".concat(r),style:{minWidth:"auto",width:"auto"}})};function Ho(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 Zo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yo(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){Zo(e,t,n[t])}))}return e}function Qo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Jo(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ho(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)?Ho(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 Wo=function(){var e,t=(0,E.useTranslation)().t,n=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))},o=(0,i.useMemo)((function(){return{uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1}}),[]),c=bt({v:P.Full,totalCount:!0}),s=c.items,u=c.tableHeaders,d=c.currentPage,m=c.pageSizes,p=c.totalItems,A=c.goTo,g=c.currentPageSize,f=c.setPageSize,v=c.isLoading,_=Jo((0,i.useState)(s),2),h=_[0],b=_[1],y=Jo((0,i.useState)(null),2),k=y[0],C=y[1],w=Jo((0,i.useState)(null),2),S=w[0],D=w[1],O=Jo((0,i.useState)([]),2),x=O[0],N=O[1],I=Jo((0,i.useState)([]),2),T=I[0],B=I[1],U=Jo((0,i.useState)([]),2),j=U[0],z=U[1],F=(0,r.useConfig)(),L=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}});ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))};(0,i.useEffect)((function(){M()}),[k,S,x,T,j,d,g,s]);var R=(0,i.useCallback)((function(e,t){t===ee.SOURCES?N(e):t===ee.OPERATION?z(e):B(e)}),[]),M=function(){var e=s;x.length>0&&(e=e.filter((function(e){return x.includes(e.sourceName)}))),j.length>0&&(e=e.filter((function(e){return j.includes(e.operationTypeName)}))),T.length>0&&(e=e.filter((function(e){return T.includes(e.status)}))),k&&S?e=e.filter((function(e){var t=new Date(e.operationDate);return t>=k&&t<=S})):k?e=e.filter((function(e){return new Date(e.operationDate)>=k})):S&&(e=e.filter((function(e){return new Date(e.operationDate)<=S}))),b(e)},q=(0,i.useMemo)((function(){return null==h?void 0:h.map((function(n,r){var i,c,s,u,d,m,p,A,g,f,v,_,b,y,k,C,E,w,S;return Qo(Yo({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),operationTypeName:"".concat(null==n?void 0:n.operationTypeName),operationNumber:l().createElement(Lo,{model:h[r],operations:e}),status:"".concat(null==n?void 0:n.status),source:"".concat(null!==(i=null==n?void 0:n.sourceName)&&void 0!==i?i:""),destination:"".concat(null!==(c=null==n?void 0:n.destinationName)&&void 0!==c?c:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==n?void 0:n.sourceName)&&void 0!==s?s:""," ",(null==n?void 0:n.sourceName)&&(null==n?void 0:n.destinationName)?l().createElement(se.ol,{size:16}):""," ",null!==(u=null==n?void 0:n.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==n?void 0:n.responsiblePersonFamilyName)&&void 0!==d?d:null==n?void 0:n.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:W(null==n?void 0:n.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("created","Created")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.dateCreated))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(A=n.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=n.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==n?void 0:n.status)&&(null==n?void 0:n.status)!==Et&&(null==n?void 0:n.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("submitted","Submitted")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.submittedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(f=n.submittedByFamilyName)&&void 0!==f?f:""," ",null!==(v=n.submittedByGivenName)&&void 0!==v?v:""))),(null==n?void 0:n.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("completed","Completed")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(_=n.completedByFamilyName)&&void 0!==_?_:""," ",null!==(b=n.completedByGivenName)&&void 0!==b?b:""))),(null==n?void 0:n.status)===wt&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("cancelled","Cancelled")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.cancelledDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(y=n.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=n.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,n.cancelReason))),(null==n?void 0:n.status)===St&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Rejected"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.rejectedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(C=n.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=n.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,n.rejectionReason))),(null==n?void 0:n.status)===Et&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Returned"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=n.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=n.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,n.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:L}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){jo(h[r],!0,o,e,!1)}}))})}))}),[L,h,o,e,s]);return v?l().createElement(a.gqd,{className:Ct.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:Ct.tableOverride},l().createElement(a.x45,null,t("Stock operations to track movement of stock.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:q,headers:u,isSortable:!0,useZebraStyles:!0,render:function(o){var i=o.rows,c=o.headers,u=o.getHeaderProps,d=o.getTableProps,m=o.getRowProps,p=o.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Ct.toolbarContent},l().createElement(a.Ys1,{className:Ct.patientListSearch,expanded:!0,onChange:p,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:Ct.filterContainer},l().createElement(a.Mtg,{className:Ct.dateAlign,datePickerType:"range",dateFormat:K,value:[k,S],onChange:function(e){var t=Jo(e,2);!function(e){var t=Jo(e,2),n=t[0],r=t[1];n&&(C(n),S&&n&&S<n&&D(n)),r&&(D(r),k&&r&&k>r&&C(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:V}),l().createElement(a.aj6,{placeholder:V})),l().createElement(Go,{conceptUuid:F.stockSourceTypeUUID,filterName:ee.SOURCES,onFilterChange:R}),l().createElement(Go,{filterName:ee.STATUS,onFilterChange:R}),l().createElement(Go,{filterName:ee.OPERATION,onFilterChange:R})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Ft,{onOperationTypeSelected:function(t){jo(fn(),!1,t,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),c.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Qo(Yo({},u({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Ct.desktopHeader:Ct.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,i.map((function(e,n){var o,i,u,d,p,A,g,f,v,_,b,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Yo({className:r.isDesktop?Ct.desktopRow:Ct.tabletRow},m({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))),l().createElement(a.WdL,{colSpan:c.length+2},l().createElement(l().Fragment,null,l().createElement(a.SmK,null,l().createElement(a.s1N,{head:!0},l().createElement(a.agF,{head:!0},t("dateCreated","Date Created")),l().createElement(a.agF,{head:!0},t("dateCompleted","Date Completed")),l().createElement(a.agF,{head:!0},t("batchNumber","Batch Number")),l().createElement(a.agF,{head:!0},"Qty"))),l().createElement(a.FxI,null,l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(o=h[n])||void 0===o?void 0:o.dateCreated)?W(null===(i=h[n])||void 0===i?void 0:i.dateCreated):""," ",(null===(u=h[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(d=h[n])||void 0===d?void 0:d.dateCreated)?null===(p=h[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=h[n])||void 0===A?void 0:A.completedDate)?W(null===(g=h[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=h[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=h[n])||void 0===v?void 0:v.completedDate)?null===(_=h[n])||void 0===_?void 0:_.creatorFamilyName:""),l().createElement(a.agF,null,(null===(b=h[n])||void 0===b?void 0:b.stockOperationItems)?null===(y=h[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=h[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=h[n].stockOperationItems)||void 0===C?void 0:C.map((function(e){return e.quantity}))[0]:"")),l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(E=h[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?W(null===(w=h[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=h[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(D=h[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=h[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=h[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?W(null===(N=h[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=h[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=h[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=h[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=h[n])||void 0===P?void 0:P.completedDate)?null===(U=s[n])||void 0===U?void 0:U.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=h[n])||void 0===j?void 0:j.stockOperationItems)?null===(z=h[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=h[n])||void 0===F?void 0:F.stockOperationItems)?null===(L=h[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===i.length?l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("div",{className:Ct.tileContent},l().createElement("p",{className:Ct.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:Ct.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:g,pageSizes:m,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==g&&f(t),n!==d&&A(n)},className:Ct.paginationOverride}))};var Vo={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function Ko(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 Xo(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ko(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)?Ko(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 $o(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const ea=function(e){var t,n,o,c,s=Xo((0,i.useState)(""),2),u=s[0],d=s[1],m=(0,E.useTranslation)().t,p=(t=u,o={v:P.Default,q:t,limit:20},c=function(e){var t="".concat(r.restBaseUrl,"/drug").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n||o),{drugList:c.items.results,isLoading:c.isLoading}),A=p.isLoading,g=p.drugList,f=Xo((0,i.useState)(!1),2),v=f[0],_=f[1];return l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:g||[],initialSelectedItem:null!==(n=null==g?void 0:g.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:$o,onChange:function(t){var n,o,a,l,c;_(!1),null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),i(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid),(null==t||null===(a=t.selectedItem)||void 0===a?void 0:a.uuid)&&((c=null==t||null===(l=t.selectedItem)||void 0===l?void 0:l.uuid)&&function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem?drugUuid=").concat(e,"&limit=1");return(0,r.openmrsFetch)(t).then((function(e){return e.data}))}(c).then((function(e){var t,n,r=0!==(null!==(n=null==e||null===(t=e.results)||void 0===t?void 0:t.length)&&void 0!==n?n:0);_(r)})))},onInputChange:function(e){d(e)},inputValue:u,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),A&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}),v&&l().createElement("div",{style:{color:"#da1e28"}},m("itemAlreadyExists","Item already exits")))};var ta=on.z.string().max(255).nullish(),na=on.z.object({isDrug:on.z.boolean(),drugUuid:on.z.string().nullish(),drugName:on.z.string().nullish(),commonName:ta,acronym:ta,hasExpiration:on.z.boolean(),expiryNotice:on.z.coerce.number().nullish(),uuid:on.z.string().nullish(),conceptUuid:on.z.string().nullish(),conceptName:on.z.string().nullish(),preferredVendorUuid:on.z.string().nullish(),preferredVendorName:on.z.string().nullish(),purchasePrice:on.z.number().nullish(),purchasePriceUoMUuid:on.z.string().nullish(),purchasePriceUoMName:on.z.string().nullish(),categoryUuid:on.z.string().nullish(),categoryName:on.z.string().nullish(),dispensingUnitUuid:on.z.string().nullish(),dispensingUnitName:on.z.string().nullish(),dispensingUnitPackagingUoMUuid:on.z.string().nullish(),dispensingUnitPackagingUoMName:on.z.string().nullish(),defaultStockOperationsUoMUuid:on.z.string().nullish(),defaultStockOperationsUoMName:on.z.string().nullish(),reorderLevel:on.z.number().nullish(),reorderLevelUoMUuid:on.z.string().nullish(),reorderLevelUoMName:on.z.string().nullish(),dateCreated:on.z.coerce.date().nullish(),creatorGivenName:on.z.string().nullish(),creatorFamilyName:on.z.string().nullish(),voided:on.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const oa=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.SYO,(n=function(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){ra(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t,n,r){i(t,n,r),e.onChange&&e.onChange(t,n,r)},id:e.name,ref:s,defaultSelected:e.id,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),e.options.map((function(t,n){return l().createElement(a.EUY,{key:"".concat(n,"-").concat(e.name,"-").concat(t.value),id:"".concat(e.name,"-").concat(t.value),labelText:t.label,value:t.value,checked:c===t.value,onChange:function(){return i(t.value)},ref:s})})))}})},aa=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.Y2U,{label:e.label,id:"".concat(e.name,"-").concat(e.id,"-").concat(null===(n=e.row)||void 0===n?void 0:n.uuid),value:null!==(o=null===(r=e.row)||void 0===r?void 0:r.factor)&&void 0!==o?o:s,min:e.min,hideSteppers:e.hideSteppers||!1,ref:u,onChange:function(t,n){c(t,n),e.onChange&&e.onChange(t,n)}})}})},ia=function(e){var t=Ut((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n;null===(n=e.onDispensingUnitChange)||void 0===n||n.call(e,t.selectedItem),c(t.selectedItem.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.dispensingUnitUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.display)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})};function la(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ca(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){la(e,t,n[t])}))}return e}function sa(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}const ua=function(e){var t=sa({v:P.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.preferredVendorUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},da=function(e){var t=(0,E.useTranslation)().t,n=Ut((0,r.useConfig)().stockItemCategoryUUID),o=n.items.answers,i=n.isLoading,c=e.itemType?null==o?void 0:o.filter((function(t){return t.display===(null==e?void 0:e.itemType)})):o;return i?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(n){var r,i,s=n.field,u=s.onChange,d=s.value,m=s.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:c||[],onChange:function(t){var n,r;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),u(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==o?void 0:o.find((function(t){return t.uuid===e.categoryUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(t(null==e?void 0:e.display)):""},shouldFilterItem:function(){return!0},value:null!==(i=t(null==o||null===(r=o.find((function(e){return e.uuid===d})))||void 0===r?void 0:r.display))&&void 0!==i?i:"",placeholder:e.placeholder,ref:m,invalid:e.invalid,invalidText:e.invalidText})}})},ma=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits.find((function(t){return(null==t?void 0:t.uuid)===(null==e?void 0:e.dispensingUnitPackagingUoMUuid)})):null}),[null==e?void 0:e.packagingUnits]);return e.isLoading?l().createElement(a.xNL,null):(null==e?void 0:e.packagingUnits)&&(null==e?void 0:e.packagingUnits.length)>0?l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=null==n?void 0:n.uuid)&&void 0!==t?t:"",render:function(t){var r,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(r=e.packagingUnits)&&void 0!==r?r:[],onChange:function(t){var n,r;null===(n=e.onDispensingUnitPackagingUoMUuidChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),i(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:n,itemToString:function(e){return(null==e?void 0:e.packagingUomName)?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):"Not set"},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}})):l().createElement(l().Fragment,null)},pa=function(e){var t,n,r,o,i,c,s,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=fe(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(ma,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(ma,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),v?l().createElement(a.iJ5,null):l().createElement(aa,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(s=f.reorderLevel)&&void 0!==s?s:"",invalidText:p.reorderLevel&&(null==p||null===(r=p.reorderLevel)||void 0===r?void 0:r.message)}),l().createElement(ma,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(o=p.reorderLevelUoMUuid)||void 0===o?void 0:o.message)}),v?l().createElement(a.iJ5,null):l().createElement(aa,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price:"),value:null!==(u=f.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(ma,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(c=p.purchasePriceUoMUuid)||void 0===c?void 0:c.message)})):l().createElement(l().Fragment,null)};function Aa(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 ga=function(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/concept").concat(j({})),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(),c=o.items.results,s=o.isLoading,u=(t=(0,i.useState)(""),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Aa(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)?Aa(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.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return s?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p,onChange:function(t){var n;null===(n=e.onConceptUuidChange)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},initialSelectedItem:(null==c?void 0:c.find((function(t){return t.uuid===e.conceptUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};var fa=[{label:"Pharmaceuticals",value:!0},{label:"Non Pharmaceuticals",value:!1}],va=[{label:"Yes",value:!0},{label:"No",value:!1}];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 ha(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ba(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}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.")}()}var ya=(0,i.forwardRef)((function(e){var t,n,o,c,s,u,d,m,p,A,g,f=e.model,v=e.onSave,_=e.isEditing,h=e.handleTabChange,b=(0,E.useTranslation)().t,y=(0,nn.cI)({defaultValues:f,mode:"all",resolver:(0,rn.F)(na)}),k=y.handleSubmit,C=y.control,w=y.formState,S=w.errors,D=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ha(a,r,o,i,l,"next",e)}function l(e){ha(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,3,4]),I(!0),e.uuid=f.uuid,[4,v(e)];case 1:return t.sent(),h(1),ae("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),[3,4];case 2:return t.sent(),[3,4];case 3:return I(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),O=ba((0,i.useState)(!1),2),x=O[0],I=O[1],T=ba((0,i.useState)(!1),2),B=T[0],P=T[1],U=ba((0,i.useState)(""),2),j=U[0],z=U[1],F=ba((0,i.useState)(!1),2),L=F[0],R=F[1];return(0,i.useEffect)((function(){var e,t;P(null!==(e=f.isDrug)&&void 0!==e&&e),z(!0===f.isDrug?"Pharmaceuticals":!1===f.isDrug?"Non Pharmaceuticals":void 0),R(null!==(t=f.hasExpiration)&&void 0!==t&&t)}),[f.hasExpiration,f.isDrug]),l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(oa,{control:C,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!S.isDrug,invalidText:S.isDrug&&(null==S||null===(t=S.isDrug)||void 0===t?void 0:t.message),onChange:function(e){var t=fa.find((function(t){return t.value===e})),n=t?t.label:"";P(e),z(n)},options:fa})),B&&l().createElement(ea,{name:"drugUuid",controllerName:"drugUuid",control:C,title:b("pleaseSpecify","Please specify:"),placeholder:"Choose a drug",invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(n=S.drugUuid)||void 0===n?void 0:n.message)}),null!=B&&!B&&l().createElement(ga,{name:"conceptUuid",controllerName:"conceptUuid",control:C,title:b("pleaseSpecify","Please specify")+":",placeholder:b("chooseAnItem","Choose an item"),invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(o=S.drugUuid)||void 0===o?void 0:o.message)}),l().createElement(yn,{id:"commonName",name:"commonName",control:C,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(g=null==f?void 0:f.commonName)&&void 0!==g?g:""),labelText:b("commonName","Common name")+":",invalid:!!S.commonName,invalidText:S.commonName&&(null==S||null===(c=S.commonName)||void 0===c?void 0:c.message)}),l().createElement(yn,{id:"acronym",maxLength:255,name:"acronym",control:C,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation")+":",invalid:!!S.acronym,invalidText:S.acronym&&(null==S||null===(s=S.acronym)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(oa,{name:"hasExpiration",controllerName:"hasExpiration",control:C,legendText:"",invalid:!!S.hasExpiration,invalidText:S.hasExpiration&&(null==S||null===(u=S.hasExpiration)||void 0===u?void 0:u.message),onChange:function(e){R(e)},options:va})),L&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(aa,{id:"expiryNotice",name:"expiryNotice",control:C,controllerName:"expiryNotice",min:0,size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!S.expiryNotice,invalidText:S.expiryNotice&&(null==S||null===(d=S.expiryNotice)||void 0===d?void 0:d.message)}))),l().createElement(ua,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:C,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!S.preferredVendorUuid,invalidText:S.preferredVendorUuid&&(null==S||null===(m=S.preferredVendorUuid)||void 0===m?void 0:m.message)}),l().createElement(da,{name:"categoryUuid",controllerName:"categoryUuid",control:C,itemType:"Pharmaceuticals"===j?"Drugs":"Non Pharmaceuticals"===j?"Non Drugs":void 0,title:b("category:","Category")+":",placeholder:b("chooseACategory","Choose a category"),invalid:!!S.categoryUuid,invalidText:S.categoryUuid&&(null==S||null===(p=S.categoryUuid)||void 0===p?void 0:p.message)}),B&&l().createElement(ia,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:C,title:b("dispensingUnit","Dispensing Unit")+":",placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!S.dispensingUnitUuid,invalidText:S.dispensingUnitUuid&&(null==S||null===(A=S.dispensingUnitUuid)||void 0===A?void 0:A.message)}),B&&_&&l().createElement(pa,{control:C,formState:w,stockItemUuid:f.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:k(D),kind:"primary",renderIcon:mr.vc},x?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Y},b("cancel","Cancel"))))}));const ka=ya;function Ca(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 Ea(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ca(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)?Ca(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.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,i.useMemo)((function(){return[{key:"location",header:"Location"},{key:"name",header:"Name"},{key:"quantity",header:"Quantity Threshold"},{key:"evaluationFrequency",header:"Frequency Check"},{key:"actionFrequency",header:"Notification Frequency"},{key:"alertRole",header:"Alert Role"},{key:"mailRole",header:"Mail Role"},{key:"enabled",header:"Enabled?"},{header:"actions",key:"actions"}]}),[]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:f}}var wa=n(4563),Sa={};Sa.styleTagTransform=h(),Sa.setAttributes=g(),Sa.insert=p().bind(null,"head"),Sa.domAPI=d(),Sa.insertStyleElement=v(),s()(wa.Z,Sa);const Da=wa.Z&&wa.Z.locals?wa.Z.locals:void 0;function Oa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xa(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){Oa(e,t,n[t])}))}return e}function Na(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 Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ta(){return Ta=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ta.apply(this,arguments)}function Ba(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){Ia(e,t,n[t])}))}return e}function Pa(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Ua(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Na(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)?Na(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 ja=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t,u=Ua((0,i.useState)({startIndex:0,v:P.Default,q:null,totalCount:!0}),2),d=u[0],m=u[1];(0,i.useEffect)((function(){m({startIndex:0,v:P.Default,totalCount:!0,stockItemUuid:c})}),[c]);var p=ge(d).items,A=Nt().stockLocations,g=It({v:P.Default}).items,f=Ua((0,i.useState)(Ba({enabled:!0},o)),2),v=f[0],_=f[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){var e=Ba({},Ta({},function(e){if(null==e)throw new TypeError("Cannot destructure "+e);return e}(o)));_(e)}}),[o]);var h=(0,i.useCallback)((function(e){e.preventDefault(),o&&(v.uuid=o.uuid),c&&(v.stockItemUuid=c),function(e){var t=null!=e.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(t?"/"+e.uuid:""),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:xa({},e)})}(v).then((function(){(0,r.showSnackbar)({isLowContrast:!0,title:s("addedRule","Add Rule"),kind:"success",subtitle:s("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Y()}),(function(e){(0,r.showSnackbar)({title:s("errorAddingRule', 'error adding a rule"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch()}),[v,o,s,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:Da.section},l().createElement("section",{className:Da.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==v?void 0:v.locationUuid)?v.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.id===e.target.value}));_(Pa(Ba({},v),{locationUuid:t.id}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})})))),l().createElement("section",{className:Da.section},l().createElement(a.oil,{id:"name",type:"text",labelText:s("name","Rule Name"),size:"md",onChange:function(e){o&&(o.name=e.target.value),_(Pa(Ba({},v),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Da.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==v?void 0:v.stockItemPackagingUOMUuid)?v.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));_(Pa(Ba({},v),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:Da.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:s("quantity","Quantity Threshold"),size:"md",onChange:function(e){o&&(o.quantity=Number(e.target.value)),_(Pa(Ba({},v),{quantity:Number(e.target.value)}))},value:null==o?void 0:o.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:Da.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==v?void 0:v.alertRole)?v.alertRole:"",onChange:function(e){var t=null==g?void 0:g.results.find((function(t){return t.display===e.target.value}));_(Pa(Ba({},v),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==g||null===(t=g.results)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:Da.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==v?void 0:v.mailRole)?v.mailRole:"",onChange:function(e){var t=null==g?void 0:g.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),_(Pa(Ba({},v),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==g||null===(n=g.results)||void 0===n?void 0:n.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:Da.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:s("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){o&&(o.evaluationFrequency=Number(e.target.value)),_(Pa(Ba({},v),{evaluationFrequency:Number(e.target.value)}))},value:null==o?void 0:o.evaluationFrequency,placeholder:"e.g 30 Minutes"}),l().createElement(a.oil,{id:"actionFrequency",type:"number",labelText:s("actionFrequency","Notification Frequency (Minutes)"),size:"md",onChange:function(e){o&&(o.actionFrequency=Number(e.target.value)),_(Pa(Ba({},v),{actionFrequency:Number(e.target.value)}))},value:null==o?void 0:o.actionFrequency,placeholder:"e.g 3600 Minutes"}))),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Da.checkboxGrid},l().createElement(a.XZJ,{onChange:function(){var e=!(null==v?void 0:v.enabled);_(Pa(Ba({},v),{enabled:e}))},checked:null==v?void 0:v.enabled,labelText:"Enabled ?",value:null==o?void 0:o.enabled,id:"chk-ruleEnabled"}))),l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Da.checkboxGrid},l().createElement(a.XZJ,{onChange:function(){var e=!(null==v?void 0:v.enableDescendants);_(Pa(Ba({},v),{enableDescendants:e}))},name:"appliesToChildren",checked:null==v?void 0:v.enableDescendants,value:null==o?void 0:o.enableDescendants,labelText:"Applies to child locations?",id:"chk-ruleAppliesToChildren"})))),l().createElement("div",null,"This stock rule will be evaluated by checking if the stock quantities have lowered to the threshold or below and a notification will be sent to the personnel with the specified role in the given location. The notification will only be sent once per specified notification frequency.")),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Y},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},za=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Z("Add Stock Rule",l().createElement(ja,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var Fa=n(4907),La={};La.styleTagTransform=h(),La.setAttributes=g(),La.insert=p().bind(null,"head"),La.domAPI=d(),La.insertStyleElement=v(),s()(Fa.Z,La);const Ra=Fa.Z&&Fa.Z.locals?Fa.Z.locals:void 0;function Ma(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 qa=function(e){var t,n=e.stockItemUuid,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}({v:P.Default,totalCount:!0,stockItemUuid:n}),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:Ra.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Ma(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Ma(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)?Ma(e,t):void 0}}(t)||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.")}()),itemToString:function(e){return e?e.display:"Not Set"},type:"inline",size:"sm"})))};function Ga(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 Ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Za=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ga(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)?Ga(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.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t,n,a;(t=o,n="".concat(r.restBaseUrl,"/stockmanagement/stockrule/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){d(!1),(0,r.showSnackbar)({isLowContrast:!0,title:c("deletingRule","Delete Rule"),kind:"success",subtitle:c("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,r.showSnackbar)({title:c("errorDeletingRule', 'error deleting a rule"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteRule","Delete Rule"),renderIcon:function(e){return l().createElement(ue.ZN,function(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){Ha(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qa=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Z("Edit Stock Rule",l().createElement(ja,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(At.I8,function(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){Ya(e,t,n[t])}))}return e}({size:16},e))}})};function Ja(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wa(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){Ja(e,t,n[t])}))}return e}function Va(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ka=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t),o=Ea({v:P.Default,totalCount:!0,stockItemUuid:t}),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.currentPage,m=o.currentPageSize,p=o.pageSizes,A=o.totalItems,g=o.setPageSize,f=o.goTo,v=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e,t){var n,r;return Va(Wa({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated:W(null==e?void 0:e.dateCreated),location:null==e?void 0:e.locationName,quantity:"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(r=null==e?void 0:e.packagingUomName)&&void 0!==r?r:""),name:"".concat(null==e?void 0:e.name),description:"".concat(null==e?void 0:e.description),evaluationFrequency:"".concat(null==e?void 0:e.evaluationFrequency," minutes"),actionFrequency:"".concat(null==e?void 0:e.actionFrequency," minutes"),lastActionDate:W(null==e?void 0:e.lastActionDate),nextActionDate:W(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Qa,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Za,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Ct.tableOverride},l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:v,headers:u,isSortable:!0,useZebraStyles:!0,render:function(e){var o=e.rows,i=e.headers,c=e.getHeaderProps,s=e.getTableProps,u=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Ct.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(qa,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(za,{stockItemUuid:t}))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Va(Wa({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Ct.desktopHeader:Ct.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Wa({className:r.isDesktop?Ct.desktopRow:Ct.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===o.length?l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("div",{className:Ct.tileContent},l().createElement("p",{className:Ct.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:Ct.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:m,pageSizes:p,totalItems:A,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&g(t),n!==d&&f(n)},className:Ct.paginationOverride}))};function Xa(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 $a(e){return function(e){if(Array.isArray(e))return Xa(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Xa(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)?Xa(e,t):void 0}}(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.")}()}const ei=function(e){var t=Ut((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i,c,s,u,d,m,p,A=t.field.onChange;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:"".concat(e.name,"-").concat(e.row.id,"-").concat(e.row.uuid),size:"md",items:void 0!==(null===(r=e.row)||void 0===r?void 0:r.packagingUomUuid)?$a(n.some((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.packagingUomUuid)}))?[]:[{uuid:null===(o=e.row)||void 0===o?void 0:o.packagingUomUuid,display:null===(i=e.row)||void 0===i?void 0:i.packagingUomName}]).concat($a(null!=n?n:[])):n||[],onChange:function(t){var n,r;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),A((null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)||"")},initialSelectedItem:void 0!==(null===(c=e.row)||void 0===c?void 0:c.packagingUomUuid)?{uuid:null===(s=e.row)||void 0===s?void 0:s.packagingUomUuid,display:null===(u=e.row)||void 0===u?void 0:u.packagingUomName}:null,selectedItem:void 0!==(null===(d=e.row)||void 0===d?void 0:d.packagingUomUuid)?{uuid:null===(m=e.row)||void 0===m?void 0:m.packagingUomUuid,display:null===(p=e.row)||void 0===p?void 0:p.packagingUomName}:null,itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText})}})};var ti=on.z.object({id:on.z.string().nullish(),uuid:on.z.string().nullish(),stockItemUuid:on.z.string().nullish(),packagingUomName:on.z.string().nullish(),packagingUomUuid:on.z.string().nullish(),factor:on.z.coerce.number().nullish(),isDefaultStockOperationsUoM:on.z.boolean().nullish(),isDispensingUnit:on.z.boolean().nullish()});function ni(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 ri(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oi(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){ri(e,t,n[t])}))}return e}function ai(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ii(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||ci(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 li(e){return function(e){if(Array.isArray(e))return ni(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ci(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 ci(e,t){if(e){if("string"==typeof e)return ni(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)?ni(e,t):void 0}}const si=function(e){var t=e.stockItemUuid,n=e.handleTabChange,o=ye(),c=o.items,s=o.isLoading,u=o.setStockItemUuid,d=o.mutate,m=ii((0,i.useState)(c),2),p=m[0],A=m[1],g=ii((0,i.useState)({packagingUomUuid:void 0,factor:0,packagingUomName:""}),2),f=g[0],v=g[1];(0,i.useEffect)((function(){u(t)}),[t,u]),(0,i.useEffect)((function(){A(c)}),[c]);var _=(0,E.useTranslation)().t,h=(0,i.useMemo)((function(){return[{key:"packaging",header:_("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:_("packSize","Pack Size"),styles:{width:"50%"}},{key:"action",header:_("action","Actions"),styles:{width:"50%"}}]}),[_]),b=(0,nn.cI)({defaultValues:{},mode:"all",resolver:(0,rn.F)(ti)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(nn.RV,b,l().createElement(a.wQF,{rows:li(c).concat([{}]),headers:h,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:Ee.packagingTableContainer},l().createElement(a.iA_,ai(oi({},r()),{className:Ee.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,ai(oi({},n({header:e,isSortable:!1})),{style:e.styles,key:e.key}),null!==(r=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==r?r:e.header)})),l().createElement(a.xDH,{style:{width:"70%"}}))),l().createElement(a.RMI,{className:Ee.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(ui,{row:e,id:"".concat(t,"-").concat(null==e?void 0:e.uuid),onChange:function(t){return function(e,t){var n="number"==typeof t?t:parseFloat(t);A((function(t){return t.map((function(t){return t.uuid===e.uuid?ai(oi({},t),{factor:n}):t}))}))}(e,t)}})})),l().createElement(ui,{row:f||{},id:"new-package-unit",isEditing:!0,onChangePackageUnit:function(e){return t=e,void v(ai(oi({},f),{packagingUomUuid:t.uuid,packagingUomName:t.display}));var t},onChange:function(e){return function(e){v(ai(oi({},f),{factor:Number(e)}))}(e)}}))))}}),l().createElement("div",{className:Ee.packageUnitsBtn},l().createElement(a.zxk,{kind:"secondary",onClick:function(){n(0)}},_("cancel","Cancel")),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=b.reset,o=f?{factor:f.factor,packagingUomUuid:f.packagingUomUuid,stockItemUuid:t}:null,a=p.filter((function(e){var t=c.find((function(t){return t.uuid===e.uuid}));return t&&t.factor!==e.factor})),i=o.packagingUomUuid?function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}(o).then((function(){(0,r.showSnackbar)({title:_("savePackingUnitTitle","Package Unit"),subtitle:_("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"}),v({factor:0,packagingUomUuid:void 0,packagingUomName:""})}),(function(){(0,r.showSnackbar)({title:_("savePackagingUnitErrorTitle","Package Unit"),subtitle:_("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})):Promise.resolve({status:"no-create"}),l=a.map((function(e){return function(e,t){var n="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:e})}(e,e.uuid).then((function(){(0,r.showSnackbar)({title:_("updatePackingUnitTitle","Package Unit"),subtitle:_("updatePackingUnitMessage","Package Unit {{ name }} updated successfully",{name:e.packagingUomName}),kind:"success"})}),(function(){(0,r.showSnackbar)({title:_("updatePackagingUnitErrorTitle","Package Unit"),subtitle:_("updatePackagingUnitErrorMessage","Error updating package unit {{name}}",{name:e.packagingUomName}),kind:"error"})}))}));Promise.all([i].concat(li(l))).then((function(){d(),ae("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),e(),n(0)}))},kind:"primary",renderIcon:mr.vc},_("save","Save"))))};var ui=function(e){var t=e.isEditing,n=e.row,r=e.id,o=e.onChange,i=e.onChangePackageUnit,c=(0,nn.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(l().Fragment,null,l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(ei,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",placeholder:"Filter",control:s,onPackageUnitChange:function(e){return i(e)},invalid:!!u.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement(aa,{row:n,controllerName:"factor",name:"factor",min:0,control:s,id:r,invalid:!!u.factor,hideSteppers:!0,onChange:function(e,t){return o(t.value)}})),l().createElement(a.pj1,null,l().createElement(de,{closeModal:function(){return!0},row:n}))))};function di(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 mi(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return di(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)?di(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.")}()}var pi=n(3162),Ai=n(4655),gi={};gi.styleTagTransform=h(),gi.setAttributes=g(),gi.insert=p().bind(null,"head"),gi.domAPI=d(),gi.insertStyleElement=v(),s()(Ai.Z,gi);const fi=Ai.Z&&Ai.Z.locals?Ai.Z.locals:void 0;function vi(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){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hi(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||bi(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 bi(e,t){if(e){if("string"==typeof e)return vi(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)?vi(e,t):void 0}}const yi=function(e){var t=e.columns,n=e.data,o=e.children,c=e.totalItems,s=e.goToPage,u=e.hasToolbar,d=void 0===u||u,m=(0,E.useTranslation)().t,p=(0,r.useLayoutType)(),A=hi((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=hi((0,i.useState)(n),1)[0],h=[10,20,30,40,50],b=hi((0,i.useState)(10),2),y=b[0],k=b[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,D=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(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){_i(e,t,n[t])}))}return e}({},t),o=null!=(o={id:n++})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r));var r,o})),f(e)}),[S,g]);var O=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,pi.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,pi.saveAs)(o,"data.json")}},x=function(e,t){var n,r=t.map((function(e){return e.header})).join(","),o=e.map((function(e){return t.map((function(t){return JSON.stringify(e[t.key])})).join(",")}));return[r].concat((n=o,function(e){if(Array.isArray(e))return vi(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||bi(n)||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.")}())).join("\n")};return l().createElement(l().Fragment,null,l().createElement(a.wQF,{"data-floating-menu-container":!0,rows:g,headers:t,filterRows:function(e){var t=e.rowIds,n=e.headers,r=e.cellsById,o=e.inputValue,a=e.getCellId;return t.filter((function(e){return n.some((function(t){var n=t.key,i=a(e,n),l=r[i].value,c=o.toLowerCase();return"boolean"!=typeof l&&(""+l).toLowerCase().includes(c)}))}))},overflowMenuOnHover:(0,r.isDesktop)(p),size:v?"lg":"md",useZebraStyles:!0},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,i=e.getTableProps,u=e.onInputChange;return l().createElement("div",null,l().createElement(a.xJi,{className:fi.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:fi.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:At.rT,iconDescription:"Download As",focusTrap:!1},l().createElement(a.laM,{itemText:"Download As CSV",onClick:O}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:O}),l().createElement(a.laM,{itemText:"Download As Json",onClick:O})),l().createElement(a.Ys1,{className:fi.itemListSearch,expanded:!0,onChange:u,placeholder:m("searchThisList","Search this list"),size:"sm"})))),l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){return l().createElement(a.xDH,r({header:e}),e.header)})))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(a.SCH,{key:e.id},e.cells.map((function(e){return l().createElement(a.pj1,{key:e.id},e.value)})))})))),0===t.length?l().createElement("div",{className:fi.tileContainer},l().createElement(a.n9L,{className:fi.tile},l().createElement("div",{className:fi.tileContent},l().createElement("p",{className:fi.content},m("No data","No data to display")),l().createElement("p",{className:fi.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:D,pageSize:y,pageSizes:h,totalItems:c||(null==_?void 0:_.length),className:fi.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==D){if(s)return void s(n);w(n)}}})))})))},ki=function(e){var t=(0,E.useTranslation)().t,n=Nt().stockLocations;return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function Ci(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 Ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wi(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){Ei(e,t,n[t])}))}return e}function Si(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Di(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ci(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)?Ci(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 Oi=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=Di((0,i.useState)(),2),c=o[0],s=o[1],u=function(e){var t=mi((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||P.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0}),2),n=t[0],o=t[1],a=mi((0,i.useState)(10),2),l=a[0],c=a[1],s=mi((0,i.useState)(null),2),u=s[0],d=s[1],m=mi((0,i.useState)(1),2),p=m[0],A=m[1],g=mi((0,i.useState)(null==e?void 0:e.stockItemUuid),2),f=g[0],v=g[1],_=mi((0,i.useState)(null==e?void 0:e.partyUuid),2),h=_[0],b=_[1],y=mi((0,i.useState)(null==e?void 0:e.locationUuid),2),k=y[0],C=y[1],E=mi((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),w=E[0],S=E[1];(0,i.useEffect)((function(){o({startIndex:p-1,v:P.Default,limit:l,q:u,totalCount:!0,stockItemUuid:f,partyUuid:h,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,h,k,w]);var D=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemtransaction").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),O=D.items,x=D.isLoading,N=D.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:b,setStockBatchUuid:S}}(c),d=u.isLoading,m=u.items,p=u.tableHeaders,A=u.totalCount,g=u.setCurrentPage,f=u.setStockItemUuid,v=u.setLocationUuid,_=Di((0,i.useState)(null),2),h=(_[0],_[1],Di((0,i.useState)(null),2));h[0],h[1],(0,i.useEffect)((function(){f(t)}),[t,f]);var b,y=(0,nn.cI)({}).control,k=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e){var t,n,r,o,a,i,c;return Si(wi({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),date:W(null==e?void 0:e.dateCreated),location:e.operationSourcePartyName&&e.operationDestinationPartyName?e.operationSourcePartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationSourcePartyName),l().createElement(se.Xd,{size:16})," ",e.operationDestinationPartyName)):e.operationDestinationPartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationDestinationPartyName),l().createElement(se.Xd,{size:16})," ",e.operationSourcePartyName)):null==e?void 0:e.partyName:null==e?void 0:e.partyName,transaction:(null==e?void 0:e.isPatientTransaction)?"Patient Dispense":e.stockOperationTypeName,quantity:"".concat(null==e||null===(t=e.quantity)||void 0===t?void 0:t.toLocaleString()," ").concat(null!==(o=null==e?void 0:e.packagingUomName)&&void 0!==o?o:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(W(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(Lo,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:b}):l().createElement(l().Fragment,null),status:null!==(a=null==e?void 0:e.stockOperationStatus)&&void 0!==a?a:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(i=null==e?void 0:e.packagingUomName)&&void 0!==i?i:""," of ").concat(e.packagingUomFactor):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(r=-1*(null==e?void 0:e.quantity))||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""," of ").concat(e.packagingUomFactor):""})}))}),[m,b]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(yi,{children:function(){return l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement(ki,{onLocationIdChange:function(e){v(e),s(Si(wi({},c),{locationUuid:e}))},name:"TransactionLocationUuid",placeholder:n("filterByLocation","Filter by Location"),control:y,controllerName:"TransactionLocationUuid"}))},columns:p,data:k,totalItems:A,goToPage:g,hasToolbar:!0})},xi=function(e){var t=(0,E.useTranslation)().t,n=Nt().stockLocations;return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function Ni(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 Ii(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ti(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){Ii(e,t,n[t])}))}return e}function Bi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Pi=function(e){var t,n,r=e.stockItemUuid,o=(t=(0,i.useState)(),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ni(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)?Ni(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.")}()),c=o[0],s=o[1],u=Kn(c),d=u.isLoading,m=u.items,p=u.totalCount,A=u.setCurrentPage,g=u.setStockItemUuid,f=u.setLocationUuid,v=(0,E.useTranslation)().t,_=(0,nn.cI)({}).control;(0,i.useEffect)((function(){g(r)}),[r,g]);var h=(0,i.useMemo)((function(){return[{key:"location",header:v("location","Location")},{key:"batch",header:v("batchNumber","Batch Number")},{key:"quantity",header:v("quantity","Quantity")},{key:"packaging",header:v("packagingUnit","Packaging Unit")},{key:"expires",header:v("expires","Expires")}]}),[v]),b=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n,r,o,a,i;return Bi(Ti({},e),{id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:W(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})}))}),[m]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(yi,{children:function(){return l().createElement(l().Fragment,null,l().createElement(xi,{control:_,onLocationIdChange:function(e){f(e),s(Bi(Ti({},c),{locationUuid:e}))},placeholder:v("filterByLocation","Filter by Location"),name:"BatchLocationUuid",controllerName:"BatchLocationUuid"}))},columns:h,data:b,totalItems:p,goToPage:A,hasToolbar:!0})};function Ui(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 ji(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ui(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)?Ui(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 zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fi=function(e){var t=e.stockItemUuid,n=function(e){var t=ji((0,i.useState)({startIndex:0,v:e||P.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=ji((0,i.useState)(10),2),a=o[0],l=o[1],c=ji((0,i.useState)(null),2),s=c[0],u=c[1],d=ji((0,i.useState)(1),2),m=d[0],p=d[1],A=ji((0,i.useState)(),2),g=A[0],f=A[1],v=ji((0,i.useState)(),2),_=v[0],h=v[1],b=ji((0,i.useState)(),2),y=b[0],k=b[1],C=ji((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:P.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,D=pe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}(P.Default),r=n.isLoading,o=n.items,c=n.totalCount,s=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l,c;return l=function(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){zi(e,t,n[t])}))}return e}({},e),c=null!=(c={id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:W(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(c,e))})),l}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(yi,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1})};var Li=n(501),Ri={};Ri.styleTagTransform=h(),Ri.setAttributes=g(),Ri.insert=p().bind(null,"head"),Ri.domAPI=d(),Ri.insertStyleElement=v(),s()(Li.Z,Ri);const Mi=Li.Z&&Li.Z.locals?Li.Z.locals:void 0,qi=function(e){var t=sa({v:P.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onSourceChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.uuid)})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid})}})};function Gi(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 Hi(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gi(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)?Gi(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 Zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yi(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){Zi(e,t,n[t])}))}return e}function Qi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ji=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=function(e){var t=Hi((0,i.useState)({startIndex:0,v:e||P.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=Hi((0,i.useState)(),2),l=a[0],c=a[1];(0,i.useEffect)((function(){o({startIndex:0,v:P.Default,totalCount:!0,stockItemUuid:l})}),[l]);var s=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),u=s.items,d=s.isLoading,m=s.isError;return{items:u.results,totalCount:u.totalCount,isLoading:d,isError:m,setStockItemUuid:c}}(),c=o.items,s=o.isLoading,u=o.setStockItemUuid;(0,i.useEffect)((function(){u(t)}),[t,u]);var d=(0,i.useMemo)((function(){return[{key:"source",header:n("source","Source"),styles:{width:"50%"}},{key:"code",header:n("code","Code"),styles:{width:"50%"}},{key:"action",header:n("action","Actions"),styles:{width:"50%"}}]}),[n]),m=(0,nn.cI)({defaultValues:{},mode:"all",resolver:(0,rn.F)(na)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(nn.RV,m,l().createElement(a.wQF,{rows:null!=c?c:[],headers:d,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:Mi.referencesTableContainer},l().createElement(a.iA_,Qi(Yi({},r()),{className:Mi.referencesTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,Qi(Yi({},n({header:e,isSortable:!1})),{style:e.styles,key:e.key}),null!==(r=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==r?r:e.header)})),l().createElement(a.xDH,{style:{width:"70%"}}))),l().createElement(a.RMI,{className:Mi.referencesTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(Wi,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(Wi,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=(0,m.getValues)(),o=e.code,a=e.references;(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})})({referenceCode:o,stockItemUuid:t,stockSourceUuid:a}).then((function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference")),(0,r.showSnackbar)({title:n("saveReferenceTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceMessage","Stock Item Reference saved successfully"),kind:"success"})}),(function(e){ae("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"));var t=oe(e);(0,r.showSnackbar)({title:n("saveStockItemReferenceErrorTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceErrorMessage","Error saving stock item reference"+t.join(",")),kind:"error"})}))},kind:"primary",renderIcon:mr.vc},n("save","Save")))};var Wi=function(e){var t,n=e.isEditing,o=e.row,i=e.key,c=(0,E.useTranslation)().t,s=(0,nn.Gc)().control;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,n?l().createElement(qi,{row:o,name:"references",controllerName:"references",control:s,placeholder:c("filter","Filter...")}):(!n||!o.uuid.startsWith("new-item"))&&(null==o?void 0:o.stockSourceName)),l().createElement(a.pj1,null,l().createElement("div",{className:Mi.referencesTableCell},l().createElement(yn,{id:"".concat(o.uuid,"-").concat(i),name:"code",control:s,size:"md",value:null!==(t=null==o?void 0:o.referenceCode)&&void 0!==t?t:"",controllerName:"code",labelText:""}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:ue.ZN,onClick:function(e){return function(e){var t,n,a;e.preventDefault(),(t=o.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showSnackbar)({title:c("deletePackagingUnitTitle","Delete StockItem reference"),kind:"success",subtitle:c("deleteStockItemReferenceMesaage","StockItem reference deleted Successfully")})}),(function(e){var t=oe(e);(0,r.showSnackbar)({title:c("deleteStockItemReferenceTitle","Error Deleting a stockitem reference"),kind:"error",subtitle:t.join(",")})}))}(e)}}))))};function Vi(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 Ki=function(e){var t,n,r=e.isEditing,o=e.model,a=e.onSave,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(0),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Vi(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)?Vi(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.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(ka,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(si,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(Oi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Pi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(Fi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Rules"),component:l().createElement(Ka,{stockItemUuid:o.uuid}),disabled:!r},{name:c("references","References"),component:l().createElement(Ji,{stockItemUuid:o.uuid,isEditing:r}),disabled:!r}];return l().createElement(qt,{onChange:m,tabs:p,selectedIndex:u})};function Xi(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var $i=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Xi(a,r,o,i,l,"next",e)}function l(e){Xi(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o,a,i,l,c=arguments;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(s){switch(s.label){case 0:t=c.length>1&&void 0!==c[1]&&c[1],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(t?_e:ve)(e)];case 2:return(null==(n=s.sent())?void 0:n.data)&&((0,r.showSnackbar)({isLowContrast:!0,title:"".concat(t?"Edit":"Add"," Stock Item"),kind:"success",subtitle:"Stock Item ".concat(t?"Edited":"Added"," Successfully")}),t||(Y(),(o=n.data).isDrug=!!o.drugUuid,el(o,!0))),[3,4];case 3:return a=s.sent(),(0,r.showSnackbar)({title:"Error ".concat(t?"edit":"add","ing a stock item"),kind:"error",isLowContrast:!0,subtitle:null==a||null===(l=a.responseBody)||void 0===l||null===(i=l.error)||void 0===i?void 0:i.message}),[3,4];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),el=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Z("".concat(t?"Edit":"Add"," ").concat((null==e?void 0:e.drugName)||e.conceptName||""),l().createElement(Ki,{model:e,onSave:function(e){return $i(e,t)},isEditing:t}))};const tl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){el(Vo,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var nl=n(1048),rl={};rl.styleTagTransform=h(),rl.setAttributes=g(),rl.insert=p().bind(null,"head"),rl.domAPI=d(),rl.insertStyleElement=v(),s()(nl.Z,rl);const ol=nl.Z&&nl.Z.locals?nl.Z.locals:void 0,al=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:ol.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Pharmaceuticals",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Non Pharmaceuticals",value:"false",id:"is-drug-other"}))};function il(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 ll(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return il(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)?il(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 cl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){var e=(0,r.showModal)("import-bulk-stock-items",{closeModal:function(){return e()}})}),[]);return l().createElement(a.zxk,{kind:"ghost",onClick:t,iconDescription:e("import","Import")},e("import","Import"))},sl=function(e){var t,n=e.data,r=(0,E.useTranslation)().t;return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){n.isDrug=!!n.drugUuid,el(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function ul(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 dl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ml(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){dl(e,t,n[t])}))}return e}function pl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Al=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(""),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ul(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)?ul(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.")}()),c=o[0],s=o[1],u=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stockitem"))},d=function(e){(0,E.useTranslation)().t;var t=ll((0,i.useState)(1),2),n=t[0],o=t[1],a=ll((0,i.useState)(10),2),l=a[0],c=a[1],s=ll((0,i.useState)(null),2),u=s[0],d=s[1],m=ll((0,i.useState)(""),2),p=m[0],A=m[1],g=ll((0,i.useState)({startIndex:n-1,v:e||P.Default,limit:l,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=me(f),h=_.items,b=_.isLoading,y=_.isError,k=(0,r.usePagination)(h.results,l);return(0,i.useEffect)((function(){v({startIndex:n-1,v:P.Default,limit:l,q:u,totalCount:!0,isDrug:p})}),[u,n,l,p]),{items:k.results,pagination:k,totalCount:h.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:b,isError:y,isDrug:p,setDrug:function(e){o(1),A(e)},setSearchString:d}}(P.Full),m=d.isLoading,p=d.items,A=d.totalCount,g=d.currentPageSize,f=d.setPageSize,v=d.pageSizes,_=d.currentPage,h=d.setCurrentPage,b=d.isDrug,y=d.setDrug,k=d.setSearchString,C=gn((function(e){k(e)}),1e3);(0,i.useEffect)((function(){C(c)}),[c,C]);var w=(0,i.useMemo)((function(){return[{id:0,header:n("type","Type"),key:"type"},{id:1,header:n("genericName","Generic Name"),key:"genericName"},{id:2,header:n("commonName","Common Name"),key:"commonName"},{id:3,header:n("tradeName","Trade Name"),key:"tradeName"},{id:4,header:n("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:n("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:n("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[n]),S=(0,i.useMemo)((function(){return null==p?void 0:p.map((function(e,t){var r;return pl(ml({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),type:(null==e?void 0:e.drugUuid)?n("drug","Drug"):n("other","Other"),genericName:l().createElement(sl,{data:p[t]}),commonName:null==e?void 0:e.commonName,tradeName:(null==e?void 0:e.drugUuid)?null==e?void 0:e.conceptName:"",preferredVendorName:null==e?void 0:e.preferredVendorName,dispensingUoM:null==e?void 0:e.defaultStockOperationsUoMName,dispensingUnitName:null==e?void 0:e.dispensingUnitName,defaultStockOperationsUoMName:null==e?void 0:e.defaultStockOperationsUoMName,reorderLevel:(null==e?void 0:e.reorderLevelUoMName)&&(null==e?void 0:e.reorderLevel)?"".concat(null==e||null===(r=e.reorderLevel)||void 0===r?void 0:r.toLocaleString()," ").concat(null==e?void 0:e.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){e.isDrug=!!e.drugUuid,el(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(At.I8,ml({size:16},e))}}))})}))}),[p,n]);return m?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,n("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows:S,headers:w,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,d=e.getTableProps,m=e.getRowProps,p=e.getBatchActionProps;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,p()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,value:c,onChange:function(e){return t=e.target.value,void s(t);var t}}),l().createElement(al,{filterType:b,changeFilterType:y}),l().createElement(cl,null),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(tl,null))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,o.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,pl(ml({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Ct.desktopHeader:Ct.tabletHeader,key:"".concat(e.key),isSortable:"name"!==e.key}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,pl(ml({className:r.isDesktop?Ct.desktopRow:Ct.tabletRow},m({row:e})),{key:e.id}),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("div",{className:Ct.tileContent},l().createElement("p",{className:Ct.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:Ct.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:_,pageSize:g,pageSizes:v,totalItems:A,onChange:function(e){var t=e.page,n=e.pageSize;h(t),f(n)},className:Ct.paginationOverride}))};var gl=n(5104),fl={};fl.styleTagTransform=h(),fl.setAttributes=g(),fl.insert=p().bind(null,"head"),fl.domAPI=d(),fl.insertStyleElement=v(),s()(gl.Z,fl);const vl=gl.Z&&gl.Z.locals?gl.Z.locals:void 0;function _l(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 hl(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(j(e)),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return _l(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)?_l(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.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage;return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d}}var bl=n(4300),yl={};yl.styleTagTransform=h(),yl.setAttributes=g(),yl.insert=p().bind(null,"head"),yl.domAPI=d(),yl.insertStyleElement=v(),s()(bl.Z,yl);const kl=bl.Z&&bl.Z.locals?bl.Z.locals:void 0;function Cl(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 El(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function wl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sl(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){wl(e,t,n[t])}))}return e}function Dl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Ol(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Nl(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 xl(e){return function(e){if(Array.isArray(e))return Cl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Nl(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 Nl(e,t){if(e){if("string"==typeof e)return Cl(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)?Cl(e,t):void 0}}var Il=$();const Tl=function(e){var t,n,o,c,s=e.model,u=e.editMode,d=(0,E.useTranslation)().t,m=(0,r.useSession)(),p=Ol((0,i.useState)(Sl({},s)),2),A=p[0],g=p[1],f=Ol((0,i.useState)([]),2),v=f[0],_=f[1],h=null==m||null===(t=m.user)||void 0===t?void 0:t.uuid,b=Tt(),y=b.types.results,k=b.isLoading,C=Pt({v:P.Default}),w=C.items,S=C.isLoading,D=Ol((0,i.useState)(null),2),O=D[0],x=D[1],N=function(e){var t="".concat(r.restBaseUrl,"/user/").concat(e),n=(0,U.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{data:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(O),I=N.data,T=It({v:P.Default}).isLoading,B=Nt().stockLocations,j=Ol((0,i.useState)([]),2),z=j[0],F=j[1],L=null!==(c=null==w?void 0:w.results)&&void 0!==c?c:[];(0,i.useEffect)((function(){(null==s?void 0:s.userUuid)&&x(s.userUuid)}),[s]);var R,M,q,G=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){El(a,r,o,i,l,"next",e)}function l(e){El(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){return e.preventDefault(),function(e){var t=new AbortController,n=null!=e.uuid,o="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(n?"/"+e.uuid:"");return(0,r.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(e){ae("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),(0,r.showSnackbar)({isLowContrast:!0,title:d("addUserRole","Add User role"),kind:"success",subtitle:d("successfullysaved","You have successfully saved user role scope ")}),Y()}),(function(e){(0,r.showSnackbar)({title:d("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message}),Y()})),[2]}))}));return function(t){return e.apply(this,arguments)}}();return k||T||S?l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."}):l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:kl.section},l().createElement("div",null,(null==w||null===(n=w.results)||void 0===n?void 0:n.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:kl.subTitle},d("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:d("user","User"),items:z.length?z:L,onChange:function(e){var t,n,r,o=["d210eb66-2188-11ed-9dff-507b9dea1806","cca4be4b-2188-11ed-9dff-507b9dea1806","84bdd876-4694-11ed-8109-00155dcc3fc0","a49be648-6b0a-11ed-93a2-806d973f13a9","2083fd40-3391-11ed-a667-507b9dea1806"],a=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return o.includes(e.uuid)})).filter((function(e){return e.uuid!==h}));g(Dl(Sl({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),_(null!=a?a:[]),x(null==e||null===(r=e.selectedItem)||void 0===r?void 0:r.uuid)},shouldFilterItem:function(){return!0},itemToString:function(e){var t,n,r;return"".concat(null!==(r=null!==(n=null==e||null===(t=e.person)||void 0===t?void 0:t.display)&&void 0!==n?n:null==e?void 0:e.display)&&void 0!==r?r:"")},onInputChange:function(e){!function(e){if(e&&""!==e.trim()){var t=L.filter((function(e){return e.uuid!==h})).filter((function(t){var n,r,o;return(null!==(o=null!==(r=null==t||null===(n=t.person)||void 0===n?void 0:n.display)&&void 0!==r?r:null==t?void 0:t.display)&&void 0!==o?o:"").toLowerCase().includes(e.toLowerCase())}));F(t)}}(e)},placeholder:"Filter...",initialSelectedItem:null!==(R=L.find((function(e){return e.uuid===(null==s?void 0:s.userUuid)})))&&void 0!==R?R:null})))),l().createElement("section",{className:kl.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:d("role","Role"),id:"select-role",value:null!==(M=A.role)&&void 0!==M?M:"placeholder-item",onChange:function(e){var t,n,r,o=null==B||null===(t=B.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return!o||0===o.length||!o.some((function(t){return t===e.locationUuid}))})))&&void 0!==r?r:[];g(Dl(Sl({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:d("Choose a role")}),u?l().createElement(a.QlF,{key:null==A?void 0:A.role,value:null==A?void 0:A.role,text:null==A?void 0:A.role}):null===(o=null!==(q=null==I?void 0:I.roles)&&void 0!==q?q:v)||void 0===o?void 0:o.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})}))))),l().createElement("section",{className:kl.section},l().createElement(a.cOn,{className:kl.checkboxGrid},l().createElement(a.XZJ,{onChange:function(){var e=!(null==A?void 0:A.enabled);g(Dl(Sl({},A),{enabled:e}))},checked:null==A?void 0:A.enabled,labelText:d("enabled","Enabled ?"),value:null==s?void 0:s.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(){var e=!(null==A?void 0:A.permanent);g(Dl(Sl({},A),{permanent:e,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==s?void 0:s.permanent,labelText:d("permanent","Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:X(Il),locale:"en",dateFormat:K,onChange:function(e){g(Dl(Sl({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,labelText:d("activeFrom","Active From"),value:X(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:V,labelText:d("activeTo","Active To"),value:X(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:kl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kl.sectionTitle}," ",d("stockOperation","Stock Operations")),l().createElement("div",{className:kl.hr}),l().createElement("span",{className:kl.subTitle},d("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:kl.section},l().createElement(a.cOn,{className:kl.checkboxGrid},(null==y?void 0:y.length)>0&&y.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:(t=e,(null==A||null===(r=A.operationTypes)||void 0===r||null===(n=r.filter((function(e){return e.operationTypeUuid===t.uuid})))||void 0===n?void 0:n.length)>0),className:kl.checkbox,onChange:function(e){return function(e){var t,n=null==A||null===(t=A.operationTypes)||void 0===t?void 0:t.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(n){var r=xl(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==n?void 0:n.operationTypeUuid)})));g(Dl(Sl({},A),{operationTypes:r}))}else{var o,a=null==y?void 0:y.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),i={operationTypeName:null==a?void 0:a.name,operationTypeUuid:null==a?void 0:a.uuid};g(Dl(Sl({},A),{operationTypes:xl(null!==(o=null==A?void 0:A.operationTypes)&&void 0!==o?o:[]).concat([i])}))}}(e)},labelText:e.name,id:e.uuid}));var t,n,r})))),l().createElement("br",null),l().createElement("section",{className:kl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kl.sectionTitle}," ",d("Locations")),l().createElement("div",{className:kl.hr}),l().createElement("span",{className:kl.subTitle},d("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:kl.section},l().createElement(a.cOn,{className:kl.checkboxGrid},(null==B?void 0:B.length)>0&&B.map((function(e){var t,n,r,o=(t=e,(r=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return e.locationUuid===t.id})))&&r.length>0?r[0]:null);return l().createElement("div",{style:{display:"flex",flexDirection:"row",margin:"4px",padding:"5px"}},l().createElement(a.XZJ,{name:"location",key:"chk-loc-child-key-".concat(e.id),id:"chk-loc-child-".concat(e.id),value:e.id,onChange:function(e){return function(e){var t,n=null==A||null===(t=A.locations)||void 0===t?void 0:t.find((function(t){var n;return t.locationUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(n){var r,o,a=xl(null!==(o=null==A||null===(r=A.locations)||void 0===r?void 0:r.filter((function(e){return e.locationUuid!==(null==n?void 0:n.locationUuid)})))&&void 0!==o?o:[]);g(Dl(Sl({},A),{locations:a}))}else{var i,l=null==B?void 0:B.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={locationName:null==l?void 0:l.name,locationUuid:null==l?void 0:l.id,enableDescendants:!1},s=xl(null!==(i=null==A?void 0:A.locations)&&void 0!==i?i:[]).concat([c]);g(Dl(Sl({},A),{locations:s}))}}(e)},className:kl.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:kl.toggle,size:"sm",onToggleClick:function(e){var t=(null==o?void 0:o.locationUuid)===e?o:null;return!0===(null==t?void 0:t.enableDescendants)}(e.id),key:"tg-loc-child-key-".concat(e.id),id:"tg-loc-child-".concat(e.id)}))}))))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Y},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:G},d("save","Save")))))},Bl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Z("Add Stock User Role Scope",l().createElement(Tl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function Pl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ul=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Z("Edit Stock User Role",l().createElement(Tl,{model:t,editMode:!0}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:r,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(At.I8,function(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){Pl(e,t,n[t])}))}return e}({size:16},e))}})};function jl(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 zl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fl=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return jl(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)?jl(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.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-user-scope-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/userrolescope/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){ae("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),d(!1),(0,r.showSnackbar)({isLowContrast:!0,title:c("deletingstockUserScope","Delete Stock User Scope"),kind:"success",subtitle:c("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,r.showSnackbar)({title:c("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteUserScope","Delete Stock User Scope"),renderIcon:function(e){return l().createElement(ue.ZN,function(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){zl(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Ll(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rl(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){Ll(e,t,n[t])}))}return e}function Ml(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ql=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/userrolescope"))},o=hl({v:P.Default,totalCount:!0}),c=o.items,s=o.totalItems,u=o.currentPage,d=o.pageSizes,m=o.goTo,p=o.currentPageSize,A=o.setPageSize,g=o.isLoading,f=(0,i.useMemo)((function(){return[{id:0,header:e("user","User"),key:"user"},{id:1,header:e("role","Role"),key:"role"},{id:2,header:e("location","Location(s)"),key:"locations"},{id:3,header:e("stockOperations","Stock Operations"),key:"stockOperations"},{id:4,header:e("permanent","Permanent ?"),key:"permanent"},{id:5,header:e("ActiveFrom","Active From "),key:"activeFrom"},{id:6,header:e("activeTo","Active To"),key:"activeTo"},{id:7,header:e("enabled","Enabled ?"),key:"enabled"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),v=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(n,r){var o,i,s,u,d,m,p=t.user.uuid===n.userUuid;return Ml(Rl({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),uuid:"".concat(null==n?void 0:n.uuid),user:t.user.uuid===n.userUuid?"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName):l().createElement(a.rUS,{to:(m=null==n?void 0:n.uuid,"".concat("/user-role-scopes","/").concat(m))},"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName)),roleName:null==n?void 0:n.role,locations:null==n||null===(o=n.locations)||void 0===o?void 0:o.map((function(e){var t="loc-".concat(null==n?void 0:n.uuid,"-").concat(e.locationUuid);return l().createElement("span",{key:t},null==e?void 0:e.locationName,(null==e?void 0:e.enableDescendants)?l().createElement(se.l2,{key:"".concat(t,"-").concat(r,"-0")}):l().createElement(se.Xd,{key:"".concat(t,"-").concat(r,"-1")})," ")})),stockOperations:null==n||null===(s=n.operationTypes)||void 0===s||null===(i=s.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===i?void 0:i.join(", "),permanent:(null==n?void 0:n.permanent)?e("yes","Yes"):e("no","No"),activeFrom:null!==(u=W(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=W(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("yes","Yes"):e("no","No"),actions:l().createElement("div",{style:{display:"flex"}},!p&&l().createElement(l().Fragment,null,l().createElement(Ul,{data:c[r]}),l().createElement(Fl,{uuid:c[r].uuid})))})}))}),[t.user.uuid,c,e]);return g?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:vl.tableOverride},l().createElement(a.x45,null,e("panelDescription","To access stock management features, users must have assigned roles specifying location and stock operation type scopes.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:null!=v?v:[],headers:f,isSortable:!0,useZebraStyles:!0,render:function(t){var o=t.rows,i=t.headers,c=t.getHeaderProps,s=t.getTableProps,u=t.getRowProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:vl.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Bl,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ml(Rl({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?vl.desktopHeader:vl.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Rl({className:r.isDesktop?vl.desktopRow:vl.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===o.length?l().createElement("div",{className:vl.tileContainer},l().createElement(a.n9L,{className:vl.tile},l().createElement("div",{className:vl.tileContent},l().createElement("p",{className:vl.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:vl.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:p,pageSizes:d,totalItems:s,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==u&&m(n)},className:vl.paginationOverride}))};function Gl(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}var Hl=n(8098),Zl={};Zl.styleTagTransform=h(),Zl.setAttributes=g(),Zl.insert=p().bind(null,"head"),Zl.domAPI=d(),Zl.insertStyleElement=v(),s()(Hl.Z,Zl);const Yl=Hl.Z&&Hl.Z.locals?Hl.Z.locals:void 0;function Ql(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 Jl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wl(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){Jl(e,t,n[t])}))}return e}function Vl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Kl=function(e){var t,n,o,c=e.model,s=(0,E.useTranslation)().t,u=Ut((0,r.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(Wl({},c)),o=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(n,o)||function(e,t){if(e){if("string"==typeof e)return Ql(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)?Ql(e,t):void 0}}(n,o)||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.")}()),m=d[0],p=d[1],A=(0,i.useCallback)((function(e){e.preventDefault(),c&&(m.uuid=c.uuid),function(e){var t,n,o,a=null!=e.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(a?"/"+e.uuid:""),l=new AbortController;return(0,r.openmrsFetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},signal:l.signal,body:(n=ca({},e),o={sourceType:null==e||null===(t=e.sourceType)||void 0===t?void 0:t.uuid},o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n)})}(m).then((function(){(0,r.showSnackbar)({isLowContrast:!0,title:s("addedSource","Add Source"),kind:"success",subtitle:s("stocksourceaddedsuccessfully","Stock Source Added Successfully"),timeoutInMs:5e3}),ae("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),Y()}),(function(e){(0,r.showSnackbar)({title:s("errorAddingSource', 'error adding a source"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch()}),[m,c,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:A},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:Yl.section},l().createElement(a.oil,{id:"fullname",type:"text",labelText:s("fullName","Full Name"),size:"md",onChange:function(e){c&&(c.name=e.target.value),p(Vl(Wl({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:Yl.section},l().createElement(a.oil,{id:"acronym",type:"text",size:"md",placeholder:"e.g NMS",onChange:function(e){c&&(c.acronym=e.target.value),p(Vl(Wl({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:Yl.section},l().createElement(a.PhF,{name:"sourceType",className:"select-field",labelText:s("sourceType","Source Type"),id:"sourceType",value:(null==m?void 0:m.sourceType)?m.sourceType.uuid:"",onChange:function(e){var t=null==u?void 0:u.answers.find((function(t){return t.uuid===e.target.value}));p(Vl(Wl({},m),{sourceType:t}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseSourceType","Choose a source type")}),null==u||null===(t=u.answers)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Y},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},Xl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Z("Add Stock Source",l().createElement(Kl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var $l=n(5551),ec={};ec.styleTagTransform=h(),ec.setAttributes=g(),ec.insert=p().bind(null,"head"),ec.domAPI=d(),ec.insertStyleElement=v(),s()($l.Z,ec);const tc=$l.Z&&$l.Z.locals?$l.Z.locals:void 0;function nc(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 rc=function(e){var t,n=e.onFilterChange,o=Ut((0,r.useConfig)().stockSourceTypeUUID),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:tc.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return nc(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return nc(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)?nc(e,t):void 0}}(t)||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.")}()),initialSelectedItem:i.answers[0],itemToString:function(e){return e?e.display:"Not Set"},titleText:"Filter: ",type:"inline",size:"sm",onChange:function(e){var t=e.selectedItem;return n(null==t?void 0:t.display)}})))};var oc=n(6940),ac={};ac.styleTagTransform=h(),ac.setAttributes=g(),ac.insert=p().bind(null,"head"),ac.domAPI=d(),ac.insertStyleElement=v(),s()(oc.Z,ac);const ic=oc.Z&&oc.Z.locals?oc.Z.locals:void 0;function lc(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 cc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sc=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return lc(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)?lc(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.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/stocksource/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){d(!1),ae("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),(0,r.showSnackbar)({isLowContrast:!0,title:c("deletingSource","Delete Source"),kind:"success",subtitle:c("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,r.showSnackbar)({title:c("errorDeletingSource', 'error deleting a source"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteSource","Delete Source"),renderIcon:function(e){return l().createElement(ue.ZN,function(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){cc(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function uc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dc=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Z("Edit Stock Source",l().createElement(Kl,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(At.I8,function(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){uc(e,t,n[t])}))}return e}({size:16},e))}})};function mc(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 pc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ac(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){pc(e,t,n[t])}))}return e}function gc(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const fc=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=l().useState(""),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mc(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)?mc(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.")}()),c=o[0],s=o[1],u=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stocksource"))},d=function(e){var t=sa(e),n=t.items,o=t.isLoading,a=t.isError,l=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gl(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)?Gl(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.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n.results,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,i.useMemo)((function(){return[{id:1,header:"Name",key:"name"},{id:2,header:"Acronym",key:"acronym"},{id:3,header:"Source Type",key:"sourceType"},{id:4,header:"actions",key:"actions"}]}),[]);return{items:m,totalItems:null==n?void 0:n.totalCount,currentPage:p,currentPageSize:c,paginatedItems:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:o,isError:a,setPageSize:s,tableHeaders:A}}({v:P.Default,totalCount:!0}),m=d.items,p=d.totalItems,A=d.tableHeaders,g=d.currentPage,f=d.pageSizes,v=d.goTo,_=d.currentPageSize,h=d.setPageSize,b=d.isLoading,y=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n;return gc(Ac({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:null==e?void 0:e.uuid,name:null==e?void 0:e.name,acronym:null==e?void 0:e.acronym,sourceType:null==e||null===(n=e.sourceType)||void 0===n?void 0:n.display,actions:l().createElement(l().Fragment,null,l().createElement(dc,{data:m[t]}),l().createElement(sc,{uuid:m[t].uuid}))})}))}),[m]),k=function(e){s(e)},C=(0,i.useMemo)((function(){return c?y.filter((function(e){return e.sourceType===c})):y}),[y,c]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:ic.tableOverride},l().createElement(a.x45,null,n("panelDescription","List of partners who provide stock to the facility.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:C,headers:A,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,c=e.getTableProps,s=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:ic.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(rc,{onFilterChange:k})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(Xl,null))),l().createElement(a.iA_,c(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,o.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,gc(Ac({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?ic.desktopHeader:ic.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ac({className:r.isDesktop?ic.desktopRow:ic.tabletRow},s({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:ic.tileContainer},l().createElement(a.n9L,{className:ic.tile},l().createElement("div",{className:ic.tileContent},l().createElement("p",{className:ic.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:ic.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:g,pageSize:_,pageSizes:f,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==_&&h(t),n!==g&&v(n)},className:ic.paginationOverride}))};function vc(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 _c(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function hc(){return hc=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){_c(a,r,o,i,l,"next",e)}function l(e){_c(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(a){switch(a.label){case 0:t=e.locationPayload,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/location/"),{method:"POST",headers:{"Content-Type":"application/json"},body:t})];case 2:return[2,a.sent()];case 3:return n=a.sent(),o=oe(n),(0,r.showSnackbar)({subtitle:o.join(", "),title:"Error on saving form",kind:"error",isLowContrast:!0}),[3,4];case 4:return[2]}}))})),hc.apply(this,arguments)}var bc=n(2761),yc={};yc.styleTagTransform=h(),yc.setAttributes=g(),yc.insert=p().bind(null,"head"),yc.domAPI=d(),yc.insertStyleElement=v(),s()(bc.Z,yc);const kc=bc.Z&&bc.Z.locals?bc.Z.locals:void 0;function Cc(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 Ec(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wc(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){Ec(e,t,n[t])}))}return e}function Sc(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cc(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)?Cc(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.")}()}var Dc=on.z.object({name:on.z.string().max(255)});const Oc=function(e){var t,n,o,c,s,u,d,m=e.showModal,p=e.onModalChange,A=e.handleCreateQuestion,g=e.headerTitle,f=e.initialData,v=(0,E.useTranslation)().t,_=Sc((0,i.useState)(!1),2),h=_[0],b=_[1],y=Sc((0,i.useState)(""),2),k=y[0],C=y[1],w=(o="".concat(r.restBaseUrl,"/locationtag/"),s=(c=(0,U.ZP)(o,r.openmrsFetch)).data,u=c.isLoading,d=c.mutate,{locationTagList:(null==s||null===(t=s.data)||void 0===t?void 0:t.results)?null==s||null===(n=s.data)||void 0===n?void 0:n.results:[],loading:u,mutate:d}).locationTagList,S=(0,nn.cI)({mode:"all",resolver:(0,rn.F)(Dc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),D=S.handleSubmit,O=S.control,x=S.getValues,N=S.formState.isDirty;return l().createElement(a.lpG,{open:m,onClose:function(){return p(!1)},preventCloseOnClickOutside:!0,size:"md"},l().createElement(a.xBx,{title:g}),l().createElement("form",{onSubmit:D((function(e){var t,n,r,o=x(),a=null!==(r=null==o||null===(n=o.tags)||void 0===n||null===(t=n.selectedItems)||void 0===t?void 0:t.map((function(e){return e.uuid})))&&void 0!==r?r:[],i={name:o.name,tags:a};Dc.safeParse(e).success&&(b(!1),A(i))}),(function(e){C(Object.entries(e)[0][1].message),b(!0)}))},l().createElement(a.fef,{hasScrollingContent:!0},l().createElement(a.Kqy,{gap:3},l().createElement(a.cwH,{legendText:""},l().createElement(nn.Qr,{name:"name",control:O,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,wc({id:"location",labelText:v("location","Location Name"),placeholder:v("locationPlaceholder","Add a location"),invalidText:null===(t=r.error)||void 0===t?void 0:t.message},n)))}}),l().createElement("div",{className:kc.loaderContainer},l().createElement(nn.Qr,{name:"tags",control:O,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=wc({id:"tag",titleText:"Select tag(s)",helperText:"This is helper text",items:null!=w?w:[]},r),n={itemToString:function(e){return e?e.display:""},selectionFeedback:"top-after-reopen"},n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}}))),h&&l().createElement(a.K0D,{lowContrast:!0,title:v("error","Error"),style:{minWidth:"100%",margin:"0rem",padding:"0rem"},role:"alert",kind:"error",subtitle:v("pleaseFillField",k)+".",onClose:function(){return b(!1)}}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{onClick:function(){return p(!1)},kind:"secondary"},v("cancel","Cancel")),l().createElement(a.zxk,{disabled:!N,type:"submit"},l().createElement("span",null,v("save","Save"))))))},xc=function(e){var t=e.showModal,n=e.onModalChange,o=e.mutate,a=(0,E.useTranslation)().t,c=a("addLocation","Create new Location"),s=(0,i.useCallback)((function(e){var t=e.name,i=e.tags;(function(e){return hc.apply(this,arguments)})({locationPayload:{name:t,tags:i}}).then((function(){(0,r.showSnackbar)({title:a("formCreated","Add Location"),kind:"success",isLowContrast:!0,subtitle:a("Location ".concat(t," was created successfully."))}),o(),n(!1)})).catch((function(e){(0,r.showSnackbar)({title:a("errorCreatingForm","Error creating location"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message}),n(!1)})),n(!1)}),[n,o,a]);return l().createElement(l().Fragment,null,l().createElement(Oc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};function Nc(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 Ic(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tc=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(!1),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nc(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)?Nc(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.")}()),c=o[0],s=o[1],u=function(e){var t=Nt(),n=t.stockLocations,o=t.error,a=t.isLoading,l=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vc(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)?vc(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.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,E.useTranslation)().t,g=(0,i.useMemo)((function(){return[{id:0,header:A("name","Name"),key:"name"},{id:1,header:A("tags","Tags"),key:"tags"},{id:2,header:A("childLocations","Child Locations"),key:"childLocations"},{id:3,header:A("actions","Actions"),key:"actions"}]}),[A]),f=(0,i.useMemo)((function(){return n.map((function(e){var t,n,r,o,a,i;return{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),name:"".concat(null==e?void 0:e.name),tags:null!==(a=null==e||null===(n=e.meta.tag)||void 0===n||null===(t=n.filter((function(e){return"SUBSETTED"!==e.code})).map((function(e){return e.code})))||void 0===t?void 0:t.join(", "))&&void 0!==a?a:"",childLocations:null!==(i=null==e||null===(o=e.childLocations)||void 0===o||null===(r=o.map((function(e){return e.display})))||void 0===r?void 0:r.join(", "))&&void 0!==i?i:""}}))}),[n]);return{items:n,currentPage:p,currentPageSize:c,paginatedQueueEntries:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:a,error:o,setPageSize:s,tableHeaders:g,tableRows:f}}(P.Full),d=u.tableHeaders,m=u.tableRows,p=u.items,A=u.isLoading,g=function(){ae("".concat(r.restBaseUrl,"/Location?_summary=data"))};return A?l().createElement(a.gqd,{role:"progressbar"}):(null==p?void 0:p.length)?l().createElement(yi,{columns:d,data:m},(function(e){var t=e.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:t}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:g},"Refresh")),c?l().createElement(xc,{onModalChange:s,showModal:c,mutate:U.JG}):null,l().createElement(a.zxk,{kind:"ghost",renderIcon:function(e){return l().createElement(se.mm,function(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){Ic(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("p",{className:Ct.content},"No stock items to display")))};var Bc=n(557),Pc={};Pc.styleTagTransform=h(),Pc.setAttributes=g(),Pc.insert=p().bind(null,"head"),Pc.domAPI=d(),Pc.insertStyleElement=v(),s()(Bc.Z,Pc);const Uc=Bc.Z&&Bc.Z.locals?Bc.Z.locals:void 0;function jc(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}var zc,Fc=on.z.object({startDate:on.z.coerce.date().optional(),endDate:on.z.coerce.date().optional(),location:on.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:on.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:on.z.string().optional(),mostLeastMoving:on.z.string().optional(),mostLeastMovingName:on.z.string().optional(),stockItemUuid:on.z.string().optional(),stockItemName:on.z.string().optional(),patientUuid:on.z.string().optional(),patientName:on.z.string().optional(),locationUuid:on.z.string().optional(),childLocations:on.z.boolean().optional(),stockSourceUuid:on.z.string().optional(),stockSource:on.z.string().optional(),stockSourceDestinationUuid:on.z.string().optional(),stockSourceDestination:on.z.string().optional(),inventoryGroupBy:on.z.string().optional(),stockItemCategory:on.z.string().optional(),inventoryGroupByName:on.z.string().optional(),stockItemCategoryConceptUuid:on.z.string().optional(),reportSystemName:on.z.string().optional(),maxReorderLevelRatio:on.z.number().optional(),fullFillment:on.z.string().array().optional(),limit:on.z.string().optional(),date:on.z.coerce.date().optional()}).superRefine((function(e,t){"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName&&(e.startDate||t.addIssue({code:on.z.ZodIssueCode.custom,message:"Start Date is required ",path:["startDate"]}),e.endDate||t.addIssue({code:on.z.ZodIssueCode.custom,message:"End Date is required",path:["endDate"]})),"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName||(e.date||t.addIssue({code:on.z.ZodIssueCode.custom,message:"Date is required ",path:["date"]}),e.inventoryGroupBy||t.addIssue({code:on.z.ZodIssueCode.custom,message:"Inventory by is required ",path:["inventoryGroupBy"]}))}));function Lc(e){var t="".concat(r.restBaseUrl,"/stockmanagement/batchjob"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Date="Date",e.StartDate="StartDate",e.EndDate="EndDate",e.StockItemCategory="StockItemCategory",e.Location="Location",e.ChildLocations="ChildLocations",e.StockSource="StockSource",e.StockSourceDestination="StockSourceDestination",e.InventoryGroupBy="InventoryGroupBy",e.MaxReorderLevelRatio="MaxReorderLevelRatio",e.Patient="Patient",e.StockItem="StockItem",e.Limit="Limit",e.MostLeastMoving="MostLeastMoving",e.Fullfillment="Fullfillment"}(zc||(zc={}));var Rc=function(e){return Mc(e)?4:e?20:null},Mc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},qc="Completed";function Gc(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 Hc(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Zc(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Qc(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 Yc(e){return function(e){if(Array.isArray(e))return Gc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Qc(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 Qc(e,t){if(e){if("string"==typeof e)return Gc(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)?Gc(e,t):void 0}}const Jc=function(e){var t,n,o,c,s,u=e.model,d=(0,E.useTranslation)().t,m=(0,r.useConfig)().stockItemCategoryUUID,p=function(){var e,t,n="".concat(r.restBaseUrl,"/stockmanagement/report?v=default"),o=(0,U.ZP)(n,r.openmrsFetch),a=o.data,i=o.error,l=o.isLoading;return{reportTypes:null!==(t=null==a||null===(e=a.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[],isLoading:l,isError:i}}(),A=p.reportTypes,g=p.isLoading,f=Nt().stockLocations,v=Ut(m),_=v.items,h=(v.isLoading,Zc((0,i.useState)(!1),2)),b=h[0],y=h[1],k=Zc((0,i.useState)(!1),2),C=k[0],w=k[1],S=Zc((0,i.useState)(!1),2),D=S[0],O=S[1],x=Zc((0,i.useState)(!1),2),N=x[0],I=x[1],T=Zc((0,i.useState)(!1),2),B=T[0],P=T[1],j=Zc((0,i.useState)(!1),2),z=j[0],F=j[1],L=Zc((0,i.useState)(!1),2),R=L[0],M=L[1],q=Zc((0,i.useState)(!1),2),G=q[0],H=q[1],Z=Zc((0,i.useState)(!1),2),Q=Z[0],J=Z[1],ee=Zc((0,i.useState)(!1),2),te=ee[0],ne=ee[1],re=Zc((0,i.useState)(!1),2),oe=re[0],ae=re[1],ie=Zc((0,i.useState)(!1),2),le=ie[0],ce=ie[1],se=Zc((0,i.useState)(!1),2),ue=se[0],de=se[1],me=Zc((0,i.useState)(!1),2),pe=me[0],Ae=me[1],ge=Zc((0,i.useState)(!1),2),fe=ge[0],ve=ge[1],_e=Zc((0,i.useState)(""),2),he=_e[0],be=_e[1];(0,i.useEffect)((function(){var e=!1;if(he){var t,n,r,o,a,i,l,c,s,u,d,m,p,g,f,v=null==A?void 0:A.find((function(e){return e.name===he}));v&&(y(null===(t=v.parameters)||void 0===t?void 0:t.some((function(e){return e===zc.Date}))),w(null===(n=v.parameters)||void 0===n?void 0:n.some((function(e){return e===zc.StartDate}))),O(null===(r=v.parameters)||void 0===r?void 0:r.some((function(e){return e===zc.EndDate}))),I(null===(o=v.parameters)||void 0===o?void 0:o.some((function(e){return e===zc.StockItemCategory}))),P(null===(a=v.parameters)||void 0===a?void 0:a.some((function(e){return e===zc.Location}))),F(null===(i=v.parameters)||void 0===i?void 0:i.some((function(e){return e===zc.ChildLocations}))),M(null===(l=v.parameters)||void 0===l?void 0:l.some((function(e){return e===zc.StockSource}))),H(null===(c=v.parameters)||void 0===c?void 0:c.some((function(e){return e===zc.StockSourceDestination}))),J(null===(s=v.parameters)||void 0===s?void 0:s.some((function(e){return e===zc.InventoryGroupBy}))),ne(null===(u=v.parameters)||void 0===u?void 0:u.some((function(e){return e===zc.MaxReorderLevelRatio}))),ce(null===(d=v.parameters)||void 0===d?void 0:d.some((function(e){return e===zc.StockItem}))),ae(null===(m=v.parameters)||void 0===m?void 0:m.some((function(e){return e===zc.Patient}))),de(null===(p=v.parameters)||void 0===p?void 0:p.some((function(e){return e===zc.Limit}))),Ae(null===(g=v.parameters)||void 0===g?void 0:g.some((function(e){return e===zc.MostLeastMoving}))),ve(null===(f=v.parameters)||void 0===f?void 0:f.some((function(e){return e===zc.Fullfillment}))),e=!0)}e||(y(!1),w(!1),O(!1),I(!1),P(!1),F(!1),M(!1),H(!1),J(!1),ne(!1),ce(!1),ae(!1),de(!1),Ae(!1),ve(!1))}),[he,A]);var ye=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Yc(null!==(t=_&&(null==_||null===(e=_.answers)||void 0===e?void 0:e.length)>0?null==_?void 0:_.answers:null==_?void 0:_.setMembers)&&void 0!==t?t:[]))}),[_]),ke=(0,nn.cI)({mode:"all",resolver:(0,rn.F)(Fc)}),Ce=ke.handleSubmit,Ee=ke.control,we=ke.formState,Se=we.errors,De=(we.defaultValues,we.isDirty,ke.setValue);if(g)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Oe=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Hc(a,r,o,i,l,"next",e)}function l(e){Hc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o,a,i,l,c,s,u,m,p,g,f,v,_,h,y,k,E,w,S,O,x,I,T,P,U,j,F,L,M,q,H,Z,J,V,K,X;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function($){switch($.label){case 0:n=null===(t=A.find((function(t){return t.name===e.reportName})))||void 0===t?void 0:t.systemName,$.label=1;case 1:return $.trys.push([1,,3,4]),o="\r\n",a="param.report=".concat(n).concat(o),fe&&(a+=xe(zc.Fullfillment,(null!==(i=e.fullFillment)&&void 0!==i?i:["All"]).join(","),(null!==(l=e.fullFillment)&&void 0!==l?l:["All"]).join(", "),d("stockmanagement.report.edit.fullfillment"),o)),oe&&(a+=xe(zc.Patient,null!==(s=e.patientUuid)&&void 0!==s?s:"",null!==(u=null===(c=e.patientName)||void 0===c?void 0:c.trim())&&void 0!==u?u:"All Patients",d("Patients"),o)),le&&(a+=xe(zc.StockItem,null!==(p=e.stockItemUuid)&&void 0!==p?p:"",null!==(g=null===(m=e.stockItemName)||void 0===m?void 0:m.trim())&&void 0!==g?g:"All Stock Items",d("Stock Item"),o)),N&&(a+=xe(zc.StockItemCategory,null!==(v=e.stockItemCategoryConceptUuid)&&void 0!==v?v:"",null!==(_=null===(f=e.stockItemCategory)||void 0===f?void 0:f.trim())&&void 0!==_?_:"All Categories",d("Stock Item Category"),o)),Q&&(a+=xe(zc.InventoryGroupBy,null!==(y=e.inventoryGroupBy)&&void 0!==y?y:"LocationStockItemBatchNo",null!==(k=null===(h=e.inventoryGroupByName)||void 0===h?void 0:h.trim())&&void 0!==k?k:"Stock Item Batch Number",d("stockmanagement.report.edit.inventorygroupby"),o)),B&&(a+=xe(zc.Location,e.location,null!==(w=null===(E=e.location)||void 0===E?void 0:E.trim())&&void 0!==w?w:"",d("Location"),o),z&&(a+=xe(zc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",d("Include Child Locations"),o))),te&&(a+=xe(zc.MaxReorderLevelRatio,(null!==(S=e.maxReorderLevelRatio)&&void 0!==S?S:0).toString(),(null!==(O=e.maxReorderLevelRatio)&&void 0!==O?O:0).toString()+"%",d("stockmanagement.report.edit.maxreorderlevelratio"),o)),R&&(a+=xe(zc.StockSource,null!==(I=e.stockSourceUuid)&&void 0!==I?I:"",null!==(T=null===(x=e.stockSource)||void 0===x?void 0:x.trim())&&void 0!==T?T:"All Sources",d("stockmanagement.report.edit.stocksource"),o)),G&&(a+=xe(zc.StockSourceDestination,null!==(U=e.stockSourceDestinationUuid)&&void 0!==U?U:"",null!==(j=null===(P=e.stockSourceDestination)||void 0===P?void 0:P.trim())&&void 0!==j?j:"All Destinations",d("stockmanagement.report.edit.stocksourcedestination"),o)),pe&&(a+=xe(zc.MostLeastMoving,null!==(L=e.mostLeastMoving)&&void 0!==L?L:"MostMoving",null!==(M=null===(F=e.mostLeastMovingName)||void 0===F?void 0:F.trim())&&void 0!==M?M:"Most Moving",d("stockmanagement.report.edit.mostleastmoving"),o)),ue&&(a+=xe(zc.Limit,(null!==(H=null!==(q=e.limit)&&void 0!==q?q:Rc(e.reportSystemName))&&void 0!==H?H:20).toString(),(null!==(J=null!==(Z=e.limit)&&void 0!==Z?Z:Rc(e.reportSystemName))&&void 0!==J?J:20).toString(),d(function(e){return Mc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),o)),b&&(a+=xe(zc.Date,e.date?JSON.stringify(e.date).replaceAll('"',""):"",null!==(V=W(e.date))&&void 0!==V?V:"",d("stockmanagement.report.edit.date"),o)),C&&(a+=xe(zc.StartDate,e.startDate?JSON.stringify(e.startDate).replaceAll('"',""):"",null!==(K=W(e.startDate))&&void 0!==K?K:"",d(function(e){return Mc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),o)),D&&(a+=xe(zc.EndDate,e.endDate?JSON.stringify(e.endDate).replaceAll('"',""):"",null!==(X=W(e.endDate))&&void 0!==X?X:"",d(function(e){return Mc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),o)),[4,Lc({batchJobType:"Report",description:e.reportName,parameters:a}).then((function(e){Y(),201===e.status?(0,r.showSnackbar)({title:d("batchJob","Batch Job"),subtitle:d("BatchJobSuccess","Batch job created successfully"),kind:"success"}):(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})})).catch((function(e){(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})}))];case 2:return $.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),xe=function(e,t,n,r,o){return"param.".concat(e,".value=").concat(t).concat(o,"param.").concat(e,".value.desc=").concat(n).concat(o,"param.").concat(e,".description=").concat(r).concat(o)};return l().createElement(a.l09,{onSubmit:Ce(Oe,(function(e){console.error(e)}))},l().createElement("div",{className:Uc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,d("reportName","Report")),l().createElement(nn.Qr,{control:Ee,name:"reportName",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"report",size:"md",labelText:d("reportName","Report"),items:A,itemToString:function(e){var t,n;return"".concat(null!==(n=null!==(t=null==e?void 0:e.name)&&void 0!==t?t:null==e?void 0:e.name)&&void 0!==n?n:"")},placeholder:"Filter...",onChange:function(e){var n,r=e.selectedItem;t(r.name),n=r.name,be(n)}})}})),N&&l().createElement(l().Fragment,null,l().createElement("span",null,d("stockItemCategory","Stock Item Category")),l().createElement(nn.Qr,{control:Ee,name:"stockReportItemCategory",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"stockReportItem",size:"md",labelText:d("stockItemCategory","Stock Item Category"),items:ye,onChange:function(e){var n=e.selectedItem;t(n.uuid)},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},placeholder:"Filter..."})}})),C&&l().createElement(nn.Qr,{control:Ee,name:"startDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:o,value:i},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:V,labelText:d("startDate","Start Date"),defaultValue:"",invalid:null==Se||null===(t=Se.startDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.startDate)||void 0===n?void 0:n.message}))}}),D&&l().createElement(nn.Qr,{control:Ee,name:"endDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:o,value:i},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:V,labelText:d("endDate","End Date"),defaultValue:"",invalid:null==Se||null===(t=Se.endDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.endDate)||void 0===n?void 0:n.message}))}}),Q&&l().createElement(a.PhF,{id:"inventoryGroupBy",defaultValue:null==u?void 0:u.inventoryGroupBy,invalid:null==Se||null===(t=Se.inventoryGroupBy)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.inventoryGroupBy)||void 0===n?void 0:n.message,labelText:d("inventoryBy","Inventory by"),onChange:function(e){return De("inventoryGroupBy",e.target.value)}},l().createElement(a.QlF,{value:"",text:d("SelectOption","Select an option")}),l().createElement(a.QlF,{value:"StockItemOnly",text:d("stockItem","Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItem",text:d("lcationstockitem","Location and Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItemBatchNo",text:d("locationBatchno","Location and Batch")})),B&&l().createElement(a.PhF,{name:"location",className:"select-field",labelText:d("location","Location"),id:"location",onChange:function(e){return De("location",e.target.value)},defaultValue:"",invalid:null==Se||null===(o=Se.location)||void 0===o?void 0:o.message,invalidText:null==Se||null===(c=Se.location)||void 0===c?void 0:c.message},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:d("Choose a location")}),null===(s=null!=f?f:[])||void 0===s?void 0:s.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})}))),z&&l().createElement(nn.Qr,{control:Ee,name:"childLocations",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.XZJ,{id:"childLocations",onChange:n,value:r,labelText:d("IncludeChildLocations","Include Child Locations")})}}),pe&&l().createElement(nn.Qr,{control:Ee,name:"mostLeastMoving",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.SYO,{name:"mostLeastMoving",legendText:d("rank","Rank"),onChange:n,value:r},l().createElement(a.EUY,{value:"MostMoving",id:"mostLeastMovingMost",labelText:d("mostMoving","Most Moving")}),l().createElement(a.EUY,{value:"LeastMoving",id:"mostLeastMovingLeast",labelText:d("LeastMoving","Least Moving")}))}}),ue&&l().createElement(nn.Qr,{control:Ee,name:"limit",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.Y2U,{id:"limitTop",allowEmpty:!0,value:r,onchange:n,label:d("limit","Limit"),defaultValue:20})}}),fe&&l().createElement("div",{style:{display:"flex",flexDirection:"row",gap:"0 1rem"}},l().createElement(nn.Qr,{control:Ee,name:"fullFillment",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(l().Fragment,null,l().createElement(a.XZJ,{id:"allFulfillment",checked:null==r?void 0:r.includes("All"),onChange:function(e){var t=e.target.checked;n(t?["All"]:r.filter((function(e){return"All"!==e})))},labelText:d("all","All")}),l().createElement(a.XZJ,{id:"fullFulfillment",checked:null==r?void 0:r.includes("Full"),onChange:function(e){var t=e.target.checked;n(t?Yc(r.filter((function(e){return"All"!==e}))).concat(["Full"]):r.filter((function(e){return"Full"!==e})))},labelText:d("fullFulfillment","Full Fulfillment")}),l().createElement(a.XZJ,{id:"partialFulfillment",checked:null==r?void 0:r.includes("Partial"),onChange:function(e){var t=e.target.checked;n(t?Yc(r.filter((function(e){return"All"!==e}))).concat(["Partial"]):r.filter((function(e){return"Partial"!==e})))},labelText:d("partialFulfillment","Partial Fulfillment")}),l().createElement(a.XZJ,{id:"noneFulfillment",checked:null==r?void 0:r.includes("None"),onChange:function(e){var t=e.target.checked;n(t?Yc(r.filter((function(e){return"All"!==e}))).concat(["None"]):r.filter((function(e){return"None"!==e})))},labelText:d("noneFulfillment","Non Fulfillment")}))}})),b&&l().createElement(nn.Qr,{control:Ee,name:"date",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:o,value:i},l().createElement(a.aj6,{id:"date",name:"date",placeholder:V,labelText:d("date","Date"),defaultValue:"",invalid:null==Se||null===(t=Se.date)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.date)||void 0===n?void 0:n.message}))}})),l().createElement("div",{className:Uc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Y},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},d("continue","Continue"))))},Wc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Z("New Report",l().createElement(Jc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var Vc=n(5861),Kc={};Kc.styleTagTransform=h(),Kc.setAttributes=g(),Kc.insert=p().bind(null,"head"),Kc.domAPI=d(),Kc.insertStyleElement=v(),s()(Vc.Z,Kc);const Xc=Vc.Z&&Vc.Z.locals?Vc.Z.locals:void 0;var $c=n(6811),es=n(3570),ts=n(7149),ns={};ns.styleTagTransform=h(),ns.setAttributes=g(),ns.insert=p().bind(null,"head"),ns.domAPI=d(),ns.insertStyleElement=v(),s()(ts.Z,ns);const rs=ts.Z&&ts.Z.locals?ts.Z.locals:void 0;var os=function(e){var t=e.title,n=e.description,r=(0,E.useTranslation)().t;return l().createElement("div",{className:rs.tileContainer},l().createElement(a.n9L,{className:rs.tile},l().createElement("div",{className:rs.tileContent},l().createElement(At.As,{size:"24"}),l().createElement("p",{className:rs.content},r("noPrivilagesTitle","".concat(t))),n&&l().createElement("p",{className:rs.helper},r("noViewPrivilegesDescription","".concat(n))))))};function as(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function is(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){as(e,t,n[t])}))}return e}function ls(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}var cs=n(2033),ss={};ss.styleTagTransform=h(),ss.setAttributes=g(),ss.insert=p().bind(null,"head"),ss.domAPI=d(),ss.insertStyleElement=v(),s()(cs.Z,ss);const us=cs.Z&&cs.Z.locals?cs.Z.locals:void 0;var ds="@openmrs/esm-stock-management-app",ms={featureName:"stock-management",moduleName:ds},ps=n(3979),As=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=e("manageStock","Manage Stock");return l().createElement(a.mh4,null,l().createElement(a.Ohc,{href:window.getOpenmrsSpaBase()+"stock-management",rel:"noopener noreferrer"},l().createElement("div",null,l().createElement("div",{className:"heading"},t),l().createElement("div",{className:"content"},e("stockManagement","Stock Management"))),l().createElement("div",{className:"iconWrapper"},l().createElement(se.ol,{size:16}))))}),ms),gs=(0,r.getSyncLifecycle)((function(){return l().createElement(r.LeftNavMenu,null)}),ms),fs=(0,r.getSyncLifecycle)((function(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(at,null),l().createElement(ft,null))}),ms),vs=(0,r.getSyncLifecycle)(_t({title:"Overview",name:"stock-management"}),ms),_s=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Wo,null))}),ms),hs=(0,r.getSyncLifecycle)(_t({title:"Operations",name:"operations"}),ms),bs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Al,null))}),ms),ys=(0,r.getSyncLifecycle)(_t({title:"Items",name:"items"}),ms),ks=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(ql,null))}),ms),Cs=(0,r.getSyncLifecycle)(_t({title:"User role scopes",name:"user-scopes"}),ms),Es=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(fc,null))}),ms),ws=(0,r.getSyncLifecycle)(_t({title:"Sources",name:"sources"}),ms),Ss=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Tc,null))}),ms),Ds=(0,r.getSyncLifecycle)(_t({title:"Locations",name:"locations"}),ms),Os=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/report?v=default"))},n=function(){var e,t,n,o,a,l,c,s="".concat(r.restBaseUrl,"/stockmanagement/batchjob?batchJobType=Report&v=default&limit=10&totalCount=true"),u=(0,U.ZP)(s,r.openmrsFetch),d=u.data,m=u.error,p=u.isLoading,A=(l=(0,i.useState)(10),c=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(l,c)||function(e,t){if(e){if("string"==typeof e)return jc(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)?jc(e,t):void 0}}(l,c)||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.")}()),g=A[0],f=A[1],v=(0,r.usePagination)(null==d||null===(e=d.data)||void 0===e?void 0:e.results,g),_=v.goTo,h=v.results,b=v.currentPage;return{reports:null!==(a=null==d||null===(t=d.data)||void 0===t?void 0:t.results)&&void 0!==a?a:[],isLoading:p,isError:m,items:h,totalItems:null==d||null===(o=d.data)||void 0===o||null===(n=o.results)||void 0===n?void 0:n.length,currentPage:b,currentPageSize:g,paginatedItems:h,goTo:_,pageSizes:[10,20,30,40,50],setPageSize:f}}(),o=n.reports,c=n.isLoading,s=n.currentPage,u=n.pageSizes,d=n.totalItems,m=n.goTo,p=n.currentPageSize,A=n.setPageSize,g=(0,r.useSession)().user,f=g.privileges.filter((function(e){return"App: stockmanagement.reports"===e.display})).length>0,v=g.privileges.filter((function(e){return"Task: stockmanagement.reports.mutate"===e.display})).length>0,_=(0,i.useMemo)((function(){return[{id:0,header:e("report","Report"),key:"report"},{id:1,header:e("parameters","Parameters"),key:"parameters"},{id:2,header:e("dateRequested","Date Requested"),key:"dateRequested"},{id:3,header:e("requestedBy","Requested By"),key:"requestedBy"},{id:4,header:e("status","Status"),key:"status"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),h=(0,i.useCallback)((function(e,t){e&&window.open(function(e,t){return"".concat(ne,"ws/rest/v1/stockmanagement/batchjobartifact?id=").concat(e).concat("&download=1")}(e),"_blank")}),[]),b=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e){var t,n,r;return ls(is({},e),{checkbox:"isBatchJobActive",id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),batchJobType:e.batchJobType,dateRequested:(r=e.dateCreated,r?J()(r).format("DD-MMM-YYYY HH:mm"):""),parameters:"",report:e.description,requestedBy:null==e||null===(t=e.owners)||void 0===t?void 0:t.map((function(t,n){return l().createElement("div",{key:"".concat(e.uuid,"-owner-").concat(n)},"".concat(t.ownerFamilyName," ").concat(t.ownerGivenName))})),status:l().createElement(l().Fragment,null,"Pending"===e.status&&l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Generating report..."}),"Failed"===e.status&&l().createElement(st.Od,{className:"report-failed",title:e.status}),"Cancelled"===e.status&&l().createElement($c.mg,{className:"report-cancelled",title:e.status}),e.status===qc&&l().createElement(Sr.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(es.tK,{className:"report-expired",title:e.status})),actions:l().createElement("div",{key:"".concat(null==e?void 0:e.uuid,"-actions"),style:{display:"inline-block",whiteSpace:"nowrap"}},e.outputArtifactViewable&&"hide"===e.batchJobType&&l().createElement(a.zxk,{key:"".concat(null==e?void 0:e.uuid,"-actions-view"),type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Edit",kind:"ghost",renderIcon:ue.G7}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Copy",kind:"ghost",renderIcon:Fe.CK}),(null==e?void 0:e.status)===qc&&(null!==(n=e.outputArtifactSize)&&void 0!==n?n:0)>0&&l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Download",kind:"ghost",renderIcon:At.UW,onClick:function(){return h(e.uuid,e.outputArtifactFileExt)}}))})}))}),[o,h]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Xc.tableOverride},l().createElement(a.x45,null,e("ReportDescription","List of reports requested by users")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:b,headers:_,isSortable:!0,useZebraStyles:!0,render:function(n){var o=n.rows,i=n.headers,c=n.getHeaderProps,s=n.getTableProps,u=n.getRowProps,d=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Xc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:t},"Refresh")),v&&l().createElement(Wc,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,ls(is({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Xc.desktopHeader:Xc.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,is({className:r.isDesktop?Xc.desktopRow:Xc.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),f?0===o.length?l().createElement("div",{className:Xc.tileContainer},l().createElement(a.n9L,{className:Xc.tile},l().createElement("div",{className:Xc.tileContent},l().createElement("p",{className:Xc.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:Xc.helper},e("checkFilters","Check the filters above"))))):null:l().createElement(os,{title:"Can not view stock reports",description:"You have no permissions to view reports"}))}}),l().createElement(a.tlE,{page:s,pageSize:p,pageSizes:u,totalItems:d,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==s&&m(n)},className:Xc.paginationOverride}))}),ms),xs=(0,r.getSyncLifecycle)(_t({title:"Reports",name:"reports"}),ms),Ns=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t;return l().createElement("div",{className:us.StockSettings},l().createElement("div",{className:us.title},e("comingSoonUnderDev","Exciting updates are on the way! In the meantime, use the link below to access Admin UI settings.")),l().createElement(a.zxk,{onClick:function(){return(0,r.navigate)({to:"${openmrsBase}/admin/maintenance/settings.list?show=Stockmanagement"})},size:"md",renderIcon:function(){return l().createElement(ue.PG,{className:"cds--btn__icon",size:24})},kind:"ghost"},e("adminSettings","Admin settings")))}),ms),Is=(0,r.getSyncLifecycle)(_t({title:"Settings",name:"settings"}),ms),Ts=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),ms),Bs=(0,r.getSyncLifecycle)((function(){var e="".concat(window.spaBase,"/stock-management");return(0,i.useEffect)((function(){return(0,r.setLeftNav)({name:"stock-page-dashboard-slot",basePath:e}),function(){return(0,r.unsetLeftNav)("stock-page-dashboard-slot")}}),[e]),l().createElement("main",{className:"omrs-main-content"},l().createElement(Se.BrowserRouter,{basename:window.spaBase},l().createElement(Se.Routes,null,l().createElement(Se.Route,{path:"/stock-management",element:l().createElement(Ge,null)}),l().createElement(Se.Route,{path:"/stock-management/:dashboard/*",element:l().createElement(Ge,null)}))))}),ms),Ps=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.title,c=e.requireReason,s=e.operation,u=e.closeModal,d=o.toLocaleLowerCase().trim(),m=(0,E.useTranslation)().t,p=ce((0,i.useState)(""),2),A=p[0],g=p[1],f=ce((0,i.useState)(!1),2),v=f[0],_=f[1],h=(t=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(e.preventDefault(),_(!0),t=null,d){case"submit":t="SUBMIT";break;case"dispatch":case"dispatchapproval":t="DISPATCH";break;case"complete":case"completedispatch":t="COMPLETE";break;case"cancel":t="CANCEL";break;case"reject":t="REJECT";break;case"return":t="RETURN";break;case"approve":t="APPROVE"}return t?(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperationaction"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}({name:t,uuid:null==s?void 0:s.uuid,reason:A}).then((function(){_(!1),(0,r.showSnackbar)({title:m("title","".concat(o," Operation")),subtitle:m("successMessage","You have successfully ".concat(o," operation ")),kind:"success"}),u(),Y(),ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))}),(function(e){_(!1);var t=oe(e);(0,r.showSnackbar)({title:m("errorDescriptionTitle","Error on saving form"),subtitle:m("errorDescription",t.join(", ")),kind:"error"}),u(),Y()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){le(a,r,o,i,l,"next",e)}function l(e){le(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)});return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:B.modalBody},l().createElement("section",{className:B.section},l().createElement("h5",{className:B.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:B.section},l().createElement(a.Kx8,{labelText:m("notes","Please explain the reason:"),id:"nextNotes",name:"nextNotes",invalidText:"Required",maxCount:500,enableCounter:!0,onChange:function(e){return g(e.target.value)}})))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:u},m("cancel","Cancel")),v?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),ms),Us=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},o("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this source? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-modal",moduleName:ds}),js=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},o("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this User Scope? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-user-scope-modal",moduleName:ds}),zs=(0,r.getSyncLifecycle)((function(e){var t=e.row,n=e.closeModal,o=(0,E.useTranslation)().t,c=ye(),s=c.mutate,u=c.setStockItemUuid;(0,i.useEffect)((function(){u(t.stockItemUuid)}),[t.stockItemUuid,u]);var d,m,p=(d=(0,i.useState)(""),m=2,function(e){if(Array.isArray(e))return e}(d)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(d,m)||function(e,t){if(e){if("string"==typeof e)return we(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)?we(e,t):void 0}}(d,m)||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.")}()),A=p[0],g=p[1];return l().createElement("div",null,l().createElement(a.xBx,{closeModal:n,className:Ee.productiveHeading03},o("removePackagingUnit","Remove Packaging Unit"),"?"),l().createElement(a.fef,null,l().createElement("span",null,o("removePackagingUnitConfirmation","Would you really like to remove the packaging unit ".concat(null==t?void 0:t.packagingUomName," from the stock item?"))),l().createElement(a.Kx8,{id:"reason",labelText:o("reasonLabel","Please explain the reason:"),onChange:function(e){g(e.target.value)},maxLength:500,placeholder:o("reasonPlaceholder","Enter reason here")})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:n},o("no","No")),l().createElement(a.zxk,{kind:"danger",type:"submit",onClick:function(e){var a,i,l;e.preventDefault(),(a=t.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(a),l=new AbortController,(0,r.openmrsFetch)(i,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:l.signal})).then((function(){s(),n(),(0,r.showSnackbar)({isLowContrast:!0,title:o("deletePackagingUnitTitle","Delete packing item "),kind:"success",subtitle:o("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showSnackbar)({title:o("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})}))},disabled:A.length<1},o("yes","Yes"))))}),{featureName:"delete-packaging-unit-modal",moduleName:ds}),Fs=(0,r.getSyncLifecycle)(de,{featureName:"delete-packging-unit-button",moduleName:ds}),Ls=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.closeModal,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return D(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)?D(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.")}()),u=s[0],d=s[1];return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:o,title:c("importStockItems","Import Stock Items")}),l().createElement(a.fef,null,l().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"small",onChange:function(e){var t,n,r=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];r?d(r):e.preventDefault()}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:o},c("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(u){var e=new FormData;u&&(e.append("file",u,"Import_Stock_Items.csv"),e.append("hasHeader","true")),function(e){return S.apply(this,arguments)}(e).then((function(){(0,r.showSnackbar)({isLowContrast:!0,title:c("rejectOrder","Uploaded Order"),kind:"success",subtitle:c("Successfully uploaded","You have successfully uploaded stock items")}),o()}),(function(e){(0,r.showSnackbar)({title:c("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})}))}}},c("uploadStockItems","Upload StockItems")))))}),ms),Rs=(0,r.getSyncLifecycle)((function(){var e=window.getOpenmrsSpaBase();return l().createElement(a.Ohc,{className:k.customTile,id:"menu-item",href:"".concat(e,"stock-management")},l().createElement("div",{className:"customTileTitle"},l().createElement(C.yG,{size:24})),l().createElement("div",null,"Stock Management"))}),ms);function Ms(){(0,r.defineConfigSchema)(ds,o)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};function o(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],o=t[0];return n.e(t[1]).then((()=>n(o)))}o.keys=()=>Object.keys(r),o.id=3979,e.exports=o}}]);
|
1
|
+
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[474],{3432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__metrics-card__tileContainer___SG_bT{border:.0625rem solid #e0e0e0;flex-grow:1;height:7.875rem;padding:0 .75rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;margin-bottom:20px}.-esm-stock-management__metrics-card__tileHeader___sMfyg{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.-esm-stock-management__metrics-card__headerLabel___HyNJ3{font-size:var(--cds-label-02-font-size, 0.875rem);font-weight:var(--cds-label-02-font-weight, 400);line-height:var(--cds-label-02-line-height, 1.28572);letter-spacing:var(--cds-label-02-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__metrics-card__totalsLabel___hyLWP{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-stock-management__metrics-card__totalsValue___CCj27{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);color:#161616}.-esm-stock-management__metrics-card__headerLabelContainer___bVkOu{display:flex;align-items:center;height:2rem;justify-content:space-between;width:100%}.-esm-stock-management__metrics-card__link___qIBqZ{text-decoration:none;display:flex;align-items:flex-end}.-esm-stock-management__metrics-card__metricsGrid___sM6gq{display:grid;grid-template-columns:1fr 1fr}.-esm-stock-management__metrics-card__countGrid___XC66g{display:grid;grid-template-columns:1fr 1fr;justify-self:flex-end;column-gap:.5rem}.-esm-stock-management__metrics-card__countGrid___XC66g>span{font-size:.625rem !important;margin:0;color:#525252}.-esm-stock-management__metrics-card__countGrid___XC66g>p{margin:0}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/card/metrics-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,4DACE,6BAAA,CACA,WAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,kBAAA,CAGF,yDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,mBCCW,CDCb,0DE40BI,iDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF10BF,aGwBQ,CHtBV,0DEw0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CFt0BF,aDvBQ,CCyBV,0DEo0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CFl0BF,aD5BM,CC8BR,mEACE,YAAA,CACA,kBAAA,CACA,WCIW,CDHX,6BAAA,CACA,UAAA,CAEF,mDACE,oBAAA,CACA,YAAA,CACA,oBAAA,CAEF,0DACE,YAAA,CACA,6BAAA,CAEF,wDACE,YAAA,CACA,6BAAA,CACA,qBAAA,CACA,gBCjCW,CDkCX,6DACE,4BAAA,CACA,QAAA,CACA,aGVM,CHYR,0DACE,QAAA",sourceRoot:""}]),i.locals={tileContainer:"-esm-stock-management__metrics-card__tileContainer___SG_bT",tileHeader:"-esm-stock-management__metrics-card__tileHeader___sMfyg",headerLabel:"-esm-stock-management__metrics-card__headerLabel___HyNJ3",totalsLabel:"-esm-stock-management__metrics-card__totalsLabel___hyLWP",totalsValue:"-esm-stock-management__metrics-card__totalsValue___CCj27",headerLabelContainer:"-esm-stock-management__metrics-card__headerLabelContainer___bVkOu",link:"-esm-stock-management__metrics-card__link___qIBqZ",metricsGrid:"-esm-stock-management__metrics-card__metricsGrid___sM6gq",countGrid:"-esm-stock-management__metrics-card__countGrid___XC66g"};const l=i},2296:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__overlay__desktopOverlay___lvJaK{position:fixed;top:3rem;width:100%;right:0;bottom:0;z-index:9;border-left:1px solid #a8a8a8;background-color:#fff;overflow-y:auto;height:calc(100vh - 3rem)}.-esm-stock-management__overlay__desktopOverlay___lvJaK::after{height:100%;border-left:1px solid #a8a8a8}.-esm-stock-management__overlay__tabletOverlay___ThdtE{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#f4f4f4;overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none}.-esm-stock-management__overlay__tabletOverlay___ThdtE::-webkit-scrollbar{width:0}.-esm-stock-management__overlay__tabletOverlay___ThdtE>div{margin-top:3rem}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O button{background-color:#005d5d;background-color:var(--brand-01)}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O .-esm-stock-management__overlay__headerContent___YYBKM{color:#fff}.-esm-stock-management__overlay__desktopHeader___Ueq0h{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8;position:sticky;position:-webkit-sticky;width:100%;z-index:1000;top:0}.-esm-stock-management__overlay__headerContent___YYBKM{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-stock-management__overlay__closeButton___JYFSq{background-color:#fff;color:#161616;fill:#161616}.omrs-breakpoint-gt-tablet .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.omrs-breakpoint-lt-desktop .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.cds--list-box__menu{z-index:20000}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/overlay/overlay.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,wDACE,cAAA,CACA,QC6CW,CD5CX,UAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,6BAAA,CACA,qBAAA,CACA,eAAA,CACA,yBAAA,CAGF,+DACE,WAAA,CACA,6BAAA,CAGF,uDACE,cAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,wBD7BM,CC8BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCYS,CDPX,oEDNA,wBAAA,CACA,gCAAA,CCSA,oHACE,UDhDI,CCoDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDvDM,CCwDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEgyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF9xBF,cAAA,CACA,aDjEM,CCoER,qDACE,qBDlEc,CCmEd,aDtEM,CCuEN,YDvEM,CC4EN,mFACE,eAAA,CACA,eAAA,CAMF,oFACE,eAAA,CACA,eAAA,CAKJ,qBACE,aAAA",sourceRoot:""}]),i.locals={desktopOverlay:"-esm-stock-management__overlay__desktopOverlay___lvJaK",tabletOverlay:"-esm-stock-management__overlay__tabletOverlay___ThdtE",tabletOverlayHeader:"-esm-stock-management__overlay__tabletOverlayHeader___T3x8O",headerContent:"-esm-stock-management__overlay__headerContent___YYBKM",desktopHeader:"-esm-stock-management__overlay__desktopHeader___Ueq0h",closeButton:"-esm-stock-management__overlay__closeButton___JYFSq",overlayContent:"-esm-stock-management__overlay__overlayContent___QyXjy"};const l=i},7149:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__privilages__content___UE9bQ{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__privilages__helper___EblpR{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__privilages__tileContainer___K6_qc{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__privilages__tile___zojuU{margin:auto;width:fit-content}.-esm-stock-management__privilages__tileContent___hG2dp{display:flex;flex-direction:column;align-items:center}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/privilages-component/privilages.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,oDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,mDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,0DACE,qBDfM,CCgBN,4BAAA,CACA,cAAA,CAGF,iDACE,WAAA,CACA,iBAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__privilages__content___UE9bQ",helper:"-esm-stock-management__privilages__helper___EblpR",tileContainer:"-esm-stock-management__privilages__tileContainer___K6_qc",tile:"-esm-stock-management__privilages__tile___zojuU",tileContent:"-esm-stock-management__privilages__tileContent___hG2dp"};const l=i},4655:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__table__widgetContainer___cZm_L{background-color:#fff}.-esm-stock-management__table__widgetHeaderContainer___mn6uH{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem}.-esm-stock-management__table__widgetHeaderContainer___mn6uH>h4:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-01)}.-esm-stock-management__table__toggleButtons___cvBSx{width:fit-content;margin:0 .5rem}.-esm-stock-management__table__searchField___XUf8e{width:100%;max-width:250px;border:0px !important}.-esm-stock-management__table__searchBox___pXQzl{width:100%;display:flex;justify-content:right}.-esm-stock-management__table__container___Kypy0{margin-top:16px;margin-left:inherit;width:100%;overflow-y:hidden}.-esm-stock-management__table__tabContainer___E9h5_{margin-top:16px;padding-left:1rem;background-color:#fff}.-esm-stock-management__table__itemListSearch___I6xcT{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__itemListSearch___I6xcT input{background-color:#fff !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tileContainer___ZrvLt{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__table__tile___peYeA{margin:auto;width:fit-content}.-esm-stock-management__table__tileContent___WuPqi{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__table__menuItem___Sy4dM{max-width:none}.-esm-stock-management__table__radioButtonGroup___jCXKy{display:flex;flex-direction:column;align-items:flex-start;margin-top:.5rem;min-height:4rem;width:100%;font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-stock-management__table__radioButton____RBAw{padding:.25rem .25rem;margin:.5rem 0}.-esm-stock-management__table__section___tNn_U{margin:.5rem}.-esm-stock-management__table__sectionTitle___UBtqA{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__table__modalBody___QNIO4{padding-bottom:1rem}.-esm-stock-management__table__tabContainer___E9h5_ div[role=tabpanel]{padding:0 !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tableContainer___rZgtk{margin:0;padding:0}.-esm-stock-management__table__search___ybQU1{max-width:16rem}.-esm-stock-management__table__search___ybQU1 input{background-color:#fff !important}.-esm-stock-management__table__tableContainer___rZgtk{background-color:#f4f4f4}.-esm-stock-management__table__tableContainer___rZgtk a{text-decoration:none}.-esm-stock-management__table__tableContainer___rZgtk tr{width:.125rem}.-esm-stock-management__table__tableContainer___rZgtk .-esm-stock-management__table__toolbarContent___XsHBI{height:3rem}.-esm-stock-management__table__cds--table-sort__description___Gup5c{display:none}.-esm-stock-management__table__itemListDownload___loZ4q{margin-top:10px}.-esm-stock-management__table__content___qLKKH{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__table__helper___ZKdW1{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/table/table.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDACE,qBDCc,CCEhB,6DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CAGF,sEACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,qDACE,iBAAA,CACA,cAAA,CAGF,mDACE,UAAA,CACA,eAAA,CACA,qBAAA,CAGF,iDACE,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,iDACE,eAAA,CACA,mBAAA,CACA,UAAA,CACA,iBAAA,CAGF,oDACE,eAAA,CACA,iBAAA,CACA,qBAAA,CAGF,sDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,qBAAA,CAGF,qDACE,qBDpEM,CCqEN,4BAAA,CACA,cAAA,CAGF,4CACE,WAAA,CACA,iBAAA,CAGF,mDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,gDACE,cAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,gBCxEW,CDyEX,eCtCW,CDuCX,UAAA,CEmwBE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CF/vBJ,mDACE,qBAAA,CACA,cAAA,CAGF,+CACE,YCpFW,CDuFb,oDEsvBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFpvBF,aG9DQ,CH+DR,oBCrFW,CDwFb,iDACE,mBCpFW,CDuFb,uEACE,oBAAA,CAGF,8DACE,qBAAA,CAGF,sDACE,QAAA,CACA,SAAA,CAGF,8CACE,eAAA,CAEA,oDACE,gCAAA,CAIJ,sDACE,wBD5IM,CC8IN,wDACE,oBAAA,CAGF,yDACE,aCxIS,CD2IX,4GACE,WCpGS,CDwGb,oEACE,YAAA,CAGF,wDACE,eAAA,CAGF,+CE+rBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF7rBF,aDhKQ,CCiKR,mBAAA,CAGF,8CEyrBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFvrBF,aDtKQ",sourceRoot:""}]),i.locals={widgetContainer:"-esm-stock-management__table__widgetContainer___cZm_L",widgetHeaderContainer:"-esm-stock-management__table__widgetHeaderContainer___mn6uH",toggleButtons:"-esm-stock-management__table__toggleButtons___cvBSx",searchField:"-esm-stock-management__table__searchField___XUf8e",searchBox:"-esm-stock-management__table__searchBox___pXQzl",container:"-esm-stock-management__table__container___Kypy0",tabContainer:"-esm-stock-management__table__tabContainer___E9h5_",itemListSearch:"-esm-stock-management__table__itemListSearch___I6xcT",tileContainer:"-esm-stock-management__table__tileContainer___ZrvLt",tile:"-esm-stock-management__table__tile___peYeA",tileContent:"-esm-stock-management__table__tileContent___WuPqi",menuItem:"-esm-stock-management__table__menuItem___Sy4dM",radioButtonGroup:"-esm-stock-management__table__radioButtonGroup___jCXKy",radioButton:"-esm-stock-management__table__radioButton____RBAw",section:"-esm-stock-management__table__section___tNn_U",sectionTitle:"-esm-stock-management__table__sectionTitle___UBtqA",modalBody:"-esm-stock-management__table__modalBody___QNIO4",tableContainer:"-esm-stock-management__table__tableContainer___rZgtk",search:"-esm-stock-management__table__search___ybQU1",toolbarContent:"-esm-stock-management__table__toolbarContent___XsHBI","cds--table-sort__description":"-esm-stock-management__table__cds--table-sort__description___Gup5c",itemListDownload:"-esm-stock-management__table__itemListDownload___loZ4q",content:"-esm-stock-management__table__content___qLKKH",helper:"-esm-stock-management__table__helper___ZKdW1"};const l=i},5260:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__vertical-tabs__heading___dsNAK{font-size:var(--cds-productive-heading-02-font-size, 1rem);font-weight:var(--cds-productive-heading-02-font-weight, 600);line-height:var(--cds-productive-heading-02-line-height, 1.375);letter-spacing:var(--cds-productive-heading-02-letter-spacing, 0);color:#525252;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__heading___dsNAK:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__vertical-tabs__mainContainer___V_jej{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__vertical-tabs__title___hZ4AW{padding:1rem;font-size:1.2rem}.-esm-stock-management__vertical-tabs__desktopContainer____twGN{width:50%}.-esm-stock-management__vertical-tabs__tabletContainer___FQsU6{width:90%}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab-content{width:100% !important;padding:0}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab--list{flex-direction:column;max-height:30rem}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs{width:auto;max-height:100vh;display:flex;flex-direction:column;flex:1}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:active,.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--col{padding-left:0;width:100%}.-esm-stock-management__vertical-tabs__tabletTab___PHxHJ{width:25%}.-esm-stock-management__vertical-tabs__desktopTab___jh9Dp{width:20%}.-esm-stock-management__vertical-tabs__tab___IFWR5{display:flex}.-esm-stock-management__vertical-tabs__tabContainer___hu3KQ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__optionCell___oFvY9{padding:0 !important}.-esm-stock-management__vertical-tabs__optionHeader___avuuO{width:1.5rem !important}.-esm-stock-management__vertical-tabs__text___VSinM{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/tabs/vertical-tabs.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHpBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,SAAA,CAGF,6EACE,qBAAA,CACA,gBAAA,CAGF,wEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,+EACE,WAAA,CACA,eAAA,CAGF,6FACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,uGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,kFAOE,eAAA,CANA,iLAEE,oBAAA,CACA,2BAAA,CAMJ,uEACE,cAAA,CACA,UAAA,CAIJ,yDACE,SAAA,CAGF,0DACE,SAAA,CAGF,mDACE,YAAA,CAGF,4DACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,0DACE,oBAAA,CAGF,4DACE,uBAAA,CAGF,oDACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__vertical-tabs__heading___dsNAK",mainContainer:"-esm-stock-management__vertical-tabs__mainContainer___V_jej",title:"-esm-stock-management__vertical-tabs__title___hZ4AW",desktopContainer:"-esm-stock-management__vertical-tabs__desktopContainer____twGN",tabletContainer:"-esm-stock-management__vertical-tabs__tabletContainer___FQsU6",cohortBuilder:"-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy",tabletTab:"-esm-stock-management__vertical-tabs__tabletTab___PHxHJ",desktopTab:"-esm-stock-management__vertical-tabs__desktopTab___jh9Dp",tab:"-esm-stock-management__vertical-tabs__tab___IFWR5",tabContainer:"-esm-stock-management__vertical-tabs__tabContainer___hu3KQ",optionCell:"-esm-stock-management__vertical-tabs__optionCell___oFvY9",optionHeader:"-esm-stock-management__vertical-tabs__optionHeader___avuuO",text:"-esm-stock-management__vertical-tabs__text___VSinM"};const l=i},3011:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ{display:flex}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD{display:flex;flex-grow:1;flex-direction:column;margin:0;margin-left:16rem;background-color:#f4f4f4}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD a{width:100%}.-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx{flex-grow:1}.-esm-stock-management__home-dashboard__logoSection___oYB2c{display:flex;justify-content:center}","",{version:3,sources:["webpack://./src/dashboard/home-dashboard.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAGA,gEACE,YAAA,CAGF,mEACE,YAAA,CACA,WAAA,CACA,qBAAA,CACA,QAAA,CACA,iBAAA,CACA,wBC6BQ,CD3BR,qEACE,UAAA,CAIJ,yEACE,WAAA,CAGF,4DACE,YAAA,CACA,sBAAA",sourceRoot:""}]),i.locals={homePageWrapper:"-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ",dashboardContainer:"-esm-stock-management__home-dashboard__dashboardContainer___FvpUD",dashboardContainerTablet:"-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx",logoSection:"-esm-stock-management__home-dashboard__logoSection___oYB2c"};const l=i},49:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__root__productiveHeading01___qz04k{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__root__productiveHeading02___P86oI{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading03___ad2Jr{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading04____lfRk{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading05___BiHXj{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading06___fCUbs{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__root__bodyShort01___qFZKo{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__root__helperText01___l9eBE{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__root__bodyShort02___e318z{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__root__bodyLong01___hajrO{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__root__bodyLong02___rbPh9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__root__label01___B9Vra{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__root__text02___HK43C{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__root__container___Rf8rX{padding:2rem}.-esm-stock-management__root__formContainer___YM692{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__root__verticalForm___EFCw7{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__root__verticalForm___EFCw7 .cds--form-item{flex:none !important}.-esm-stock-management__root__verticalForm___EFCw7 .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0DC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,0DC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,0DCs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,0DCk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,0DC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,0DC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,kDCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,mDCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,kDC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,iDC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,iDCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,8CCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,6CACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,gDACE,YEpCW,CFuCb,oDACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,mDACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,mEACE,oBAAA,CAGF,+DACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__root__productiveHeading01___qz04k",productiveHeading02:"-esm-stock-management__root__productiveHeading02___P86oI",productiveHeading03:"-esm-stock-management__root__productiveHeading03___ad2Jr",productiveHeading04:"-esm-stock-management__root__productiveHeading04____lfRk",productiveHeading05:"-esm-stock-management__root__productiveHeading05___BiHXj",productiveHeading06:"-esm-stock-management__root__productiveHeading06___fCUbs",bodyShort01:"-esm-stock-management__root__bodyShort01___qFZKo",helperText01:"-esm-stock-management__root__helperText01___l9eBE",bodyShort02:"-esm-stock-management__root__bodyShort02___e318z",bodyLong01:"-esm-stock-management__root__bodyLong01___hajrO",bodyLong02:"-esm-stock-management__root__bodyLong02___rbPh9",label01:"-esm-stock-management__root__label01___B9Vra",text02:"-esm-stock-management__root__text02___HK43C",container:"-esm-stock-management__root__container___Rf8rX",formContainer:"-esm-stock-management__root__formContainer___YM692",verticalForm:"-esm-stock-management__root__verticalForm___EFCw7"};const l=i},7813:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__item__customTile___pTLBA{background-color:#f0f0f0;border-radius:4px;padding:20px;width:50px;height:100px;text-align:center;margin:2px}.-esm-stock-management__item__customTileTitle___DoQk8{font-size:14px;color:#333}","",{version:3,sources:["webpack://./src/stock-app-menu-item/item.scss"],names:[],mappings:"AACA,iDACI,wBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,YAAA,CACA,iBAAA,CACA,UAAA,CAGF,sDACE,cAAA,CACA,UAAA",sourceRoot:""}]),i.locals={customTile:"-esm-stock-management__item__customTile___pTLBA",customTileTitle:"-esm-stock-management__item__customTileTitle___DoQk8"};const l=i},8629:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home-detail-card__container___mESY0,.-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT,.-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk{margin:2rem 0}.-esm-stock-management__stock-home-detail-card__tilesContainer___blppR{background-color:#fff;border:1px solid #e0e0e0;border-bottom:none;width:100%;margin:0 auto;max-width:95vw;padding-bottom:0}.-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem;background-color:#fff}.-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL section{position:relative}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL a{text-decoration:none}.-esm-stock-management__stock-home-detail-card__pagination___sPPID{overflow:hidden}.-esm-stock-management__stock-home-detail-card__pagination___sPPID.cds--pagination{border-top:none}.-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa{display:none}.-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc{width:100%;max-width:768px;margin:1rem auto}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1>td>div{max-height:max-content !important}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 td{padding:0 2rem}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 th[colspan] td[colspan]>div:first-child{padding:0 1rem}.-esm-stock-management__stock-home-detail-card__action___Ul5A5{margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__illo___Wm7vk{margin-top:1rem}.-esm-stock-management__stock-home-detail-card__content___Q2X06{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h{text-align:left;text-transform:capitalize}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4:after,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid;border-bottom-color:#007d79;border-bottom-color:var(--brand-03)}.-esm-stock-management__stock-home-detail-card__tile___apXYV{text-align:center;border:1px solid #e0e0e0}.-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM{display:flex;justify-content:center;align-items:center;padding:1rem;margin:3rem;text-align:center}.-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i{margin:auto}.-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N{display:flex;margin:0 auto}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N>*{flex:1;margin:8px 8px}.-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm{display:flex;flex-direction:column}.-esm-stock-management__stock-home-detail-card__card___WYEgl{display:flex;border:1px solid #ccc;margin:10px;background-color:#f4f4f4}.-esm-stock-management__stock-home-detail-card__icon___JI7mq{margin-right:23px}.-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky{width:5px;background-color:#f1c21b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF{width:5px;background-color:#0f62fe;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z{width:5px;background-color:#ff832b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU{width:5px;background-color:#198038;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB{width:5px;background-color:#da1e28;margin-right:10px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr{margin-top:5px;margin-bottom:5px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr p{font-size:.9em;color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home-detail-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,sNACE,aAAA,CAQF,uEACE,qBDbM,CCcN,wBAAA,CACA,kBAAA,CACA,UAAA,CACA,aAAA,CACA,cAAA,CACA,gBAAA,CAGF,wEACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CACA,qBD3BM,CC8BR,wFACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,+EACE,iBAAA,CAGF,yEACE,oBAAA,CAGF,mEACE,eAAA,CAEA,mFACE,eAAA,CAIJ,kEACE,YAAA,CAGF,iEACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,8EACE,UAAA,CACA,eAAA,CACA,gBAAA,CAGF,sFACE,iCAAA,CAGF,kFACE,cAAA,CAGF,uHACE,cAAA,CAGF,+DACE,mBC9DW,CDiEb,6DACE,eCxDW,CD2Db,gEEwwBI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CFtwBF,aDvFQ,CCwFR,eC9DW,CD+DX,mBCzEW,CD4Eb,6IAEE,eAAA,CACA,yBAAA,CAEA,mJE4vBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF1vBA,aDnGM,CCqGN,+JACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2BAAA,CD/DJ,2BAAA,CACA,mCAAA,CCoEF,6DACE,iBAAA,CACA,wBAAA,CAGF,yEACE,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,YC/FW,CDgGX,WC5EW,CD6EX,iBAAA,CAGF,6EACE,WAAA,CAGF,gFE2tBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFztBF,aDpIQ,CCqIR,mBAAA,CAGF,+EEqtBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFntBF,aD1IQ,CC6IV,sEACE,YAAA,CACA,aAAA,CAGF,wEACE,MAAA,CACA,cAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CAGF,6DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,wBAAA,CAGF,6DACE,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,sEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,uEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,qEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,iEACE,cAAA,CACA,iBAAA,CAGF,mEACE,cAAA,CACA,aAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-home-detail-card__container___mESY0",emptyStateContainer:"-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT",loaderContainer:"-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk",tilesContainer:"-esm-stock-management__stock-home-detail-card__tilesContainer___blppR",headerContainer:"-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV",backgroundDataFetchingIndicator:"-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_",tableContainer:"-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL",pagination:"-esm-stock-management__stock-home-detail-card__pagination___sPPID",hiddenRow:"-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa",emptyRow:"-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s",visitSummaryContainer:"-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc",expandedActiveVisitRow:"-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1",action:"-esm-stock-management__stock-home-detail-card__action___Ul5A5",illo:"-esm-stock-management__stock-home-detail-card__illo___Wm7vk",content:"-esm-stock-management__stock-home-detail-card__content___Q2X06",desktopHeading:"-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3",tabletHeading:"-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h",tile:"-esm-stock-management__stock-home-detail-card__tile___apXYV",filterEmptyState:"-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM",filterEmptyStateTile:"-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i",filterEmptyStateContent:"-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0",filterEmptyStateHelper:"-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN",cardContainer:"-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N",cardContainerBig:"-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm",card:"-esm-stock-management__stock-home-detail-card__card___WYEgl",icon:"-esm-stock-management__stock-home-detail-card__icon___JI7mq",colorLineYellow:"-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky",colorLineBlue:"-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF",colorLineOrange:"-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z",colorLineGreen:"-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU",colorLineRed:"-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB",cardText:"-esm-stock-management__stock-home-detail-card__cardText____XcXr"};const l=i},2426:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home__cardContainer___n7Lxz{background-color:#fff;display:flex;justify-content:space-between;margin:0 1rem 0 1rem;flex-flow:row wrap;column-gap:1rem;row-gap:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,0DACE,qBCIM,CDHN,YAAA,CACA,6BAAA,CACA,oBAAA,CACA,kBAAA,CACA,eEqBW,CFpBX,YEoBW",sourceRoot:""}]),i.locals={cardContainer:"-esm-stock-management__stock-home__cardContainer___n7Lxz"};const l=i},4158:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__packaging-units__packingTable___ceosy{min-height:15rem;display:block}.-esm-stock-management__packaging-units__packingTableCell___KYLlI{display:flex;align-items:center}.-esm-stock-management__packaging-units__packagingTableBody___o7eKF{min-height:10rem}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6{padding-bottom:1rem;min-height:15rem;display:block}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6 .cds--data-table-content{overflow-x:visible}.-esm-stock-management__packaging-units__searchAndSave___iglHk{display:flex;flex-direction:column;align-items:flex-start}.-esm-stock-management__packaging-units__searchAndSave___iglHk .-esm-stock-management__packaging-units__submitButton___DIyGx{margin-top:1rem}.-esm-stock-management__packaging-units__deleteModal___T_iKq .cds--modal-container.cds--modal-container--sm .cds--modal-content .cds--form-item{margin-top:1rem}.-esm-stock-management__packaging-units__packageUnitsBtn___uapVg{display:flex;justify-content:flex-end;margin-right:2rem}cds--form-item{margin-top:1rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACE,gBAAA,CACA,aAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CAGF,oEACE,gBCwDW,CDrDb,yEACE,mBAAA,CACA,gBAAA,CACA,aAAA,CAEA,kGACE,kBAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,6HACE,eAAA,CAOE,gJACE,eAAA,CAMR,iEACE,YAAA,CACA,wBAAA,CACA,iBAAA,CAGF,eACE,eAAA",sourceRoot:""}]),i.locals={packingTable:"-esm-stock-management__packaging-units__packingTable___ceosy",packingTableCell:"-esm-stock-management__packaging-units__packingTableCell___KYLlI",packagingTableBody:"-esm-stock-management__packaging-units__packagingTableBody___o7eKF",packagingTableContainer:"-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6",searchAndSave:"-esm-stock-management__packaging-units__searchAndSave___iglHk",submitButton:"-esm-stock-management__packaging-units__submitButton___DIyGx",deleteModal:"-esm-stock-management__packaging-units__deleteModal___T_iKq",packageUnitsBtn:"-esm-stock-management__packaging-units__packageUnitsBtn___uapVg"};const l=i},501:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-item-references__referencesTable___WAMHe{min-height:15rem;display:block}.-esm-stock-management__stock-item-references__referencesTableCell___NGIOb{display:flex;align-items:center}.-esm-stock-management__stock-item-references__referencesTableBody___HreAO{min-height:10rem}.-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw{min-height:15rem;display:block}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,uEACE,gBAAA,CACA,aAAA,CAGF,2EACE,YAAA,CACA,kBAAA,CAGF,2EACE,gBCwDW,CDpDb,gFACE,gBAAA,CACA,aAAA",sourceRoot:""}]),i.locals={referencesTable:"-esm-stock-management__stock-item-references__referencesTable___WAMHe",referencesTableCell:"-esm-stock-management__stock-item-references__referencesTableCell___NGIOb",referencesTableBody:"-esm-stock-management__stock-item-references__referencesTableBody___HreAO",referencesTableContainer:"-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw"};const l=i},4563:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-rules__section___ggL6B{margin:.5rem}.-esm-stock-management__add-stock-rules__sectionTitle___fsf7E{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-rules__modalBody___DXCqE{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,yDACE,YCgBW,CDbb,8DE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,2DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-rules__section___ggL6B",sectionTitle:"-esm-stock-management__add-stock-rules__sectionTitle___fsf7E",modalBody:"-esm-stock-management__add-stock-rules__modalBody___DXCqE"};const l=i},4907:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss"],names:[],mappings:"AACI,oGACE,KAAA,CAGF,8FACE,WAAA,CAGF,iHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-rules-filter__filterContainer___eskQ5"};const l=i},1048:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__filter-stock-items__spacing___pZHZK{margin:0 16px}","",{version:3,sources:["webpack://./src/stock-items/components/filter-stock-items/filter-stock-items.scss"],names:[],mappings:"AAAA,4DACI,aAAA",sourceRoot:""}]),i.locals={spacing:"-esm-stock-management__filter-stock-items__spacing___pZHZK"};const l=i},1535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}:root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-items-table__productiveHeading01___MPnNp{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__productiveHeading02___E1KiC{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading03___N33sp{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading04___lh7n8{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading05___ieA0n{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading06___JPMyX{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__helperText01___uOks4{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__bodyShort02___d7A67{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyLong01____Gl3H{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__bodyLong02___Dwoe9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__label01___ANQCM{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__text02___ac1IL{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-items-table__container___VONiZ{padding:2rem}.-esm-stock-management__stock-items-table__formContainer___o0XL5{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-items-table__verticalForm___oOj2I{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--form-item{flex:none !important}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-items-table__tileContainer___N1eHZ{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-items-table__tile___ZZNjt{margin:auto;width:fit-content}.-esm-stock-management__stock-items-table__tileContent___SC542{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-items-table__content___zdm4U{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-items-table__helper___kKhcQ{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-items-table__separator___JXP1R{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-items-table__separator___JXP1R::before,.-esm-stock-management__stock-items-table__separator___JXP1R::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-items-table__separator___JXP1R::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-items-table__separator___JXP1R::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-items-table__toolbarContent___oBPmt{display:flex;align-items:center}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center}.-esm-stock-management__stock-items-table__dateAlign___RNWUI{padding-top:.5rem;height:100%}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL{padding-bottom:.5rem}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL .cds--list-box__menu{min-width:15rem;z-index:1}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-items/stock-items-table.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CAHF,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,uEC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,uEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,uECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,uECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,uEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,uEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,+DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,gECkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,+DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,8DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,8DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,2DCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,0DACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,6DACE,YEpCW,CFuCb,iEACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,gEACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,gFACE,oBAAA,CAGF,4EACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGpGJ,sEACE,qBHEc,CGDd,YDwBW,CCvBX,gBAAA,CAGF,iEACE,qBHPM,CGQN,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,2DFs0BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CEp0BF,aJzBQ,CI0BR,mBAAA,CAGF,0DFg0BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CE9zBF,aJ/BQ,CIkCV,6DF2zBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CEzzBF,aJpCQ,CIqCR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBJ3CM,CI4CN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,qEACE,WAAA,CACA,gBAAA,CAGF,oEACE,UAAA,CACA,iBAAA,CAIJ,kEACE,YAAA,CACA,kBAAA,CAGF,mEACE,YAAA,CACA,kBAAA,CAGF,6DACE,iBD3DW,CC4DX,WAAA,CAGF,gEACE,oBDhEW,CCkEX,qFACE,eAAA,CACA,SAAA,CAIJ,mEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,kBDlEW",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-items-table__productiveHeading01___MPnNp",productiveHeading02:"-esm-stock-management__stock-items-table__productiveHeading02___E1KiC",productiveHeading03:"-esm-stock-management__stock-items-table__productiveHeading03___N33sp",productiveHeading04:"-esm-stock-management__stock-items-table__productiveHeading04___lh7n8",productiveHeading05:"-esm-stock-management__stock-items-table__productiveHeading05___ieA0n",productiveHeading06:"-esm-stock-management__stock-items-table__productiveHeading06___JPMyX",bodyShort01:"-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK",helperText01:"-esm-stock-management__stock-items-table__helperText01___uOks4",bodyShort02:"-esm-stock-management__stock-items-table__bodyShort02___d7A67",bodyLong01:"-esm-stock-management__stock-items-table__bodyLong01____Gl3H",bodyLong02:"-esm-stock-management__stock-items-table__bodyLong02___Dwoe9",label01:"-esm-stock-management__stock-items-table__label01___ANQCM",text02:"-esm-stock-management__stock-items-table__text02___ac1IL",container:"-esm-stock-management__stock-items-table__container___VONiZ",formContainer:"-esm-stock-management__stock-items-table__formContainer___o0XL5",verticalForm:"-esm-stock-management__stock-items-table__verticalForm___oOj2I",headerBtnContainer:"-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p",tileContainer:"-esm-stock-management__stock-items-table__tileContainer___N1eHZ",tile:"-esm-stock-management__stock-items-table__tile___ZZNjt",tileContent:"-esm-stock-management__stock-items-table__tileContent___SC542",content:"-esm-stock-management__stock-items-table__content___zdm4U",helper:"-esm-stock-management__stock-items-table__helper___kKhcQ",separator:"-esm-stock-management__stock-items-table__separator___JXP1R",toolbarContent:"-esm-stock-management__stock-items-table__toolbarContent___oBPmt",filterContainer:"-esm-stock-management__stock-items-table__filterContainer___hAyU2",dateAlign:"-esm-stock-management__stock-items-table__dateAlign___RNWUI",filtersAlign:"-esm-stock-management__stock-items-table__filtersAlign___TaNrL"};const l=i},2761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_{margin-bottom:150px}","",{version:3,sources:["webpack://./src/stock-locations/stock-locations-table.scss"],names:[],mappings:"AAAA,uEACE,mBAAA",sourceRoot:""}]),i.locals={loaderContainer:"-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_"};const l=i},965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-management-header__header___eKmgW{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;height:6rem;background-color:#fff;display:flex;padding-left:8px;justify-content:space-between}.-esm-stock-management__stock-management-header__left-justified-items___VpNpP{display:flex;flex-direction:row;align-items:center;cursor:pointer}.-esm-stock-management__stock-management-header__right-justified-items___IOVey{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;margin:.5rem}.-esm-stock-management__stock-management-header__page-name___CPqh1{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-management-header__page-labels___qR7PY{margin:1rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__date-and-location___Uxut9{display:flex;justify-content:flex-end;align-items:center;margin-right:1rem}.-esm-stock-management__stock-management-header__value___eLYN8{margin-left:.25rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__view___f_vFK{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-management-header/stock-management-header.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,gEC61BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD31BF,aEyCQ,CFxCR,WG0DW,CHzDX,qBDRM,CCSN,YAAA,CACA,gBAAA,CACA,6BAAA,CAGF,8EACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,cAAA,CAGF,+EC40BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD10BF,aEwBQ,CFvBR,YAAA,CAGF,mECs0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CDl0BJ,qEACE,WAAA,CAGF,gEACE,cAAA,CAGF,2EACE,YAAA,CACA,wBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,+DACE,kBAAA,CAGF,gEACE,cAAA,CAGF,8DC2yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA",sourceRoot:""}]),i.locals={header:"-esm-stock-management__stock-management-header__header___eKmgW","left-justified-items":"-esm-stock-management__stock-management-header__left-justified-items___VpNpP","right-justified-items":"-esm-stock-management__stock-management-header__right-justified-items___IOVey","page-name":"-esm-stock-management__stock-management-header__page-name___CPqh1","page-labels":"-esm-stock-management__stock-management-header__page-labels___qR7PY",middot:"-esm-stock-management__stock-management-header__middot___gwifp","date-and-location":"-esm-stock-management__stock-management-header__date-and-location___Uxut9",value:"-esm-stock-management__stock-management-header__value___eLYN8",view:"-esm-stock-management__stock-management-header__view___f_vFK"};const l=i},2496:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-operation__sectionTitle___t2vui{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-operation__modalBody___YyRxm{padding-bottom:1rem}.-esm-stock-management__add-stock-operation__actionsContainer___SDbLm{display:flex;justify-content:space-between;margin:5px}.-esm-stock-management__add-stock-operation__statusContainer___MzxxK{display:flex;margin-top:4px;gap:1rem}.-esm-stock-management__add-stock-operation__textHeading___eg7oM{font-weight:bold}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe{margin-top:4px}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe .-esm-stock-management__add-stock-operation__text___DFlMr{margin-right:4px}.-esm-stock-management__add-stock-operation__actionButtons___XhL8k{margin:10px;display:flex;flex-direction:row}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-operations/add-stock-operation/add-stock-operation.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCpDF,kEC+1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD71BA,aAAA,CACA,oBEoBS,CFjBb,+DACI,mBEqBS,CFlBb,sEACI,YAAA,CACA,6BAAA,CACA,UAAA,CAGJ,qEACI,YAAA,CACA,cAAA,CACA,QAAA,CAGJ,iEACI,gBAAA,CAGJ,wEACI,cAAA,CACA,kIACI,gBAAA,CAIR,mEACI,WAAA,CACA,YAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-operation__sectionTitle___t2vui",modalBody:"-esm-stock-management__add-stock-operation__modalBody___YyRxm",actionsContainer:"-esm-stock-management__add-stock-operation__actionsContainer___SDbLm",statusContainer:"-esm-stock-management__add-stock-operation__statusContainer___MzxxK",textHeading:"-esm-stock-management__add-stock-operation__textHeading___eg7oM",statusDescriptions:"-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe",text:"-esm-stock-management__add-stock-operation__text___DFlMr",actionButtons:"-esm-stock-management__add-stock-operation__actionButtons___XhL8k"};const l=i},6781:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const l=i},6360:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN .cds--data-table-content{height:calc(100vh - 150px)}","",{version:3,sources:["webpack://./src/stock-operations/add-stock-operation/stock-items-addition.component.scss"],names:[],mappings:"AACE,wGACE,0BAAA",sourceRoot:""}]),i.locals={tableContainer:"-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN"};const l=i},1256:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-operations-dialog__section___fLTYQ{margin:.5rem}.-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp{margin-bottom:.75rem}.-esm-stock-management__stock-operations-dialog__modalBody___xG3z2{padding-bottom:1rem}","",{version:3,sources:["webpack://./src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAGA,iEACE,YCiBW,CDdb,sEACE,oBCkBW,CDfb,mEACE,mBCmBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__stock-operations-dialog__section___fLTYQ",sectionTitle:"-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp",modalBody:"-esm-stock-management__stock-operations-dialog__modalBody___xG3z2"};const l=i},557:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__create-stock-report__reportContainer___pFGwm{min-height:15rem;display:flex;flex-direction:column;row-gap:1rem;padding:1rem}.-esm-stock-management__create-stock-report__reportButton___T0m6Q{padding:1rem}.-esm-stock-management__create-stock-report__sectionTitle___y25tl{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__subTitle___Pgm2N{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__modalBody___VVZO6{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/generate-report/create-stock-report.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,qEACE,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CACA,YAAA,CAEF,kEACE,YAAA,CAGF,kECm1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDj1BF,aDZQ,CCaR,oBEQW,CFLb,8DACE,cAAA,CACA,oBEGW,CAAA,+DFCX,mBEIW",sourceRoot:""}]),i.locals={reportContainer:"-esm-stock-management__create-stock-report__reportContainer___pFGwm",reportButton:"-esm-stock-management__create-stock-report__reportButton___T0m6Q",sectionTitle:"-esm-stock-management__create-stock-report__sectionTitle___y25tl",subTitle:"-esm-stock-management__create-stock-report__subTitle___Pgm2N",modalBody:"-esm-stock-management__create-stock-report__modalBody___VVZO6"};const l=i},5861:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-reports__content___A4qFU{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-reports__helper___J9F35{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-reports__separator___yNdhd{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-reports__separator___yNdhd::before,.-esm-stock-management__stock-reports__separator___yNdhd::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-reports__separator___yNdhd::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-reports__separator___yNdhd::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-reports__tileContainer___nLbej{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-reports__tile___L1giA{margin:auto;width:fit-content}.-esm-stock-management__stock-reports__tileContent___J975x{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/report-list/stock-reports.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,uDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,sDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,yDCm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-reports__content___A4qFU",helper:"-esm-stock-management__stock-reports__helper___J9F35",separator:"-esm-stock-management__stock-reports__separator___yNdhd",tileContainer:"-esm-stock-management__stock-reports__tileContainer___nLbej",tile:"-esm-stock-management__stock-reports__tile___L1giA",tileContent:"-esm-stock-management__stock-reports__tileContent___J975x"};const l=i},2033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-settings__productiveHeading01___L9i81,.-esm-stock-management__stock-settings__title____W_Wx{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__productiveHeading02___hss5P{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading03___fPfXI{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading04___nygs1{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading05___oSN3A{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading06___DHu2c{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyShort01___tYpmd{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__helperText01___ZY1nd{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__bodyShort02___iosfZ{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyLong01___HhqRS{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__bodyLong02___jSFlj{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__label01___lbC3K{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__text02___Vqsry{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-settings__container___BnGf9{padding:2rem}.-esm-stock-management__stock-settings__formContainer___nHBLE{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-settings__verticalForm___S9Wbd{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--form-item{flex:none !important}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-settings__StockSettings___IhIeT{display:flex;justify-content:center;flex-direction:column;justify-content:flex-end;min-height:12.5rem;border:1px solid #e0e0e0;margin:.5rem;align-items:center;background-color:#fff}.-esm-stock-management__stock-settings__StockSettings___IhIeT>button{margin-bottom:2rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-settings/stock-settings.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_layout.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0HC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,oEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,oECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,oECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,oEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,oEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,4DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,6DCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,4DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,2DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,2DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,wDCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,uDACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,0DACE,YEpCW,CFuCb,8DACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,6DACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,6EACE,oBAAA,CAGF,yEACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGrGJ,8DACI,YAAA,CACA,sBAAA,CACA,qBAAA,CACA,wBAAA,CACA,kBAAA,CACA,wBAAA,CACA,YDUS,CCTT,kBAAA,CACA,qBC6GM,CD3GN,qEACI,kBEKI",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-settings__productiveHeading01___L9i81",title:"-esm-stock-management__stock-settings__title____W_Wx",productiveHeading02:"-esm-stock-management__stock-settings__productiveHeading02___hss5P",productiveHeading03:"-esm-stock-management__stock-settings__productiveHeading03___fPfXI",productiveHeading04:"-esm-stock-management__stock-settings__productiveHeading04___nygs1",productiveHeading05:"-esm-stock-management__stock-settings__productiveHeading05___oSN3A",productiveHeading06:"-esm-stock-management__stock-settings__productiveHeading06___DHu2c",bodyShort01:"-esm-stock-management__stock-settings__bodyShort01___tYpmd",helperText01:"-esm-stock-management__stock-settings__helperText01___ZY1nd",bodyShort02:"-esm-stock-management__stock-settings__bodyShort02___iosfZ",bodyLong01:"-esm-stock-management__stock-settings__bodyLong01___HhqRS",bodyLong02:"-esm-stock-management__stock-settings__bodyLong02___jSFlj",label01:"-esm-stock-management__stock-settings__label01___lbC3K",text02:"-esm-stock-management__stock-settings__text02___Vqsry",container:"-esm-stock-management__stock-settings__container___BnGf9",formContainer:"-esm-stock-management__stock-settings__formContainer___nHBLE",verticalForm:"-esm-stock-management__stock-settings__verticalForm___S9Wbd",StockSettings:"-esm-stock-management__stock-settings__StockSettings___IhIeT"};const l=i},8098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-sources__section___NMR9P{margin:.5rem}.-esm-stock-management__add-stock-sources__sectionTitle___mIFZm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-sources__modalBody___QeuLr{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/add-stock-sources/add-stock-sources.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,2DACE,YCgBW,CDbb,gEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,6DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-sources__section___NMR9P",sectionTitle:"-esm-stock-management__add-stock-sources__sectionTitle___mIFZm",modalBody:"-esm-stock-management__add-stock-sources__modalBody___QeuLr"};const l=i},5551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-sources/stock-sources-filter/stock-sources-filter.scss"],names:[],mappings:"AACI,sGACE,KAAA,CAGF,gGACE,WAAA,CAGF,mHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5"};const l=i},6940:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-sources__container___WSslj{background-color:#f4f4f4}.-esm-stock-management__stock-sources__headerContainer___Ze03U{display:flex;justify-content:space-between;align-items:center;padding:1rem;background-color:#fff}.-esm-stock-management__stock-sources__headerButtons___diHXv{display:flex;flex-flow:column}.-esm-stock-management__stock-sources__heading___eDFEL{font-size:20px;font-weight:bold}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown--inline .cds--list-box__field{min-width:12rem}.-esm-stock-management__stock-sources__tooltip___CZOKY .cds--tooltip__trigger.cds--tooltip__trigger--definition{border-bottom:none}.-esm-stock-management__stock-sources__tag___KdICQ{margin:.25rem 0}.-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-sources__search___skZQ1{max-width:16rem}.-esm-stock-management__stock-sources__search___skZQ1 input{background-color:#fff !important}.-esm-stock-management__stock-sources__tableContainer___lpDEm{background-color:#f4f4f4;margin:0 1rem;padding:0}.-esm-stock-management__stock-sources__tableContainer___lpDEm a{text-decoration:none}.-esm-stock-management__stock-sources__tableContainer___lpDEm th{color:#525252}.-esm-stock-management__stock-sources__tableContainer___lpDEm .cds--data-table{background-color:#e0e0e0}.-esm-stock-management__stock-sources__tableContainer___lpDEm .-esm-stock-management__stock-sources__toolbarContent___gZ2MJ{height:2rem;margin-bottom:.25rem}.-esm-stock-management__stock-sources__emptyRow___wlFNH{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-sources__stockSourcesTable___KNEf1 tr:last-of-type td{border-bottom:none}.-esm-stock-management__stock-sources__content___EBUcR{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-sources__helper___Pxp0P{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-sources__separator___NUg2A{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-sources__separator___NUg2A::before,.-esm-stock-management__stock-sources__separator___NUg2A::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-sources__separator___NUg2A::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-sources__separator___NUg2A::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-sources__tileContainer___p2Nnr{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-sources__tile___ZRgFn{margin:auto;width:fit-content}.-esm-stock-management__stock-sources__tileContent___dm3Qq{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-sources__menuItem___Brdql{max-width:none}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__desktopHeading___tb1eK,.-esm-stock-management__stock-sources__tabletHeading___rIkv3{text-align:left;text-transform:capitalize;margin-bottom:1rem}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4:after,.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__stock-sources__statusContainer___meWIY{display:flex;align-items:center}.-esm-stock-management__stock-sources__statusContainer___meWIY svg{margin-right:.5rem}.-esm-stock-management__stock-sources__visitType___HhWht{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0)}.-esm-stock-management__stock-sources__headerBtnContainer___zSCLg{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q{margin-left:1rem;height:3rem}.-esm-stock-management__stock-sources__editIcon___A00kf{color:#0f62fe;margin-top:.5rem;cursor:pointer}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/stock-sources.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,yDACE,wBDNM,CCSR,+DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,YAAA,CACA,qBDPc,CCUhB,6DACE,YAAA,CACA,gBAAA,CAGF,uDACE,cAAA,CACA,gBAAA,CAIA,+FACE,KAAA,CAGF,yFACE,WAAA,CAGF,4GACE,eAAA,CAIJ,gHACE,kBAAA,CAGF,mDACE,eAAA,CAGF,+EACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,sDACE,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,wBDjEM,CCkEN,aAAA,CACA,SAAA,CAEA,gEACE,oBAAA,CAGF,iEACE,aC1BM,CD6BR,+EACE,wBD5EI,CC+EN,4HACE,WEzCS,CF0CT,oBEnES,CFuEb,wDACE,cAAA,CACA,YAAA,CACA,kBAAA,CAIA,oFACE,kBAAA,CAKJ,uDG8vBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH5vBF,aCtDQ,CDuDR,mBAAA,CAGF,sDGwvBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CHtvBF,aC5DQ,CD+DV,yDGmvBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CHjvBF,aCjEQ,CDkER,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnHM,CCoHN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7IM,CC8IN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,wDACE,cAAA,CAIA,iEG+rBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH7rBA,aCrHM,CD0HR,gEGwrBE,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CHtrBA,aC5HM,CDgIV,2HAEE,eAAA,CACA,yBAAA,CACA,kBErJW,CFuJX,6IACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2CAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CAEA,mEACE,kBAAA,CAIJ,yDG0pBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CHtpBJ,kEACE,qBDtMc,CCuMd,YE/KW,CFgLX,gBAAA,CAGF,mEACE,gBEpLW,CFqLX,WEjKW,CFoKb,wDACE,aDnMe,CCoMf,gBAAA,CACA,cAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-sources__container___WSslj",headerContainer:"-esm-stock-management__stock-sources__headerContainer___Ze03U",headerButtons:"-esm-stock-management__stock-sources__headerButtons___diHXv",heading:"-esm-stock-management__stock-sources__heading___eDFEL",filterContainer:"-esm-stock-management__stock-sources__filterContainer___SeMsL",tooltip:"-esm-stock-management__stock-sources__tooltip___CZOKY",tag:"-esm-stock-management__stock-sources__tag___KdICQ",backgroundDataFetchingIndicator:"-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ",search:"-esm-stock-management__stock-sources__search___skZQ1",tableContainer:"-esm-stock-management__stock-sources__tableContainer___lpDEm",toolbarContent:"-esm-stock-management__stock-sources__toolbarContent___gZ2MJ",emptyRow:"-esm-stock-management__stock-sources__emptyRow___wlFNH",stockSourcesTable:"-esm-stock-management__stock-sources__stockSourcesTable___KNEf1",content:"-esm-stock-management__stock-sources__content___EBUcR",helper:"-esm-stock-management__stock-sources__helper___Pxp0P",separator:"-esm-stock-management__stock-sources__separator___NUg2A",tileContainer:"-esm-stock-management__stock-sources__tileContainer___p2Nnr",tile:"-esm-stock-management__stock-sources__tile___ZRgFn",tileContent:"-esm-stock-management__stock-sources__tileContent___dm3Qq",menuItem:"-esm-stock-management__stock-sources__menuItem___Brdql",desktopHeading:"-esm-stock-management__stock-sources__desktopHeading___tb1eK",tabletHeading:"-esm-stock-management__stock-sources__tabletHeading___rIkv3",statusContainer:"-esm-stock-management__stock-sources__statusContainer___meWIY",visitType:"-esm-stock-management__stock-sources__visitType___HhWht",headerBtnContainer:"-esm-stock-management__stock-sources__headerBtnContainer___zSCLg",addPatientToListBtn:"-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q",editIcon:"-esm-stock-management__stock-sources__editIcon___A00kf"};const l=i},4300:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko{margin:.5rem}.-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X{padding-bottom:1rem}.-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));gap:16px}.-esm-stock-management__add-stock-user-role-scope__hr___S9Kir{border:1px solid #000}.-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts{margin:5px}.-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM{width:100%}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,mEACE,YCgBW,CDbb,wEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,oEACE,cAAA,CACA,oBCUW,CDPb,qEACE,mBCWW,CDRb,wEACE,YAAA,CACA,2DAAA,CACA,QAAA,CAGF,8DACE,qBAAA,CAGF,kEACE,UAAA,CAGF,oEACE,UAAA",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko",sectionTitle:"-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005",subTitle:"-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq",modalBody:"-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X",checkboxGrid:"-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg",hr:"-esm-stock-management__add-stock-user-role-scope__hr___S9Kir",toggle:"-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts",checkbox:"-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM"};const l=i},5104:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-user-role-scopes__content___g06Q8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-user-role-scopes__helper___VOKFX{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before,.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-user-role-scopes__tile___C5KRv{margin:auto;width:fit-content}.-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/stock-user-role-scopes.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,+DCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,kECm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,mJAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,0EACE,WAAA,CACA,gBAAA,CAGF,yEACE,UAAA,CACA,iBAAA,CAIJ,sEACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,6DACE,WAAA,CACA,iBAAA,CAGF,oEACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-user-role-scopes__content___g06Q8",helper:"-esm-stock-management__stock-user-role-scopes__helper___VOKFX",separator:"-esm-stock-management__stock-user-role-scopes__separator___M4cpF",tileContainer:"-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd",tile:"-esm-stock-management__stock-user-role-scopes__tile___C5KRv",tileContent:"-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa"};const l=i},2894:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deletePackagingUnitButton:()=>zs,deletePackagingUnitModal:()=>js,deleteStockModal:()=>Us,deleteUserScopeModal:()=>Ps,importBulkStockItemsDialog:()=>Fs,importTranslation:()=>ms,root:()=>Ts,startupApp:()=>Rs,stockItems:()=>hs,stockItemsLink:()=>bs,stockLocations:()=>ws,stockLocationsLink:()=>Ss,stockManagement:()=>Is,stockManagementAdminCardLink:()=>ps,stockManagementAppMenuItem:()=>Ls,stockNavMenu:()=>As,stockOperationDialog:()=>Bs,stockOperations:()=>vs,stockOperationsLink:()=>_s,stockOverview:()=>gs,stockOverviewLink:()=>fs,stockReports:()=>Ds,stockReportsLink:()=>Os,stockSettings:()=>xs,stockSettingsLink:()=>Ns,stockSources:()=>Cs,stockSourcesLink:()=>Es,stockUserScopes:()=>ys,stockUserScopesLink:()=>ks});var r=n(7248),o={printItemCost:{type:r.Type.Boolean,_default:!1,_description:"Whether to print item costs on the print out"},printBalanceOnHand:{type:r.Type.Boolean,_default:!1,_description:"Whether to print balance on hand on the print out"},packagingUnitsUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the packaging unit",_default:"bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2"},stockAdjustmentReasonUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock adjustment reasons",_default:"3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25"},stockSourceTypeUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock source types",_default:"2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d"},dispensingUnitsUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock dispensing units uuid",_default:"162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},stockItemCategoryUUID:{_type:r.Type.ConceptUuid,_description:"UUID for the stock item category",_default:"6d24eb6e-b42f-4706-ab2d-ae4472161f6a"},logo:{src:{_type:r.Type.String,_default:null,_description:"A path or URL to an image."},alt:{_type:r.Type.String,_default:"Logo",_description:"Alt text, shown on hover"},name:{_type:r.Type.String,_default:null,_description:"The organization name displayed when image is absent"}}},a=n(6478),i=n(1672),l=n.n(i),c=n(7410),s=n.n(c),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),f=n(2434),v=n.n(f),_=n(1422),h=n.n(_),b=n(7813),y={};y.styleTagTransform=h(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(b.Z,y);const k=b.Z&&b.Z.locals?b.Z.locals:void 0;var C=n(601);var E=n(3397);function w(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function S(){var e;return e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){return t=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){w(a,r,o,i,l,"next",e)}function l(e){w(a,r,o,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function D(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}var O=n(49),x={};x.styleTagTransform=h(),x.setAttributes=g(),x.insert=p().bind(null,"head"),x.domAPI=d(),x.insertStyleElement=v(),s()(O.Z,x);const N=O.Z&&O.Z.locals?O.Z.locals:void 0;var I=n(1256),T={};T.styleTagTransform=h(),T.setAttributes=g(),T.insert=p().bind(null,"head"),T.domAPI=d(),T.insertStyleElement=v(),s()(I.Z,T);const B=I.Z&&I.Z.locals?I.Z.locals:void 0;var U,P=n(9820);function j(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var r=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var r=e[t];return n&&(!1===r||!0===r||r)||!n&&(""===r||!1===r||!0===r||r)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r.toString())):null})).filter((function(e){return null!=e})).join("&");return r.length>0?"?"+r:""}function z(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function F(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function L(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function R(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e.uuid),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Default="default",e.Full="full",e.REF="ref"}(U||(U={}));var M=function(e){switch(e){case"NEW":return"#0f62fe";case"SUBMITTED":return"#4589ff";case"DISPATCHED":return"#8a3ffc";case"COMPLETED":return"#24a148";case"CANCELLED":return"#da1e28";case"RETURNED":return"#eb6200"}};function q(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}var G={isOverlayOpen:!1,component:Function,header:""},H=function(){return(0,r.getGlobalStore)("dispensing-store",G)},Z=function(e,t){H().setState({isOverlayOpen:!0,component:t,header:e})},Y=function(){H().setState({component:null,isOverlayOpen:!1})},Q=n(2653),J=n.n(Q),W=function(e,t){return e?J()(e).format(null!=t?t:"DD-MMM-YYYY"):""},V=("".concat(window.getOpenmrsSpaBase),J()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),K="d/m/Y",X=function(e){return W(e,V)},$=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},ee=Object.freeze({SOURCES:"Sources",OPERATION:"Operation",STATUS:"Status"}),te="Main Store",ne="/openmrs/",re=!0;function oe(e){var t,n,r,o,a,i=null==e||null===(n=e.responseBody)||void 0===n||null===(t=n.error)||void 0===t?void 0:t.fieldErrors;return i?Object.values(i).flatMap((function(e){return e.map((function(e){return e.message}))})):[null!==(a=null==e||null===(o=e.responseBody)||void 0===o||null===(r=o.error)||void 0===r?void 0:r.message)&&void 0!==a?a:null==e?void 0:e.message]}"".concat(ne,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var ae=function(e){(0,P.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!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 le(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ce(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||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}}(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.")}()}var se=n(8115);var ue=n(1657);const de=function(e){var t=e.row,n=(0,i.useCallback)((function(){var e=(0,r.showModal)("delete-packaging-unit-modal",{closeModal:function(){return e()},row:t})}),[t]);return l().createElement("div",null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:ue.ZN,onClick:n}))};function me(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function pe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ae(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockbatch").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function ge(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading,l=n.mutate;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a,mutate:l}}function fe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e,"?v=full"),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{item:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function ve(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem"),n=new AbortController;return delete e.isDrug,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function _e(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e.uuid),n=new AbortController;return delete e.isDrug,delete e.dateCreated,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}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 be(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}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.")}()}function ye(e){var t=be((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=be((0,i.useState)(),2),a=o[0],l=o[1];(0,i.useEffect)((function(){r({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:a})}),[a]);var c=ge(n),s=c.items,u=c.isLoading,d=c.isError,m=c.mutate;return{items:s.results,totalCount:s.totalCount,isLoading:u,isError:d,setStockItemUuid:l,mutate:m}}var ke=n(4158),Ce={};Ce.styleTagTransform=h(),Ce.setAttributes=g(),Ce.insert=p().bind(null,"head"),Ce.domAPI=d(),Ce.insertStyleElement=v(),s()(ke.Z,Ce);const Ee=ke.Z&&ke.Z.locals?ke.Z.locals:void 0;function we(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}var Se=n(1914),De=n(965),Oe={};Oe.styleTagTransform=h(),Oe.setAttributes=g(),Oe.insert=p().bind(null,"head"),Oe.domAPI=d(),Oe.insertStyleElement=v(),s()(De.Z,Oe);const xe=De.Z&&De.Z.locals?De.Z.locals:void 0,Ne=function(){return l().createElement("svg",{width:"72",height:"72",viewBox:"0 0 62 58",xmlns:"http://www.w3.org/2000/svg"},l().createElement("defs",null,l().createElement("path",{id:"whv9q6f4ta",d:"M0 0h62v30.508H0z"}),l().createElement("path",{id:"hp71ojgcnc",d:"M0 0h24.603v26.571H0z"})),l().createElement("g",{fill:"none"},l().createElement("g",{opacity:".193",transform:"matrix(-1 0 0 1 62 26.571)"},l().createElement("path",{d:"M62 0c0 16.85-13.916 30.508-31.037 30.508S0 16.849 0 0h62z",fill:"var(--brand-03)",mask:"url(#rt0c8mo6eb)"})),l().createElement("g",{opacity:".396",transform:"matrix(-1 0 0 1 60.032 0)"},l().createElement("path",{d:"m24.603 26.571-13.35-23.51C9.592.141 5.884-.869 3.011.817.138 2.503-.855 6.272.804 9.193l9.874 17.378",fill:"var(--brand-03)",mask:"url(#hgianthqwd)"}))))};var Ie=n(9375),Te=n(2411),Be=function(){var e,t=(0,E.useTranslation)().t,n=(0,r.useSession)(),o=null==n||null===(e=n.sessionLocation)||void 0===e?void 0:e.display;return l().createElement("div",{className:xe.header},l().createElement("div",{className:xe["left-justified-items"]},l().createElement(Ne,null),l().createElement("div",{className:xe["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:xe["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:xe["right-justified-items"]},l().createElement("div",{className:xe["date-and-location"]},l().createElement(Ie.Ye,{size:16}),l().createElement("span",{className:xe.value},o),l().createElement("span",{className:xe.middot},"·"),l().createElement(Te.f,{size:16}),l().createElement("span",{className:xe.value},(0,r.formatDate)(new Date,{mode:"standard"})))))};const Ue=function(e){var t=e.dashboardSlot,n=e.title;return l().createElement(l().Fragment,null,l().createElement(Be,null),l().createElement(r.ExtensionSlot,{name:t,state:{dashboardTitle:n}}))};var Pe=n(3011),je={};je.styleTagTransform=h(),je.setAttributes=g(),je.insert=p().bind(null,"head"),je.domAPI=d(),je.insertStyleElement=v(),s()(Pe.Z,je);const ze=Pe.Z&&Pe.Z.locals?Pe.Z.locals:void 0;var Fe=n(6194),Le=n(2296),Re={};Re.styleTagTransform=h(),Re.setAttributes=g(),Re.insert=p().bind(null,"head"),Re.domAPI=d(),Re.insertStyleElement=v(),s()(Le.Z,Re);const Me=Le.Z&&Le.Z.locals?Le.Z.locals:void 0,qe=function(){var e=function(){var e,t,n=(e=(0,i.useState)(),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return q(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)?q(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.")}()),r=n[0],o=n[1];return(0,i.useEffect)((function(){var e=function(e){o(e)};e(H().getState()),H().subscribe(e)}),[]),{isOverlayOpen:null==r?void 0:r.isOverlayOpen,component:null==r?void 0:r.component,header:null==r?void 0:r.header}}(),t=e.header,n=e.component,o=e.isOverlayOpen,c=(0,r.useLayoutType)(),s=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,o&&l().createElement("div",{className:"tablet"!==c?Me.desktopOverlay:Me.tabletOverlay},"tablet"!==c?l().createElement("div",{className:Me.desktopHeader},l().createElement("div",{className:Me.headerContent},t),l().createElement(a.zxk,{className:Me.closePanelButton,onClick:function(){return Y()},kind:"ghost",hasIconOnly:!0},l().createElement(Fe.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Y()},"aria-label":s("tabletOverlay","Tablet overlay"),className:Me.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(se.Xd,{size:16})),l().createElement("div",{className:Me.headerContent},t)),l().createElement("div",null,n)))};function Ge(){var e,t=(0,Se.useParams)(),n=(0,r.useExtensionStore)(),o=(0,r.useLayoutType)(),a=(null===(e=n.slots["stock-page-dashboard-slot"])||void 0===e?void 0:e.assignedExtensions.map((function(e){return e.meta})).filter((function(e){return Object.keys(e).length})))||[],i=a.find((function(e){return e.name===(null==t?void 0:t.dashboard)}))||a[0];return l().createElement(l().Fragment,null,l().createElement(qe,null),l().createElement("div",{className:ze.homePageWrapper},l().createElement("section",{className:(0,r.isDesktop)(o)?ze.dashboardContainer:ze.dashboardContainerTablet},(0,r.isDesktop)(o)&&l().createElement(r.ExtensionSlot,{name:"stock-sidebar-slot",key:o}),l().createElement(Ue,{title:null==i?void 0:i.name,dashboardSlot:null==i?void 0:i.slot})),l().createElement(r.WorkspaceContainer,{overlay:!0,contextKey:"stock-management"})))}var He=n(2426),Ze={};Ze.styleTagTransform=h(),Ze.setAttributes=g(),Ze.insert=p().bind(null,"head"),Ze.domAPI=d(),Ze.insertStyleElement=v(),s()(He.Z,Ze);const Ye=He.Z&&He.Z.locals?He.Z.locals:void 0;var Qe=n(3432),Je={};Je.styleTagTransform=h(),Je.setAttributes=g(),Je.insert=p().bind(null,"head"),Je.domAPI=d(),Je.insertStyleElement=v(),s()(Qe.Z,Je);const We=Qe.Z&&Qe.Z.locals?Qe.Z.locals:void 0;var Ve=n(9697),Ke=n(7412),Xe=n.n(Ke);J().extend(Xe());const $e=function(e){var t,n,o,i,c,s=e.label,u=e.value,d=e.headerLabel,m=e.children,p=e.view,A=e.count,g=e.outofstockCount,f=e.disposedCount,v=(0,E.useTranslation)().t;return l().createElement(a.n9L,{className:We.tileContainer},l().createElement("div",{className:We.tileHeader},l().createElement("div",{className:We.headerLabelContainer},l().createElement("label",{className:We.headerLabel},d),m),p&&l().createElement(r.ConfigurableLink,{className:We.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(se.ol,{size:16,className:We.viewListBtn}))),l().createElement("div",{className:We.metricsGrid},l().createElement("div",null,l().createElement("label",{className:We.totalsLabel},s),l().createElement("p",{className:We.totalsValue},u)),!(0,Ve.Z)(A)&&l().createElement("div",{className:We.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("in6Months","In 6 months")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=A.expiry6months)||void 0===t?void 0:t.length)),!(0,Ve.Z)(g)&&l().createElement("div",{className:We.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("itemsBelowMin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},v("itemsAboveMax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(n=g.itemsbelowmin)||void 0===n?void 0:n.length),l().createElement("p",{style:{color:"#319227"}},null===(o=g.itemsabovemax)||void 0===o?void 0:o.length)),!(0,Ve.Z)(f)&&l().createElement("div",{className:We.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},v("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(i=f.expired)||void 0===i?void 0:i.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(c=f.poorquality)||void 0===c?void 0:c.length))))};function et(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){var t,n,r,o=(n=(0,i.useState)({v:e||U.Default,q:null,totalCount:!0}),r=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(n,r)||function(e,t){if(e){if("string"==typeof e)return et(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)?et(e,t):void 0}}(n,r)||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.")}()),a=o[0],l=o[1],c=me(a),s=c.items,u=c.isLoading,d=c.isError;return(0,i.useEffect)((function(){l({v:U.Default,totalCount:!0})}),[]),{items:null!==(t=null==s?void 0:s.results)&&void 0!==t?t:[],isLoading:u,isError:d}}function nt(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 rt(){var e,t,n=(e=(0,i.useState)({startIndex:0,v:U.Default,q:null,includeStockItemName:"true"}),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nt(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)?nt(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.")}()),r=n[0],o=n[1];(0,i.useEffect)((function(){o({v:U.Default,includeStockItemName:"true"})}),[]);var a,l=Ae(r),c=l.items,s=l.isLoading,u=l.isError;return{items:null!==(a=c.results)&&void 0!==a?a:[],isLoading:s,isError:u}}function ot(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const at=function(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockitem?v=default&totalCount=true"),t=(0,P.ZP)(e,r.openmrsFetch),n=t.data,o=t.error,a=null==n?void 0:n.data.results.map((function(e){return{uuid:e.uuid,hasExpiration:e.hasExpiration,expiryNotice:e.expiryNotice}}));return{stockList:null!=a?a:[],isLoading:!n&&!o,error:o}}(),o=n.stockList,i=n.isLoading,c=n.error,s=rt(),u=s.items,d=(s.isLoading,tt().items),m=new Date,p=u.map((function(e){var t=null==d?void 0:d.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(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){ot(e,t,n[t])}))}return e}({},e,t)}));p=p.filter((function(e){return e.hasExpiration}));var A=p.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),r=Math.ceil((n.getTime()-m.getTime())/864e5);return r<=t||r<0})),g=A.filter((function(e){return e.hasExpiration&&e.expiryNotice<=180})),f=function(e){var t,n=z(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(c)return l().createElement(r.ErrorState,{headerTitle:t("errorStockMetric"),error:c});var v=f&&f.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),_=f&&f.filter((function(e){return"Poor Quality"===e.reasonName}));return l().createElement(l().Fragment,null,l().createElement("div",{className:Ye.cardContainer},l().createElement($e,{label:t("stocks","Expiring stock"),value:(null==A?void 0:A.length)||0,headerLabel:t("expiringStock","Expiring Stock"),view:"items",count:{expiry6months:g}}),l().createElement($e,{label:t("outofstock","Out of Stock"),value:null==o?void 0:o.length,headerLabel:t("highestServiceVolume","Out of Stock "),view:"items",outofstockCount:{itemsbelowmin:["0"],itemsabovemax:["0"]}}),l().createElement($e,{label:t("disposedstock","Disposed Stock"),value:(null==f?void 0:f.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:v,poorquality:_}})))};var it=n(8629),lt={};lt.styleTagTransform=h(),lt.setAttributes=g(),lt.insert=p().bind(null,"head"),lt.domAPI=d(),lt.insertStyleElement=v(),s()(it.Z,lt);const ct=it.Z&&it.Z.locals?it.Z.locals:void 0;var st=n(4797);function ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),rt()),n=t.items,o=t.isLoading,i=tt(),c=i.items;if(i.isLoading||o)return l().createElement(l().Fragment,null);if(0===(null==c?void 0:c.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:ct.content},e("inventoryAlertNull","No inventory alerts to display")));var s=new Date,u=n.map((function(e){var t=null==c?void 0:c.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(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){ut(e,t,n[t])}))}return e}({},e,t)}));u=u.filter((function(e){return e.hasExpiration}));var d=u.filter((function(e){var t=new Date(e.expiration),n=Math.ceil((t.getTime()-s.getTime())/864e5);return n<=180&&n>=0})).slice(0,5);return l().createElement(l().Fragment,null,d.map((function(e,t){return l().createElement("div",{className:ct.card,key:t},l().createElement("div",{className:ct.colorLineRed}),l().createElement("div",{className:ct.icon},l().createElement(st.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:ct.cardText},l().createElement("p",null,"EXPIRING STOCK"),l().createElement("p",null,l().createElement("strong",null,null==e?void 0:e.drugName)," ",null==e?void 0:e.dispensingUnitName)))})),l().createElement(a.zxk,{onClick:function(){(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/expired-stock")})},kind:"ghost"},"View All"))};var mt=n(8748);const pt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=z(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"receipt"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0})),n=t.items;return t.isLoading?l().createElement(l().Fragment,null):0===(null==n?void 0:n.length)?l().createElement(l().Fragment,null,l().createElement("p",{className:ct.content},e("receivedNull","No received to display"))):l().createElement(l().Fragment,null,null==n?void 0:n.map((function(e,t){return null==e?void 0:e.stockOperationItems.map((function(n){return l().createElement("div",{className:ct.card,key:t},l().createElement("div",{className:ct.colorLineBlue}),l().createElement("div",{className:ct.icon},l().createElement(mt.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:ct.cardText},l().createElement("p",null,null==e?void 0:e.status," · ",null==e?void 0:e.sourceName," · ",null==e?void 0:e.destinationName),l().createElement("p",null,l().createElement("strong",null,null==n?void 0:n.stockItemName)," ",null==n?void 0:n.stockItemPackagingUOMName,", ",null==n?void 0:n.quantity)))}))})),l().createElement(a.zxk,{onClick:function(){(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/orders")})},kind:"ghost"},e("receivedView","View All")))};var At=n(2327);const gt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=z(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"stockissue"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0})),n=t.items;if(t.isLoading)return l().createElement(l().Fragment,null);if(0===(null==n?void 0:n.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:ct.content},e("issuingNull","No issued to display")));var o=null==n?void 0:n.map((function(e,t){return((null==e?void 0:e.stockOperationItems)||[]).map((function(n,r){return{status:null==e?void 0:e.status,sourceName:null==e?void 0:e.sourceName,destinationName:null==e?void 0:e.destinationName,stockItemName:null==n?void 0:n.stockItemName,stockItemPackagingUOMName:null==n?void 0:n.stockItemPackagingUOMName,quantity:null==n?void 0:n.quantity,key:"".concat(t,"-").concat(r)}}))})),i=null==o?void 0:o.flat().slice(0,10);return l().createElement(l().Fragment,null,null==i?void 0:i.map((function(e,t){return l().createElement("div",{className:ct.card,key:t},l().createElement("div",{className:ct.colorLineGreen}),l().createElement("div",{className:ct.icon},l().createElement(At.rs,{size:40,color:"#198038"})),l().createElement("div",{className:ct.cardText},l().createElement("p",null,null==e?void 0:e.status," · ",null==e?void 0:e.sourceName," · ",null==e?void 0:e.destinationName),l().createElement("p",null,l().createElement("strong",null,null==e?void 0:e.stockItemName)," ",null==e?void 0:e.stockItemPackagingUOMName,", ",null==e?void 0:e.quantity)))})),l().createElement(a.zxk,{onClick:function(){(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/requisitions")})},kind:"ghost"},"View All"))},ft=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:ct.cardContainer},l().createElement("div",{className:ct.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?ct.tabletHeading:ct.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(dt,null)))),l().createElement("div",{className:ct.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?ct.tabletHeading:ct.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(pt,null)))),l().createElement("div",{className:ct.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?ct.tabletHeading:ct.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(gt,null)))))};function vt(e){var t=e.dashboardLinkConfig,n=t.name,o=t.title,a=(0,Se.useLocation)(),c="".concat(window.spaBase,"/stock-management"),s=(0,i.useMemo)((function(){var e=a.pathname.split("/"),t=e[e.length-1];return decodeURIComponent(t)}),[a.pathname]);return l().createElement(r.ConfigurableLink,{to:"".concat(c,"/").concat(n),className:"cds--side-nav__link ".concat(s.match(n)&&"active-left-nav-link")},o)}var _t=function(e){return function(){return l().createElement(Se.BrowserRouter,null,l().createElement(vt,{dashboardLinkConfig:e}))}};function ht(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){var t,n,o=z(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ht(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)?ht(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.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,E.useTranslation)().t,v=(0,i.useMemo)((function(){return[{id:0,header:f("type","Type"),key:"operationTypeName"},{id:1,header:f("number","Number"),key:"operationNumber"},{id:2,header:f("status","Status"),key:"status"},{id:3,header:f("location","Location"),key:"location"},{id:4,header:f("responsiblePerson","Responsible Person"),key:"responsiblePerson"},{id:5,header:f("date","Date"),key:"operationDate"},{id:6,key:"details"},{key:"actions",header:""}]}),[f]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:v}}var yt=n(1535),kt={};kt.styleTagTransform=h(),kt.setAttributes=g(),kt.insert=p().bind(null,"head"),kt.domAPI=d(),kt.insertStyleElement=v(),s()(yt.Z,kt);const Ct=yt.Z&&yt.Z.locals?yt.Z.locals:void 0;var Et="RETURNED",wt="CANCELLED",St="REJECTED",Dt=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Et,wt,St],Ot=n(6817),xt=n(4642);function Nt(){var e,t,n="".concat(r.fhirBaseUrl,"/Location?_summary=data&_tag=main store,main pharmacy,dispensary "),o=(0,P.ZP)(n,r.openmrsFetch),a=o.data,l=o.error,c=o.isLoading,s=(0,i.useMemo)((function(){var e,t,n;return null!==(n=null==a||null===(t=a.data)||void 0===t||null===(e=t.entry)||void 0===e?void 0:e.map((function(e){return e.resource})))&&void 0!==n?n:[]}),[null==a||null===(e=a.data)||void 0===e?void 0:e.entry]);return{stockLocations:null!==(t=(0,xt.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}function It(e){var t="".concat(r.restBaseUrl,"/role").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Tt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default"),t=(0,P.ZP)(e,r.openmrsFetch),n=t.data,o=t.isLoading,a=t.error;return{types:(null==n?void 0:n.data)||{},isLoading:o,isError:a}}function Bt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default");return(0,r.openmrsFetch)(e)}function Ut(e){var t="".concat(r.restBaseUrl,"/user").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Pt(e){var t="".concat(r.restBaseUrl,"/concept/").concat(e),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function jt(){var e="".concat(r.restBaseUrl,"/stockmanagement/userrolescope");return(0,r.openmrsFetch)(e)}function zt(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 Ft=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Tt(),c=o.types.results,s=o.isLoading,u=o.isError,d=function(){var e,t=(0,r.useSession)().user,n="".concat(r.restBaseUrl,"/stockmanagement/userrolescope"),o=(0,P.ZP)(n,r.openmrsFetch),a=o.data,i=o.isLoading,l=o.error;return{userRoles:null==a||null===(e=a.data)||void 0===e?void 0:e.results.find((function(e){return e.userUuid===t.uuid})),isLoading:i,error:l}}().userRoles,m=(0,i.useMemo)((function(){var e,t,n=(null==d||null===(e=d.operationTypes)||void 0===e?void 0:e.map((function(e){return e.operationTypeUuid})))||[],r=function(e){if(Array.isArray(e))return zt(e)}(t=new Set(n))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return zt(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)?zt(e,t):void 0}}(t)||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.")}();return(null==c?void 0:c.filter((function(e){return r.includes(e.uuid)})))||[]}),[c,d]);return(0,i.useEffect)((function(){null==n||n(m)}),[m,n]),s||u?l().createElement(a.Db,null):l().createElement(a.PQB,{renderIcon:function(){return l().createElement(l().Fragment,null,"Start New ",l().createElement(Ot.r4,{size:16}))},menuOffset:{right:"-100px"},style:{backgroundColor:"#007d79",backgroundImage:"none",color:"#fff",minHeight:"1rem",padding:".95rem !important",width:"8rem",marginRight:"0.5rem",whiteSpace:"nowrap"}},m.sort((function(e,t){return e.name.localeCompare(t.name)})).map((function(e){return l().createElement(a.laM,{key:e.uuid,itemText:e.name,onClick:function(){null==t||t(e)}})})))};var Lt=n(5260),Rt={};Rt.styleTagTransform=h(),Rt.setAttributes=g(),Rt.insert=p().bind(null,"head"),Rt.domAPI=d(),Rt.insertStyleElement=v(),s()(Lt.Z,Rt);const Mt=Lt.Z&&Lt.Z.locals?Lt.Z.locals:void 0,qt=function(e){var t=e.tabs,n=e.title,r=e.hasContainer,o=e.selectedIndex,i=e.onChange;return l().createElement("div",{className:"\n ".concat(r?Mt.tabContainer:"","\n ").concat(Mt.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Mt.heading},n),l().createElement("div",{className:Mt.tab},l().createElement(a.mQc,{className:"".concat(Mt.verticalTabs),selectedIndex:o,onChange:function(e){var t=e.selectedIndex;return null==i?void 0:i(t)}},l().createElement(a.tdY,{"aria-label":"navigation"},t.map((function(e,t){return l().createElement(a.OK9,{key:t,disabled:e.disabled},e.name)}))),l().createElement(a.nPR,null,t.map((function(e,t){return l().createElement(a.x45,{key:t},e.component)}))))))};var Gt,Ht;function Zt(e){return"transferout"===(e=e.toLowerCase())?"transferout":"disposed"===e?"disposed":"stockissue"===e?"stockissue":"stocktake"===e?"stocktake":"requisition"===e?"requisition":"receipt"===e?"receipt":"return"===e?"return":"adjustment"===e?"adjustment":"initial"===e?"initial":void 0}(Ht=Gt||(Gt={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Ht.DISPOSED_OPERATION_TYPE="disposed",Ht.STOCK_ISSUE_OPERATION_TYPE="stockissue",Ht.STOCK_TAKE_OPERATION_TYPE="stocktake",Ht.REQUISITION_OPERATION_TYPE="requisition",Ht.OPENING_STOCK_OPERATION_TYPE="initial",Ht.RECEIPT_OPERATION_TYPE="receipt",Ht.RETURN_OPERATION_TYPE="return",Ht.ADJUSTMENT_OPERATION_TYPE="adjustment";var Yt=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Qt=function(e){return!Jt(e)&&"requisition"!==e},Jt=function(e){return"receipt"===e||"initial"===e},Wt=function(e){return"requisition"===e},Vt=function(e){return"receipt"===e||"initial"===e},Kt=function(e){return"stockissue"===e||"return"===e},Xt=function(e){return"stockissue"===e||$t(e)||en(e)||tn(e)},$t=function(e){return"requisition"===e},en=function(e){return"receipt"===e},tn=function(e){return"transferout"===e},nn=n(7536),rn=n(6312),on=n(1604),an=on.z.object({id:on.z.string().nullish(),uuid:on.z.string().nullish(),stockItemUuid:on.z.string().nullish(),packagingUomName:on.z.string().nullish(),packagingUomUuid:on.z.string().nullish(),factor:on.z.number().nullish(),isDefaultStockOperationsUoM:on.z.boolean().nullish(),isDispensingUnit:on.z.boolean().nullish()}),ln=on.z.object({canView:on.z.boolean(),canEdit:on.z.boolean(),canApprove:on.z.boolean().nullish(),canReceiveItems:on.z.boolean().nullish(),canDisplayReceivedItems:on.z.boolean().nullish(),isRequisitionAndCanIssueStock:on.z.boolean().nullish(),canUpdateBatchInformation:on.z.boolean().nullish()}),cn=on.z.object({itemIndex:on.z.number().nullish(),id:on.z.string().nullish(),uuid:on.z.string().nullish(),stockItemUuid:on.z.string().nullish(),stockItemName:on.z.string().nullish(),stockItemPackagingUOMUuid:on.z.string().nullish(),stockItemPackagingUOMName:on.z.string().nullish(),stockBatchUuid:on.z.string().nullish(),batchNo:on.z.string().nullish(),expiration:on.z.coerce.date().nullish(),quantity:on.z.number().nullish(),purchasePrice:on.z.number().nullish(),permission:ln.nullish(),edit:on.z.boolean().nullish(),hasExpiration:on.z.boolean().nullish(),packagingUnits:an.array(),quantityReceived:on.z.number().nullish(),quantityReceivedPackagingUOMName:on.z.string().nullish(),quantityReceivedPackagingUOMUuid:on.z.string().nullish(),quantityRequested:on.z.number().nullish(),quantityRequestedPackagingUOMUuid:on.z.string().nullish(),quantityRequestedPackagingUOMName:on.z.string().nullish(),commonName:on.z.string().nullish(),acronym:on.z.string().nullish()}),sn=(on.z.object({uuid:on.z.string().nullish(),cancelReason:on.z.string().nullish(),cancelledBy:on.z.coerce.number(),cancelledByGivenName:on.z.string().nullish(),cancelledByFamilyName:on.z.string().nullish(),cancelledDate:on.z.coerce.date(),completedBy:on.z.coerce.number(),completedByGivenName:on.z.string().nullish(),completedByFamilyName:on.z.string().nullish(),completedDate:on.z.coerce.date(),destinationUuid:on.z.string().nullish(),destinationName:on.z.string().nullish(),externalReference:on.z.string().nullish(),atLocationUuid:on.z.string().nullish(),atLocationName:on.z.string().nullish(),operationDate:on.z.coerce.date(),submitted:on.z.boolean(),submittedBy:on.z.string().nullish(),submittedByGivenName:on.z.string().nullish(),submittedByFamilyName:on.z.string().nullish(),locked:on.z.boolean(),operationNumber:on.z.string().nullish(),operationOrder:on.z.coerce.number(),remarks:on.z.string().nullish(),sourceUuid:on.z.string().nullish(),sourceName:on.z.string().nullish(),status:on.z.enum(Dt),returnReason:on.z.string().nullish(),rejectionReason:on.z.string().nullish(),operationTypeUuid:on.z.string().nullish(),operationType:on.z.string().nullish(),operationTypeName:on.z.string().nullish(),responsiblePerson:on.z.coerce.number(),responsiblePersonUuid:on.z.string().nullish(),responsiblePersonGivenName:on.z.string().nullish(),responsiblePersonFamilyName:on.z.string().nullish(),responsiblePersonOther:on.z.string().nullish(),creator:on.z.coerce.number(),dateCreated:on.z.coerce.date(),creatorGivenName:on.z.string().nullish(),creatorFamilyName:on.z.string().nullish(),permission:ln.nullish(),reasonUuid:on.z.string().nullish(),reasonName:on.z.string().nullish(),approvalRequired:on.z.boolean().nullish(),stockOperationItems:cn.array(),submittedDate:on.z.coerce.date(),returnedByGivenName:on.z.string().nullish(),returnedByFamilyName:on.z.string().nullish(),returnedDate:on.z.coerce.date(),rejectedByGivenName:on.z.string().nullish(),rejectedByFamilyName:on.z.string().nullish(),rejectedDate:on.z.coerce.date(),dispatchedByGivenName:on.z.string().nullish(),dispatchedByFamilyName:on.z.string().nullish(),dispatchedDate:on.z.coerce.date(),requisitionStockOperationUuid:on.z.string()}),on.z.object({operationDate:on.z.coerce.date(),sourceUuid:on.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:on.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:on.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:on.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:on.z.string().nullish(),remarks:on.z.string().nullish()})),un=function(e){switch(e){case Gt.OPENING_STOCK_OPERATION_TYPE:return sn.omit({destinationUuid:!0,reasonUuid:!0});case Gt.STOCK_TAKE_OPERATION_TYPE:case Gt.ADJUSTMENT_OPERATION_TYPE:case Gt.DISPOSED_OPERATION_TYPE:return sn.omit({destinationUuid:!0});case Gt.TRANSFER_OUT_OPERATION_TYPE:case Gt.STOCK_ISSUE_OPERATION_TYPE:return sn.omit({reasonUuid:!0}).merge(on.z.object({destinationUuid:on.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Gt.RETURN_OPERATION_TYPE:case Gt.REQUISITION_OPERATION_TYPE:case Gt.RECEIPT_OPERATION_TYPE:return sn.omit({reasonUuid:!0}).merge(on.z.object({sourceUuid:on.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const dn=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:e.parties,onChange:function(t){var n,r;null===(n=e.onPartyChange)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null===(n=e.parties)||void 0===n?void 0:n.find((function(t){return t.uuid===e.partyUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:i,invalid:e.invalid,invalidText:e.invalidText})}})};function mn(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 pn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mn(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)?mn(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 An(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 gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(0,i.useRef)();return(0,i.useEffect)((function(){return function(){n.current&&clearTimeout(n.current)}}),[]),function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var i=setTimeout((function(){var t;e.apply(void 0,function(e){if(Array.isArray(e))return An(e)}(t=o)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return An(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)?An(e,t):void 0}}(t)||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.")}())}),t);clearTimeout(n.current),n.current=i}}var fn=function(){return{atLocationName:"",atLocationUuid:"",cancelReason:"",cancelledBy:0,cancelledByFamilyName:"",cancelledByGivenName:"",cancelledDate:void 0,completedBy:0,completedByFamilyName:"",completedByGivenName:"",completedDate:void 0,creator:0,creatorFamilyName:"",creatorGivenName:"",dateCreated:void 0,destinationName:"",destinationUuid:"",dispatchedByFamilyName:"",dispatchedByGivenName:"",dispatchedDate:void 0,externalReference:"",locked:!1,operationDate:new Date,operationNumber:"",operationOrder:0,operationType:"",operationTypeName:"",operationTypeUuid:"",permission:void 0,reasonName:"",reasonUuid:"",rejectedByFamilyName:"",rejectedByGivenName:"",rejectedDate:void 0,rejectionReason:"",remarks:"",requisitionStockOperationUuid:"",responsiblePerson:0,responsiblePersonFamilyName:"",responsiblePersonGivenName:"",responsiblePersonOther:"",responsiblePersonUuid:"",returnReason:"",returnedByFamilyName:"",returnedByGivenName:"",returnedDate:void 0,sourceName:"",sourceUuid:"",status:void 0,stockOperationItems:[],submitted:!1,submittedBy:"",submittedByFamilyName:"",submittedByGivenName:"",submittedDate:void 0,uuid:""}},vn={uuid:"Other",display:"Other",person:{display:"Other"}};function _n(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const hn=function(e){var t=function(e){var t=pn((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=Ut(n),a=o.items.results,l=o.isLoading,c=pn((0,i.useState)(null),2),s=c[0],u=c[1],d=pn((0,i.useState)(10),2),m=d[0],p=d[1],A=pn((0,i.useState)(U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s})}),[s,m,g]),{userList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(),n=t.isLoading,r=t.userList,o=t.setSearchString,c=gn((function(e){o(e)}),1e3);return r&&r.push(vn),l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,s=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:r||[],onChange:function(t){var n,r;null===(n=e.onUserChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:null!==(n=null==r?void 0:r.find((function(t){return t.uuid===e.userUuid})))&&void 0!==n?n:"",itemToString:_n,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};function bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const yn=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.oil,(n=function(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){bn(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.id,ref:s,value:null!=c?c:e.value})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n))}})},kn=function(e){var t=Pt((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{labelText:e.title,placeholder:e.placeholder,name:e.name,controllerName:e.controllerName,id:e.name,size:"md",items:i,initialSelectedItem:(null==i?void 0:i.find((function(t){return t.uuid===e.reasonUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},onChange:function(t){var n,o;null===(n=e.onReasonChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),r(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};function Cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const En=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.Kx8,(n=function(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){Cn(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.name,ref:s,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n))}})};var wn=[Gt.ADJUSTMENT_OPERATION_TYPE,Gt.RECEIPT_OPERATION_TYPE,Gt.STOCK_ISSUE_OPERATION_TYPE,Gt.STOCK_TAKE_OPERATION_TYPE,Gt.RETURN_OPERATION_TYPE,Gt.DISPOSED_OPERATION_TYPE,Gt.OPENING_STOCK_OPERATION_TYPE,Gt.TRANSFER_OUT_OPERATION_TYPE],Sn=[Gt.ADJUSTMENT_OPERATION_TYPE,Gt.DISPOSED_OPERATION_TYPE,Gt.STOCK_TAKE_OPERATION_TYPE,Gt.OPENING_STOCK_OPERATION_TYPE];function Dn(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 On(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Dn(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)?Dn(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 In=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_=e.model,h=e.onSave,b=e.operation,y=e.canEdit,k=e.isEditing,C=e.setup,w=C.requiresStockAdjustmentReason,S=C.shouldLockSource,D=C.shouldLockDestination,O=C.sourcePartyList,x=C.destinationPartyList,I=(0,E.useTranslation)().t,T=bt({v:U.Full,totalCount:!0}).isLoading,B=Zt(null==b?void 0:b.operationType),P=(m=(d=_).sourceUuid,p=d.sourceName,A=d.destinationUuid,g=d.destinationName,f=function(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){xn(e,t,n[t])}))}return e}({},d),v=null!=(v={sourceUuid:A,sourceName:g,destinationUuid:m,destinationName:p})?v:{},Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(v)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(v)).forEach((function(e){Object.defineProperty(f,e,Object.getOwnPropertyDescriptor(v,e))})),f),j=(0,nn.cI)({defaultValues:"stockissue"===B?P:_,mode:"all",resolver:(0,rn.F)(un(B))}),z=j.handleSubmit,F=j.control,L=j.formState.errors,R=j.setValue,M=Nn((0,i.useState)(),2),q=M[0],G=M[1],H=Nn((0,i.useState)(!1),2),Z=H[0],Y=H[1];if(T)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:I("loadingData","Loading data...")});var Q,J,W,ee,te,ne,re=function(){var e,t=(e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),Y(!0),t=function(e,t,n){var r=Object.assign(e,t);return function(e,t){["submitted","cancelledByFamilyName","atLocationName","completedByGivenName","cancelledBy","submittedByFamilyName","operationOrder","dispatchedByGivenName","submittedByGivenName","returnedByGivenName","operationNumber","responsiblePersonFamilyName","returnReason","atLocationUuid","cancelReason","rejectedByGivenName","reasonName","submittedBy","creator","completedByFamilyName","operationTypeName","rejectedByFamilyName","responsiblePerson","creatorFamilyName","returnedByFamilyName","cancelledByGivenName","operationType","responsiblePersonGivenName","sourceName","rejectionReason","completedBy","creatorGivenName","dispatchedByFamilyName","uuid"].forEach((function(t){delete e[t]}))}(r),function(e){return wn.includes(e)}(n)&&delete r.destinationName,function(e){return Sn.includes(e)}(n)&&delete r.destinationUuid,r}(_,e,B),[4,h(t)];case 1:return n.sent(),[3,4];case 2:return n.sent(),(0,r.showSnackbar)({title:I("errorSavingBaseOperation","Erro saving base operation"),isLowContrast:!0,kind:"error"}),[3,4];case 3:return Y(!1),[7];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){On(a,r,o,i,l,"next",e)}function l(e){On(a,r,o,i,l,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return l().createElement("div",{style:{margin:"10px"}},l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},y&&l().createElement(nn.Qr,{control:F,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:function(e){var t=Nn(e,1)[0];n(t)}},l().createElement(a.aj6,{invalid:!!L.operationDate,invalidText:null==L||null===(t=L.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:I("operationDate","Operation Date"),defaultValue:X(null==_?void 0:_.operationDate)}))},name:"operationDate"}),!y&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:X(null==_?void 0:_.operationDate),readOnly:!0,labelText:"Operation Date"})),k&&(null==_?void 0:_.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==_?void 0:_.operationNumber,readOnly:!0,labelText:"Operation Number"}),y&&!S&&(null==b?void 0:b.hasSource)&&l().createElement(dn,{controllerName:"sourceUuid",name:"sourceUuid",control:F,title:(null==b?void 0:b.hasDestination)?I("from","From"):I("location:","Location"),placeholder:b.hasDestination?I("chooseASource","Choose a source"):I("chooseALocation","Choose a location"),invalid:!!L.sourceUuid,invalidText:L.sourceUuid&&(null==L||null===(t=L.sourceUuid)||void 0===t?void 0:t.message),parties:O||[]}),(!y||k||S)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:"stockissue"===B?P.sourceName:null!==(Q=null==_?void 0:_.sourceName)&&void 0!==Q?Q:"",readOnly:!0,labelText:(null==b||b.hasDestination,"From")}),y&&!D&&(null==b?void 0:b.hasDestination)&&l().createElement(dn,{controllerName:"destinationUuid",name:"destinationUuid",control:F,title:(null==b?void 0:b.hasSource)?"To":"Location",placeholder:(null==b?void 0:b.hasSource)?I("chooseADestination","Choose a destination"):"Location",invalid:!!L.destinationUuid,invalidText:L.destinationUuid&&(null==L||null===(n=L.destinationUuid)||void 0===n?void 0:n.message),parties:x||[]}),(!y||k||D)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:"stockissue"===B?P.destinationName:null!==(J=null==_?void 0:_.destinationName)&&void 0!==J?J:"",readOnly:!0,labelText:(null==b||b.hasSource,"To")}),y&&l().createElement(hn,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:F,title:I("responsiblePerson:","Responsible Person"),placeholder:I("filter","Filter ..."),invalid:!!L.responsiblePersonUuid,invalidText:L.responsiblePersonUuid&&(null==L||null===(o=L.responsiblePersonUuid)||void 0===o?void 0:o.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===vn.uuid&&G(!0)}}),q&&l().createElement(yn,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:F,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(W=null==_?void 0:_.responsiblePersonOther)&&void 0!==W?W:""),labelText:I("responsiblePerson","Responsible Person"),placeholder:I("pleaseSpecify","Please Specify"),invalid:!!L.responsiblePersonOther,invalidText:L.responsiblePersonOther&&(null==L||null===(c=L.responsiblePersonOther)||void 0===c?void 0:c.message)}),!y&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(ee=(null==_?void 0:_.responsiblePersonUuid)&&(null==_?void 0:_.responsiblePersonUuid)!==vn.uuid?"".concat(null==_?void 0:_.responsiblePersonFamilyName," ").concat(null==_?void 0:_.responsiblePersonGivenName):null==_?void 0:_.responsiblePersonOther)&&void 0!==ee?ee:"",readOnly:!0,labelText:"Responsible Person"}),w&&y&&l().createElement(kn,{controllerName:"reasonUuid",name:"reasonUuid",control:F,placeholder:I("chooseAReason","Choose a reason"),title:I("reason","Reason"),invalid:!!L.reasonUuid,invalidText:L.reasonUuid&&(null==L||null===(s=L.reasonUuid)||void 0===s?void 0:s.message),onReasonChange:function(e){R("reasonUuid",e.uuid)}}),w&&!y&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(te=null==_?void 0:_.reasonName)&&void 0!==te?te:"",readOnly:!0,labelText:"Reason:"}),l().createElement(En,{id:"remarks",name:"remarks",control:F,controllerName:"remarks",maxLength:255,value:"".concat(null!==(ne=null==_?void 0:_.remarks)&&void 0!==ne?ne:""),labelText:I("remarks:","Remarks"),invalid:!!L.remarks,invalidText:L.remarks&&(null==L||null===(u=L.remarks)||void 0===u?void 0:u.message)}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:z(re),kind:"primary",renderIcon:se.ol},Z?l().createElement(a.lSo,null):I("next","Next")))))};var Tn={stockItemUuid:on.z.string().min(1,{message:"Required"}),stockItemName:on.z.string().min(1).nullish(),stockItemPackagingUOMUuid:on.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:on.z.string().min(1).nullish(),batchNo:on.z.string().min(1,{message:"Required"}),stockBatchUuid:on.z.string().optional(),expiration:on.z.coerce.date({required_error:"Required"}),quantity:on.z.coerce.number().min(1,{message:"Required"}),purchasePrice:on.z.coerce.number().nullish(),hasExpiration:on.z.boolean().nullish()},Bn=on.z.object(Tn),Un=(Bn.omit({expiration:!0}),on.z.object({stockItems:on.z.array(Bn)}));function Pn(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 jn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pn(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)?Pn(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 zn(e){return e.drugName||e.conceptName}const Fn=function(e){var t=function(e){var t=jn((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=me(n),a=o.items.results,l=o.isLoading,c=jn((0,i.useState)(null),2),s=c[0],u=c[1],d=jn((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=jn((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s})}),[s,m,g]),{stockItemsList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}({}),n=t.isLoading,r=t.stockItemsList,o=t.setSearchString,c=gn((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,s=(o.value,o.ref);return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:r||[],onChange:function(t){var n,r;null===(n=e.onStockItemChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:null!==(n=null==r?void 0:r.find((function(t){return t.uuid===e.stockItemUuid})))&&void 0!==n?n:"",itemToString:zn,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Ln=function(e){var t,n=fe(e.stockItemUuid),r=n.isLoading,o=n.isError,c=n.item,s=(0,i.useMemo)((function(){var e;return(null==c||null===(e=c.packagingUnits)||void 0===e?void 0:e.length)>0?c.packagingUnits[0]:null}),[null==c?void 0:c.packagingUnits]);return r||o?l().createElement(a.N2B,null):l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=s.uuid)&&void 0!==t?t:"",render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(n=null==c?void 0:c.packagingUnits)&&void 0!==n?n:[],onChange:function(t){var n,r;null===(n=e.onStockPackageChanged)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:s,itemToString:function(e){return e.packagingUomName?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Rn(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 Mn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rn(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)?Rn(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 qn(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 Gn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qn(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)?qn(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 Hn(e){var t=Gn((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||U.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=Gn((0,i.useState)(10),2),a=o[0],l=o[1],c=Gn((0,i.useState)(null),2),s=c[0],u=c[1],d=Gn((0,i.useState)(1),2),m=d[0],p=d[1],A=Gn((0,i.useState)(null==e?void 0:e.stockItemUuid),2),g=A[0],f=A[1],v=Gn((0,i.useState)(null==e?void 0:e.partyUuid),2),_=v[0],h=v[1],b=Gn((0,i.useState)(null==e?void 0:e.locationUuid),2),y=b[0],k=b[1],C=Gn((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E,includeBatchNo:!0})}),[s,m,a,g,_,y,E]);var S,D=pe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}function Zn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Yn=function(e){var t=function(e){var t=Mn((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=Ae(n),a=o.items.results,l=o.isLoading,c=Mn((0,i.useState)(null),2),s=c[0],u=c[1],d=Mn((0,i.useState)(10),2),m=d[0],p=d[1],A=Mn((0,i.useState)(U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s,stockItemUuid:e})}),[s,m,g,e]),{stockItemBatchNos:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(e.stockItemUuid),n=t.isLoading,r=t.stockItemBatchNos,o=(0,i.useMemo)((function(){var t;return null!==(t=null==r?void 0:r.find((function(t){return t.uuid===e.batchUuid})))&&void 0!==t?t:""}),[r,e.batchUuid]),c=Hn(),s=c.items,u=c.setStockItemUuid;(0,i.useEffect)((function(){u(e.stockItemUuid)}),[e.stockItemUuid,u]);var d=null==r?void 0:r.map((function(e){var t,n,r,o=null==s?void 0:s.find((function(t){return t.batchNumber===e.batchNo}));return o?(n=function(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){Zn(e,t,n[t])}))}return e}({},e),r=null!=(r={quantity:null!==(t=o.quantity)&&void 0!==t?t:""})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n):e}));return n?l().createElement(a.lSo,{status:"active"}):l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,i=n.ref;return l().createElement(a.CtY,{style:{flexGrow:"1"},titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:d||[],onChange:function(t){var n,o;null===(n=e.onBatchNoChanged)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:o,itemToString:function(e){var t;return(null==e?void 0:e.batchNo)?"".concat(null==e?void 0:e.batchNo," | Qty: ").concat(null!==(t=null==e?void 0:e.quantity)&&void 0!==t?t:""):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),n&&l().createElement(a.lSo,{status:"active"}))};var Qn=n(6781),Jn={};Jn.styleTagTransform=h(),Jn.setAttributes=g(),Jn.insert=p().bind(null,"head"),Jn.domAPI=d(),Jn.insertStyleElement=v(),s()(Qn.Z,Jn);const Wn=Qn.Z&&Qn.Z.locals?Qn.Z.locals:void 0;function Vn(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 Kn(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vn(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)?Vn(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 Xn=function(e){var t=e.canEdit,n=e.showQuantityRequested,o=e.requiresActualBatchInformation,c=e.requiresBatchUuid,s=e.canUpdateBatchInformation,u=e.canCapturePurchasePrice,d=e.batchBalance,m=e.control,p=e.setValue,A=e.errors,g=e.remove,f=e.fields,v=Kn((0,i.useState)(),2),_=(v[0],v[1]),h=Kn((0,i.useState)(),2),b=(h[0],h[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,h,y,k,C,E,w,S,D,O,x,N,I,T,B,U,P,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,ee,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Wn.desktopRow:Wn.tabletRow,key:null==e?void 0:e.uuid},l().createElement(a.pj1,null,t&&(null==e?void 0:e.uuid.startsWith("new-item"))&&l().createElement(Fn,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:re,control:m,invalid:!!(null==A||null===(h=A.stockItems)||void 0===h||null===(v=h[i])||void 0===v?void 0:v.stockItemUuid),onStockItemChanged:function(e){var t;!function(e,t){if(t){var n=f[e];if(n){var r,o,a,i;n.stockItemName=null!==(a=(null==t?void 0:t.drugName)?"".concat(null==t?void 0:t.drugName).concat((null!==(r=null==t?void 0:t.commonName)&&void 0!==r?r:null==t?void 0:t.conceptName)?" (".concat(null!==(o=null==t?void 0:t.commonName)&&void 0!==o?o:null==t?void 0:t.conceptName,")"):""):null)&&void 0!==a?a:null==t?void 0:t.conceptName;var l=null===(i=null==t?void 0:t.hasExpiration)||void 0===i||i;n.hasExpiration=l,l||(n.expiration=null),n.stockItemUuid=null==t?void 0:t.uuid,n.stockItemPackagingUOMUuid=null,n.stockItemPackagingUOMName=null,n.stockBatchUuid=null}}}(i,e),p("stockItems.".concat(i,".packagingUnits"),null==e?void 0:e.packagingUnits),_(null!==(t=null==e?void 0:e.uuid)&&void 0!==t?t:"")}}),(!t||!e.uuid.startsWith("new-item"))&&l().createElement(a.rUS,{target:"_blank",to:(ne=null==e?void 0:e.stockItemUuid,"".concat("/stock-items","/").concat(ne).concat(""))},"".concat(null==e?void 0:e.stockItemName))),n&&l().createElement(a.pj1,null,null!==(Y=null==e||null===(y=e.quantityRequested)||void 0===y?void 0:y.toLocaleString())&&void 0!==Y?Y:""," ",null!==(Q=null==e?void 0:e.quantityRequestedPackagingUOMName)&&void 0!==Q?Q:""),(o||c)&&l().createElement(a.pj1,null,o&&(t||s&&(null==e||null===(k=e.permission)||void 0===k?void 0:k.canUpdateBatchInformation))&&l().createElement(a.oil,{size:"sm",maxLength:50,onChange:function(e){return p("stockItems.".concat(i,".batchNo"),e.target.value)},defaultValue:e.batchNo,invalidText:"",invalid:null==A||null===(E=A.stockItems)||void 0===E||null===(C=E[i])||void 0===C?void 0:C.batchNo}),c&&!o&&t&&l().createElement(Yn,{batchUuid:null==e?void 0:e.stockBatchUuid,onBatchNoChanged:function(e){p("stockItems.".concat(i,".batchNo"),null==e?void 0:e.batchNo),p("stockItems.".concat(i,".expiration"),null==e?void 0:e.expiration),b(null==e?void 0:e.expiration)},placeholder:"Filter...",invalid:!!(null==A||null===(S=A.stockItems)||void 0===S||null===(w=S[i])||void 0===w?void 0:w.stockBatchUuid),control:m,controllerName:"stockItems.".concat(i,".stockBatchUuid"),name:"stockItems.".concat(i,".stockBatchUuid"),stockItemUuid:e.stockItemUuid}),!(s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:X($()),locale:"en",dateFormat:K,onChange:function(e){var t=Kn(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:V,defaultValue:X(null==e?void 0:e.expiration),invalid:!!(null==A||null===(N=A.stockItems)||void 0===N||null===(x=N[i])||void 0===x?void 0:x.expiration)})),(!(s&&(null==e||null===(I=e.permission)||void 0===I?void 0:I.canUpdateBatchInformation))&&!t||c)&&X(e.expiration)),l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{className:"small-placeholder-text",size:"sm",id:"qty-".concat(null==e?void 0:e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".quantity"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(J=null==e?void 0:e.quantity)&&void 0!==J?J:"",invalidText:null==A||null===(U=A.stockItems)||void 0===U||null===(B=U[i])||void 0===B||null===(T=B.quantity)||void 0===T?void 0:T.message,placeholder:c&&!o&&(null==e?void 0:e.stockBatchUuid)in d?"Bal: ".concat(null!==(W=null===(j=d[null==e?void 0:e.stockBatchUuid])||void 0===j||null===(P=j.quantity)||void 0===P?void 0:P.toLocaleString())&&void 0!==W?W:""," ").concat(null!==(ee=null===(z=d[null==e?void 0:e.stockBatchUuid])||void 0===z?void 0:z.quantityUoM)&&void 0!==ee?ee:""):"",invalid:!!(null==A||null===(L=A.stockItems)||void 0===L||null===(F=L[i])||void 0===F?void 0:F.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Ln,{stockItemUuid:e.stockItemUuid,onStockPackageChanged:function(e){p("stockItems.".concat(i,".stockItemPackagingUOMUuid"),null==e?void 0:e.uuid)},placeholder:"Filter...",invalid:!!(null==A||null===(q=A.stockItems)||void 0===q||null===(M=q[i])||void 0===M?void 0:M.stockItemPackagingUOMUuid),control:m,controllerName:"stockItems.".concat(i,".stockItemPackagingUOMUuid"),name:"stockItems.".concat(i,".stockItemPackagingUOMUuid")}),!t&&(null==e?void 0:e.stockItemPackagingUOMName)),u&&l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{size:"sm",invalid:!!(null==A||null===(H=A.stockItems)||void 0===H||null===(G=H[i])||void 0===G?void 0:G.purchasePrice),invalidText:"",id:"purchaseprice-".concat(e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".purchasePrice"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(te=null==e?void 0:e.purchasePrice)&&void 0!==te?te:"",title:""}),!t&&(null==e||null===(Z=e.purchasePrice)||void 0===Z?void 0:Z.toLocaleString())),t&&l().createElement(a.pj1,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:ue.ZN,onClick:function(){return g(i)}})))})))};function $n(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}var er=(0,i.createContext)(null),tr=function(e){var t,n,r=e.children,o=(t=(0,i.useState)(null),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return $n(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)?$n(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.")}()),a={formContext:o[0],setFormContext:o[1]};return l().createElement(er.Provider,{value:a},r)},nr=n(6360),rr={};rr.styleTagTransform=h(),rr.setAttributes=g(),rr.insert=p().bind(null,"head"),rr.domAPI=d(),rr.insertStyleElement=v(),s()(nr.Z,rr);const or=nr.Z&&nr.Z.locals?nr.Z.locals:void 0;function ar(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 ir(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function lr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cr(e){return function(e){if(Array.isArray(e))return ar(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sr(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 sr(e,t){if(e){if("string"==typeof e)return ar(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)?ar(e,t):void 0}}const ur=function(e){var t,n,o,c,s,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,f=u.batchNos,v=u.canUpdateItemsBatchInformation,_=u.itemUoM,h=e.canEdit,b=void 0===h||h,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,D=(0,i.useContext)(er).formContext,O=function(e){if("requisition"===e){var t=Bn.omit({batchNo:!0,expiration:!0});return on.z.object({stockItems:on.z.array(t)})}return Un}(S),x=(t=function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return 0==e.stockItems.length?("No stock items","You haven't added any stock items, tap the add button to add some.",(0,r.showSnackbar)({isLowContrast:!0,title:"No stock items",kind:"error",subtitle:"You haven't added any stock items, tap the add button to add some."}),[2]):(y.stockOperationItems=null==e?void 0:e.stockItems,[4,null==k?void 0:k(y)]);case 1:return t.sent(),[2]}}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){ir(a,r,o,i,l,"next",e)}function l(e){ir(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,nn.cI)({resolver:(0,rn.F)(O),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,B=N.setValue,U=N.formState.errors,P=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||sr(c,s)||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.")}())[0],j=(0,nn.Dq)({name:"stockItems",control:T}),z=j.fields,F=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==D?void 0:D.stockItems){var e=null==D?void 0:D.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==D?void 0:D.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(cr(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),cr(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),cr(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),cr(m?[{key:"expiry",header:w("expiry","Expiry")}]:[]),[{key:"quantity",header:d?w("qtyIssued","Qty Issued"):w("qty","Qty")},{key:"quantityuom",header:w("quantityUom","Qty UoM")}],cr(A?[{key:"purchaseprice",header:w("purchasePrice","Purchase Price")}]:[])),q=function(){var e="new-item-".concat("".concat((new Date).getTime(),"-").concat(Math.random().toString(36).substring(2,16)));F({uuid:e,id:e})};return l().createElement("div",{style:{margin:"10px"}},l().createElement("div",{className:or.tableContainer},l().createElement(a.wQF,{rows:null!==(R=null==y?void 0:y.stockOperationItems)&&void 0!==R?R:[{uuid:"new-item-1",id:"new-item-1"}],headers:M,isSortable:!1,useZebraStyles:!0,styles:{width:"100%"},render:function(e){var t,n=e.headers,o=e.getHeaderProps,i=e.getTableProps;return l().createElement(a.xJi,null,l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){var t,n,i,c;return l().createElement(a.xDH,(i=function(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){lr(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?or.desktopHeader:or.tabletHeader,style:null==e?void 0:e.styles,key:"".concat(e.key)})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))})),i),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:null==e?void 0:e.header)})),b&&l().createElement(a.xDH,{style:{width:"3% !important"}},l().createElement("div",{style:{width:"3% !important",display:"flex",flexDirection:"row",gap:"8px"}},l().createElement(a.zxk,{renderIcon:se.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:se.ol},P?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(Xn,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:f,control:T,setValue:B,errors:U,remove:L,append:F,canEdit:b,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:z})," ")))}})))};var dr=n(8808);function mr(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 pr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Ar(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){pr(a,r,o,i,l,"next",e)}function l(e){pr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function gr(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mr(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)?mr(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 fr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const vr=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=gr((0,i.useState)(!1),2),d=u[0],m=u[1],p=gr((0,i.useState)(null),2),A=p[0],g=p[1];return l().createElement("div",{style:{margin:"10px"}},t&&!n&&l().createElement("div",{style:{margin:"10px"}},l().createElement(a.SYO,{name:"rbgApprovelRequired",legendText:s("doesThisTransactionRequireApproval","Does the transaction require approval ?"),onChange:function(e){g(e)},defaultSelected:A},l().createElement(a.EUY,{value:!0,id:"rbgApprovelRequired-true",labelText:s("yes","Yes")}),l().createElement(a.EUY,{value:!1,id:"rbgApprovelRequired-false",labelText:s("no","No")}))),!t&&l().createElement(l().Fragment,null,l().createElement(a.oil,{style:{margin:"5px"},id:"rbgApproveRequiredLbl",value:A?s("yes","Yes"):s("no","No"),readOnly:!0,labelText:s("doesThisTransactionRequireApproval","Does the transaction require approval ?")})),t&&!n&&l().createElement("div",{className:"stkpg-form-buttons",style:{margin:"10px"}},null!=A&&l().createElement(l().Fragment,null,!o&&!A&&l().createElement(a.zxk,{name:"complete",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:Ar((function(){return fr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onComplete(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:Ie.X4},s("complete","Complete")),o&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:Ar((function(){return fr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onDispatch(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:mt.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:dr.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:Ar((function(){return fr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r)];case 1:return e.sent(),m(!1),[2]}}))})),kind:"secondary",renderIcon:dr.vc},d?l().createElement(a.lSo,null):s("save","Save")),!d&&l().createElement(a.zxk,{type:"button",style:{margin:"4px"},className:"cancelButton",kind:"tertiary",onClick:c.onGoBack,renderIcon:ue.WP},s("goBack","Go Back"))))};var _r="Location",hr="Other";function br(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 yr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function kr(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,E,w,S,D,O,x,N,I,T,B,U,P,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,V,K;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(X){switch(X.label){case 0:return A=!!t,g=[],f=!1,[4,new Promise((function(e,t){(0,r.getCurrentUser)().subscribe({next:function(t){var n,r=null==t||null===(n=t.user)||void 0===n?void 0:n.uuid;e(r)},error:function(e){return t(e)}})}))];case 1:return v=X.sent(),_=n,b=null!==(h=null==t||null===(o=t.permission)||void 0===o?void 0:o.isRequisitionAndCanIssueStock)&&void 0!==h&&h,k=null!==(y=null==e||null===(a=e.stockOperationTypeLocationScopes)||void 0===a?void 0:a.filter((function(t){return(null==e?void 0:e.hasSource)&&t.isSource})).map((function(e){return e.locationTag})))&&void 0!==y?y:[],C=1===k.length&&k[0]===te,w=null!==(E=null==e||null===(i=e.stockOperationTypeLocationScopes)||void 0===i?void 0:i.filter((function(t){return(null==e?void 0:e.hasDestination)&&t.isDestination})).map((function(e){return e.locationTag})))&&void 0!==E?E:[],S=1===w.length&&w[0]===te,D=null,A?(p=structuredClone(fn()),p=Object.assign(p,{operationDate:$(),operationTypeName:null==e?void 0:e.name,operationTypeUuid:null==e?void 0:e.uuid,operationType:null==e?void 0:e.operationType}),[4,(re="".concat(r.restBaseUrl,"/stockmanagement/party?v=default"),(0,r.openmrsFetch)(re))]):[3,4];case 2:return U=X.sent(),[4,jt()];case 3:if(P=X.sent(),j=null===(I=P.data)||void 0===I||null===(N=I.results)||void 0===N?void 0:N.filter((function(e){return e.userUuid===v})),ne=new Set(j.flatMap((function(e){var t;return null==e||null===(t=e.locations)||void 0===t?void 0:t.map((function(e){return e.locationUuid}))}))),z=function(e){if(Array.isArray(e))return br(e)}(ne)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(ne)||function(e,t){if(e){if("string"==typeof e)return br(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)?br(e,t):void 0}}(ne)||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.")}(),!U.ok)throw Error("Error loading parties");return F=null===(B=U.data)||void 0===B||null===(T=B.results)||void 0===T?void 0:T.filter((function(e){return z.includes(e.locationUuid)||null!==e.stockSourceUuid})),O=null==F?void 0:F.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===_r&&(0===k.length||t.tags&&k.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===hr})),(null==e?void 0:e.hasSource)&&A&&C&&(null==O?void 0:O.length)>0&&(L=O[0],p.sourceUuid=L.uuid,p.sourceName=L.name,D=null==L?void 0:L.locationUuid),(null==e?void 0:e.hasDestination)&&(x=null==U||null===(M=U.data)||void 0===M||null===(R=M.results)||void 0===R?void 0:R.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===_r&&(0===w.length||t.tags&&w.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===hr})),A&&S&&(null==x?void 0:x.length)>0&&(q=x[0],p.destinationUuid=q.uuid,p.destinationName=q.name)),[3,6];case 4:return[4,Bt()];case 5:if(!(G=X.sent()).ok)throw Error("Error loading operation types");_=G.data.results,X.label=6;case 6:return H=Zt(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(ee=H,"adjustment"===ee),requiresBatchUuid:Qt(H),requiresActualBatchInfo:Jt(H),isQuantityOptional:Wt(H),canCaptureQuantityPrice:Vt(H),requiresStockAdjustmentReason:Yt(H),requiresDispatchAcknowledgement:Kt(H),allowExpiredBatchNumbers:null!==(Z=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==Z&&Z,canEditModel:null!==(Y=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==Y&&Y,canViewModel:null!==(Q=null==t||null===(c=t.permission)||void 0===c?void 0:c.canView)&&void 0!==Q&&Q,canApproveModel:null!==(J=null==t||null===(s=t.permission)||void 0===s?void 0:s.canApprove)&&void 0!==J&&J,canIssueStock:b,canReceiveItems:null!==(W=null==t||null===(u=t.permission)||void 0===u?void 0:u.canReceiveItems)&&void 0!==W&&W,canDisplayReceivedItems:null!==(V=null==t||null===(d=t.permission)||void 0===d?void 0:d.canDisplayReceivedItems)&&void 0!==V&&V,canUpdateItemsBatchInformation:null!==(K=null==t||null===(m=t.permission)||void 0===m?void 0:m.canUpdateBatchInformation)&&void 0!==K&&K,canPrint:b||Xt(H),sourceTags:k,destinationTags:w,shouldLockDestination:S,shouldLockSource:C,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===_r&&(0===k.length||t.tags&&k.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===hr},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===_r&&(0===w.length||t.tags&&w.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===hr},location:D,sourcePartyList:O,destinationPartyList:x,stockOperationTypes:_,hasQtyRequested:f}]}var ee,ne,re}))},kr=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){yr(a,r,o,i,l,"next",e)}function l(e){yr(a,r,o,i,l,"throw",e)}i(void 0)}))},kr.apply(this,arguments)}function Cr(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 Er(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Cr(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)?Cr(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.")}()}var wr=n(3133);function Sr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(wr.Wz,function(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){Sr(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Or(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Reject",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"",renderIcon:function(e){return l().createElement(C.wA,function(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){Or(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ir=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Return",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(Fe.eL,function(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){Nr(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};function Tr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Br=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Cancel",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"danger--ghost",renderIcon:function(e){return l().createElement(At.jj,function(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){Tr(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function Ur(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var Pr,jr,zr=(Pr=function(e,t,n,r,o){var a,i,l,c,s,u,d,m,p,A,g;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(f){return a={},Gt.REQUISITION_OPERATION_TYPE!==e.operationType&&(a.authorizedBy=(null==e?void 0:e.dispatchedDate)?"".concat(null!==(i=e.dispatchedByFamilyName)&&void 0!==i?i:""," ").concat(null!==(l=e.dispatchedByGivenName)&&void 0!==l?l:""):(null==e?void 0:e.completedDate)?"".concat(null!==(c=e.completedByFamilyName)&&void 0!==c?c:""," ").concat(null!==(s=e.completedByGivenName)&&void 0!==s?s:""):""),a.remarks=e.remarks,a.operationNumber=e.operationNumber,a.operationDate=null!==(u=null==n?void 0:n.operationDate)&&void 0!==u?u:null==e?void 0:e.operationDate,a.location=null!==(d=null==n?void 0:n.atLocationName)&&void 0!==d?d:null==e?void 0:e.atLocationName,a.source=null==e?void 0:e.sourceName,a.destination=null==e?void 0:e.destinationName,a.responsiblePerson=a.orderedBy=(null==n?void 0:n.responsiblePersonFamilyName)?"".concat(null!==(m=n.responsiblePersonFamilyName)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""):"".concat(null!==(A=e.responsiblePersonFamilyName)&&void 0!==A?A:""," ").concat(null!==(g=e.responsiblePersonGivenName)&&void 0!==g?g:""),a.organizationName="Health Center",a.documentTitle="".concat(e.operationTypeName," ").concat(e.operationNumber).concat(n?" of ".concat(n.operationTypeName," ").concat(n.operationNumber):""),a.items=t.map((function(t){var a={};if(a.itemCode=null==t?void 0:t.acronym,a.itemDescription=null==t?void 0:t.stockItemName,a.purchasePrice=null==t?void 0:t.purchasePrice,a.batchNumber=null==t?void 0:t.batchNo,a.expiryDate=null==t?void 0:t.expiration,n?(a.quantityRequired=null==t?void 0:t.quantityRequested,a.quantityRequiredUoM=null==t?void 0:t.quantityRequestedPackagingUOMName,a.quantityIssued=null==t?void 0:t.quantity,a.quantityIssuedUoM=null==t?void 0:t.stockItemPackagingUOMName):Gt.STOCK_ISSUE_OPERATION_TYPE===e.operationType?(a.quantityIssued=null==t?void 0:t.quantity,a.quantityIssuedUoM=null==t?void 0:t.stockItemPackagingUOMName):(a.quantityRequired=null==t?void 0:t.quantity,a.quantityRequiredUoM=null==t?void 0:t.stockItemPackagingUOMName),r){var i=r.find((function(e){return e.uuid===t.uuid}));i&&(a.unitCost=i.unitCost,a.unitCostUoM=i.unitCostUOMName,a.totalCost=i.totalCost)}if(o){var l=o.find((function(e){return e.stockItemUuid===t.stockItemUuid}));l&&(a.balanceOnHand=l.quantity,a.balanceOnHandUoM=l.quantityUoM)}return a})),[2,a]}))},jr=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=Pr.apply(e,t);function a(e){Ur(o,n,r,a,i,"next",e)}function i(e){Ur(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return jr.apply(this,arguments)});function Fr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var Lr=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Fr(a,r,o,i,l,"next",e)}function l(e){Fr(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,t,n;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(o){switch(o.label){case 0:return[4,(0,r.getConfig)("@openmrs/esm-stock-management-app")];case 1:return t=o.sent(),n=null==t||null===(e=t.logo)||void 0===e?void 0:e.src,[2,new Promise((function(e,t){var r;if(n){var o=document.getElementById("hdnTxtPrintLogo");if(o&&(null===(r=o.value)||void 0===r?void 0:r.length)>0){var a=o.getAttribute("isSvg");e({image:o.value,isSvg:"1"===a})}else if(n.toLowerCase().endsWith(".svg"))fetch(n,{headers:{"Disable-WWW-Authenticate":"true"}}).then((function(e){if(!e.ok)throw new Error("Print logo fetch network response was not OK");return e.text()})).then((function(t){o&&(o.value=t,o.setAttribute("isSvg","1")),e({image:t,isSvg:!0})})).catch((function(e){console.error("Error fetching print logo: ",e),t("Error fetching print logo")}));else{var i=new Image;i.addEventListener("load",(function(){try{var n=document.createElement("canvas");n.width=i.width,n.height=i.height;var r=n.getContext("2d");if(r){r.drawImage(i,0,0);var a=n.toDataURL("image/png");o&&(o.value=a,o.setAttribute("isSvg","0")),e({image:a,isSvg:!1})}else t("Failed to allocate canvas context for print logo")}catch(e){t(e)}})),i.addEventListener("error",(function(e){t(e)})),i.src=n}}else e(null)}))]}}))}));return function(){return e.apply(this,arguments)}}();function Rr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Mr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Rr(a,r,o,i,l,"next",e)}function l(e){Rr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function qr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Gr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return'<html>\n<head>\n<meta http-equiv=Content-Type content="text/html; charset=utf8">\n<title>'.concat(null!=t?t:"","</title>\n<style>\n").concat('\n/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the main element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on h1 elements within section and\n * article contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent sub and sup elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type="button"],\n[type="reset"],\n[type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type="button"]::-moz-focus-inner,\n[type="reset"]::-moz-focus-inner,\n[type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type="button"]:-moz-focusring,\n[type="reset"]:-moz-focusring,\n[type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from fieldset elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * fieldset elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type="checkbox"],\n[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type="number"]::-webkit-inner-spin-button,\n[type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to inherit in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n/*!\n * Gutenberg\n *\n * MIT Fabien Sa\n * https://github.com/BafS/Gutenberg\n */\n\n* {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n *,\n *:before,\n *:after,\n p:first-letter,\n div:first-letter,\n blockquote:first-letter,\n li:first-letter,\n p:first-line,\n div:first-line,\n blockquote:first-line,\n li:first-line {\n background: transparent !important;\n box-shadow: none !important;\n text-shadow: none !important;\n }\n \n html {\n font-size: 16px;\n margin: 0;\n padding: 0;\n }\n \n body {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n background: #fff !important;\n color: #000 !important;\n font-family: Arial, sans-serif, "Helvetica Neue", Helvetica;\n font-size: 1rem;\n line-height: 1.5;\n margin: 0 auto;\n text-rendering: optimizeLegibility;\n }\n \n p,\n blockquote,\n table,\n ul,\n ol,\n dl {\n margin-bottom: 1.5rem;\n margin-top: 0;\n }\n \n p:last-child,\n ul:last-child,\n ol:last-child {\n margin-bottom: 0;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: #000;\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n line-height: 1.2;\n margin-bottom: 0.75rem;\n margin-top: 0;\n }\n \n h1 {\n font-size: 2.5rem;\n }\n \n h2 {\n font-size: 2rem;\n }\n \n h3 {\n font-size: 1.75rem;\n }\n \n h4 {\n font-size: 1.5rem;\n }\n \n h5 {\n font-size: 1.25rem;\n }\n \n h6 {\n font-size: 1rem;\n }\n \n a,\n a:visited {\n color: #000;\n text-decoration: underline;\n word-wrap: break-word;\n }\n \n table {\n border-collapse: collapse;\n }\n \n thead {\n display: table-header-group;\n }\n \n table,\n th,\n td {\n border-bottom: 1px solid #000;\n }\n \n td,\n th {\n padding: 0px;\n page-break-inside: avoid;\n }\n \n code,\n pre,\n kbd {\n border: 1px solid #bbb;\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n font-size: 85%;\n }\n \n code,\n kbd {\n padding: 3px;\n }\n \n pre {\n margin-bottom: 1.5rem;\n padding: 10px 12px;\n }\n \n pre code,\n pre kbd {\n border: 0;\n }\n \n ::-webkit-input-placeholder {\n color: transparent;\n }\n \n :-moz-placeholder {\n color: transparent;\n }\n \n ::-moz-placeholder {\n color: transparent;\n }\n \n :-ms-input-placeholder {\n color: transparent;\n }\n \n blockquote {\n border: 0;\n border-left: 5px solid #bbb;\n margin-left: 1px;\n padding: 12px 1.5rem;\n }\n \n [dir=\'rtl\'] blockquote {\n border-left: 0;\n border-right: 5px solid #bbb;\n margin-left: 0;\n margin-right: 1px;\n }\n \n blockquote:first-child {\n margin-top: 0;\n }\n \n blockquote p:last-child,\n blockquote ul:last-child,\n blockquote ol:last-child {\n margin-bottom: 0;\n }\n \n blockquote footer {\n display: block;\n font-size: 80%;\n }\n \n img {\n border: 0;\n display: block;\n max-width: 100% !important;\n vertical-align: middle;\n }\n \n hr {\n border: 0;\n border-bottom: 2px solid #bbb;\n height: 0;\n margin: 2.25rem 0;\n padding: 0;\n }\n \n dt {\n font-weight: bold;\n }\n \n dd {\n margin: 0;\n margin-bottom: 0.75rem;\n }\n \n abbr[title],\n acronym[title] {\n border: 0;\n text-decoration: none;\n }\n \n table,\n blockquote,\n pre,\n code,\n figure,\n li,\n hr,\n ul,\n ol,\n a,\n tr {\n page-break-inside: avoid;\n }\n \n h2,\n h3,\n h4,\n p,\n a {\n orphans: 3;\n widows: 3;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n page-break-after: avoid;\n page-break-inside: avoid;\n }\n \n h1+p,\n h2+p,\n h3+p {\n page-break-before: avoid;\n }\n \n img {\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: avoid;\n }\n \n pre {\n white-space: pre-wrap !important;\n word-wrap: break-word;\n }\n \n body {\n padding-bottom: 1cm;\n padding-left: 1cm;\n padding-right: 1cm;\n padding-top: 0.5cm;\n }\n \n a[href^=\'http\']:after,\n a[href^=\'ftp\']:after {\n content: " (" attr(href) ")";\n font-size: 80%;\n }\n \n a[href$=\'.jpg\']:after,\n a[href$=\'.jpeg\']:after,\n a[href$=\'.gif\']:after,\n a[href$=\'.png\']:after {\n display: none;\n }\n \n abbr[title]:after,\n acronym[title]:after {\n content: " (" attr(title) ")";\n }\n \n .page-break,\n .break-before,\n .page-break-before {\n page-break-before: always;\n }\n \n .break-after,\n .page-break-after {\n page-break-after: always;\n }\n \n .avoid-break-inside {\n page-break-inside: avoid;\n }\n \n .no-print {\n display: none;\n }\n \n a.no-reformat:after {\n content: \'\';\n }\n \n abbr[title].no-reformat:after,\n acronym[title].no-reformat:after {\n content: \'\';\n }\n \n .no-reformat abbr:after,\n .no-reformat acronym:after,\n .no-reformat a:after {\n content: \'\';\n }\n /*Custom CSS*/\n .right {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n margin-right: 0;\n } \n .text {\n margin-top:0in;\n margin-right:0in;\n margin-bottom:3.0pt;\n margin-left:0in;\n line-height:106%;\n font-size:12.5pt;\n } \n .logo-row {\n width: 99%;\n }\n .logo {\n width: 120; \n line-height:110%;\n text-align: center;\n margin-top: 4pt;\n }\n .logo img, .logo svg {\n width: 52;\n height: auto;\n }\n span.logo-text {\n font-size:8.0pt;\n display: block;\n white-space:nowrap;\n line-height: 110%;\n margin-top: 4pt;\n } \n .heading, .heading-row {\n margin-left:12.75pt;\n clear: both;\n }\n .heading {\n font-size:14.5pt;\n line-height:102%;\n }\n .heading-row, .heading-row table { \n font-size: 13.5pt;\n }\n .heading-row {\n margin-top: 14pt;\n }\n .heading table, .heading-row table, .heading-row td {\n border: 0;\n }\n .table-data {\n border: 0;\n border-collapse:collapse;\n margin-left:6.95pt;\n font-size:12.5pt;\n width: 99%;\n page-break-inside: auto;\n }\n .table-data td, .table-data th {\n padding:0 5.75pt 0 5.15pt;\n }\n .table-data td, .table-data th {\n border-top:none;\n border-left:none;\n border-right:solid black 1.0pt;\n vertical-align: middle;\n height: 30pt;\n }\n .table-data th {\n border-bottom:double black 1.5pt;\n } \n .table-data td {\n border-bottom:solid black 1.0pt;\n }\n .table-data th:first-child, .table-data td:first-child {\n border-left:solid black 1.0pt;\n } \n .center {\n text-align: center;\n } \n .left {\n text-align: left;\n }\n .table-data tr.footer-field td {\n height:32pt;\n vertical-align: middle;\n }\n @page { size: auto; margin: 0mm; }\n','\n</style>\n</head>\n<body onload="').concat(n?"window.print()":"","\" style='word-wrap:break-word' ").concat(r?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Hr=function(){var e=Mr((function(){var e,t,n,o,a;return qr(this,(function(i){switch(i.label){case 0:return[4,(0,r.getConfig)("@openmrs/esm-stock-management-app")];case 1:t=i.sent(),n=null==t||null===(e=t.logo)||void 0===e?void 0:e.name,o=null,i.label=2;case 2:return i.trys.push([2,4,,5]),[4,Lr()];case 3:return o=i.sent(),[3,5];case 4:return a=i.sent(),console.info(a),[3,5];case 5:return[2,o||n?'\n<div class="logo" >\n '.concat(o?o.isSvg?o.image:"<img alt='' src='".concat(o.image,"' />"):"","\n ").concat(n?"<span class='logo-text text'>".concat(n,"</span>"):"","\n</div> \n "):""]}}))}));return function(){return e.apply(this,arguments)}}(),Zr=function(){var e=Mr((function(){var e;return qr(this,(function(t){switch(t.label){case 0:return[4,Hr()];case 1:return e=t.sent(),[2,'\n<div class="logo-row right">\n'.concat(e,"\n</div> \n ")]}}))}));return function(){return e.apply(this,arguments)}}(),Yr=function(e){setTimeout((function(){!function(e){var t=window.open("","Print-Window");t&&(t.document.open(),t.document.write(e),t.document.close())}(e)}),300)};function Qr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Jr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Qr(a,r,o,i,l,"next",e)}function l(e){Qr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Wr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Vr=function(){var e=Jr((function(e){var t,n,r,o,a,i,l,c,s;return Wr(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Goods Received Note</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Delivered To: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>GRN#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Received From: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.source)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(W(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th> \n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Purchase Price</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i,l,c;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(r=e.itemCode)&&void 0!==r?r:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(null!==(a=e.batchNumber)&&void 0!==a?a:"",'</td> \n <td valign="middle" class="center">').concat(W(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(i=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==i?i:""," ").concat(null!==(l=e.quantityRequiredUoM)&&void 0!==l?l:"",'</td>\n <td valign="middle" class="center">').concat(null!==(c=null===(n=e.purchasePrice)||void 0===n?void 0:n.toLocaleString())&&void 0!==c?c:"","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",' \n <tr class="footer-field">\n <td valign="middle" colspan="6" style="border:0;padding-top: 15pt;">\n Remarks:<br/>\n ').concat(null!==(c=null==e?void 0:e.remarks)&&void 0!==c?c:"",'\n </td> \n </tr> \n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Received By:<br/>\n <b>').concat(null!==(s=null==e?void 0:e.responsiblePerson)&&void 0!==s?s:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Checked By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),Kr=function(){var e=Jr((function(e){var t;return Wr(this,(function(n){switch(n.label){case 0:return[4,Vr(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,re)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function Xr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function $r(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Xr(a,r,o,i,l,"next",e)}function l(e){Xr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function eo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var to=function(){var e=$r((function(e){var t,n,r,o,a,i,l,c,s;return eo(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Inventory Transfer</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer From: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>Transfer#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer To: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.destination)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(W(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Unit Cost</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(n=e.itemCode)&&void 0!==n?n:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</td> \n <td valign="middle" class="center">').concat(null!==(o=e.batchNumber)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(W(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",' \n <tr class="footer-field">\n <td valign="middle" colspan="7" style="border:0;padding-top: 15pt;">\n Remarks:<br/>\n ').concat(null!==(c=null==e?void 0:e.remarks)&&void 0!==c?c:"",'\n </td> \n </tr> \n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;padding-top: 15pt;">\n Prepared By:<br/>\n <b>').concat(null!==(s=null==e?void 0:e.responsiblePerson)&&void 0!==s?s:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Authorized By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),no=function(){var e=$r((function(e){var t;return eo(this,(function(n){switch(n.label){case 0:return[4,to(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,re)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ro(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function oo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ro(a,r,o,i,l,"next",e)}function l(e){ro(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ao(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var io=function(){var e=oo((function(e){var t,n,r,o,a,i,l,c;return ao(this,(function(s){switch(s.label){case 0:return r=Math.max(0,28-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=s.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text">\n <b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Dept/section/ward/dispensary: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(W(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td colspan="4" valign="top" style=\'border:solid black 1.0pt;height:40pt\'>\n <div class=\'text\'><b>Ordered by (Name and signature):</b></div>\n <p class=\'text\' style=\'margin-top: 1pt;\'>').concat(null!==(l=e.orderedBy)&&void 0!==l?l:" ","</p>\n </td>\n <td colspan=\"4\" valign=\"top\" style='border:solid black 1.0pt;border-left:none;height:40pt'>\n <div class='text'><b>Authorized by (Name and Signature):</b></div>\n <p class='text' style='margin-top: 1pt;'>").concat(null!==(c=e.authorizedBy)&&void 0!==c?c:" ",'</p>\n </td>\n </tr> \n <tr>\n <th valign="middle" class="left"><b>Item Code No.</b></th>\n <th valign="middle" class="left"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle"><b>Balance on Hand</b></th>\n <th valign="middle"><b>Quantity Required</b></th>\n <th valign="middle"><b>Quantity Issued</b></th>\n <th valign="middle"><b>Unit Cost</b></th>\n <th valign="middle"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i,l,c;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(r=e.itemCode)&&void 0!==r?r:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat(null!==(l=null===(n=e.quantityIssued)||void 0===n?void 0:n.toLocaleString())&&void 0!==l?l:""," ").concat(null!==(c=e.quantityIssuedUoM)&&void 0!==c?c:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",'\n <tr class="footer-field">\n <td valign="middle" colspan="3">Issue date:</td>\n <td valign="middle" colspan="4">Receipt date:</td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3">Name & Signature receiver:</td>\n <td valign="middle" colspan="4">Name & Signature issuer:</td>\n </tr>\n </table>\n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),lo=function(){var e=oo((function(e){var t;return ao(this,(function(n){switch(n.label){case 0:return[4,io(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,re)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function co(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function so(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){co(a,r,o,i,l,"next",e)}function l(e){co(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,o,a,i,l,c,s;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),n=null,o=null,t.requisitionStockOperationUuid&&(F(t.requisitionStockOperationUuid).then((function(t){t.error||(e=t)})).catch((function(e){e.error})),!e)?[2,null]:((e||"stockissue"===(null==e?void 0:e.operationType)||"transferout"===(null==e?void 0:e.operationType))&&(a={},(null==t?void 0:t.uuid)&&(a.stockOperationUuid=t.uuid),(d=a,m="".concat(r.restBaseUrl,"/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=").concat(d),p=new AbortController,(0,r.openmrsFetch)(m,{method:"GET",headers:{"Content-Type":"application/json"},signal:p.signal})).then((function(e){e.error||(n=null==e?void 0:e.results)})).catch((function(e){e.error}))),(e||"requisition"===(null==e?void 0:e.operationType))&&(i={},null==t||t.uuid,i.locationUuid=t.atLocationUuid,i.stockOperationUuid=t.uuid,i.v=U.Default,i.groupBy="LocationStockItem",i.includeStockItemName="true",i.date=JSON.stringify(null!==(l=null==e?void 0:e.dateCreated)&&void 0!==l?l:null==t?void 0:t.dateCreated),function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(j(e)),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(o=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,zr(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,Kr(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,no(c)];case 4:return u.sent(),[3,7];case 5:return[4,lo(c)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(c),u.label=9;case 9:return[3,11];case 10:return s=u.sent(),console.info(s),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}();return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(C.FB,function(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){so(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print"))};function mo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const po=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(mt.bS,function(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){mo(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function Ao(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const go=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(se.aP,function(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){Ao(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function fo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vo(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){fo(e,t,n[t])}))}return e}const _o=function(e){var t,n,r,o,i=e.operation,c=e.operations,s=(0,E.useTranslation)().t,u={uuid:"",name:"Stock Issue",description:"",operationType:"stockissue",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1},d=(n=(t=i).uuid,r=vo({},t),o=null!=(o={requisitionStockOperationUuid:n})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r);return l().createElement(a.zxk,{onClick:function(){Po(s,d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(mt.ei,vo({size:16},e))}},s("issueStock","Issue Stock "))};var ho=n(2496),bo={};bo.styleTagTransform=h(),bo.setAttributes=g(),bo.insert=p().bind(null,"head"),bo.domAPI=d(),bo.insertStyleElement=v(),s()(ho.Z,bo);const yo=ho.Z&&ho.Z.locals?ho.Z.locals:void 0;function ko(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 Co(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Eo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Co(a,r,o,i,l,"next",e)}function l(e){Co(a,r,o,i,l,"throw",e)}i(void 0)}))}}function wo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function So(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){wo(e,t,n[t])}))}return e}function Do(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Oo(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ko(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)?ko(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 xo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const No=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,w,S,D,O,x,N,I,T,B,U,P,j,z,F,L,R,q,G,H,Z,Q,J,W,V,K,X,$,ee,te,ne,re,oe,ae,ie,le,ce,se,ue,de,me,pe,Ae,ge,fe,ve,_e,he,be,ye,ke,Ce,Ee,we,Se,De,Oe=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=Er((0,i.useState)(!0),2),n=t[0],r=t[1],o=Er((0,i.useState)(!1),2),a=o[0],l=o[1],c=Er((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return kr.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),r(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:s}}(e),Be=Te.isLoading,Ue=Te.isError,Pe=Te.result,je=Oo((0,i.useState)(null==e?void 0:e.isEditing),2),ze=je[0],Fe=je[1],Le=Oo((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Oo((0,i.useState)(0),2),Ge=qe[0],He=qe[1];if(Be)return l().createElement(a.MHR,null);if(Ue)return Y(),void(0,r.showSnackbar)({kind:"error",title:Oe("error","Error"),subtitle:Oe("errorLoadingStockOperation","Error loading stock item"),timeoutInMs:5e3,isLowContrast:!0});var Ze=[{name:"".concat(xe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(In,Do(So({},e),{isEditing:"Stock Issue"===(null==e||null===(o=e.operation)||void 0===o?void 0:o.name)?!xe:xe,setup:Pe,canEdit:"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?!Ne:Ne,model:xe||"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,onSave:Eo((function(){return xo(this,(function(e){return Fe(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(ur,Do(So({},e),{isEditing:xe,setup:Pe,canEdit:Ne,model:xe||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,onSave:Eo((function(){return xo(this,(function(e){return Me(!0),He(2),[2]}))}))})),disabled:!(xe||ze)},{name:(null==Pe?void 0:Pe.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(vr,Do(So({},e),{isEditing:xe,setup:Pe,canEdit:Ne,locked:!1,model:xe||"Stock Issue"===(null==e||null===(d=e.operation)||void 0===d?void 0:d.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,requiresDispatchAcknowledgement:xe?"return"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType)||"issuestock"===(null==e||null===(p=e.model)||void 0===p?void 0:p.operationType):Pe.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=Eo((function(t){return xo(this,(function(n){switch(n.label){case 0:return[4,Uo(Oe,t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){He(1)},onComplete:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||Re)}];return l().createElement(l().Fragment,null,xe||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},xe&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:yo.textHeading},Oe("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(M(null==e||null===(A=e.model)||void 0===A?void 0:A.status))}},null==e||null===(g=e.model)||void 0===g?void 0:g.status)),l().createElement("div",{className:yo.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(v=e.model)||void 0===v?void 0:v.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(_=e.model)||void 0===_?void 0:_.creatorFamilyName," ",null==e||null===(h=e.model)||void 0===h?void 0:h.creatorGivenName))),(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(y=e.model)||void 0===y?void 0:y.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByFamilyName," ",null==e||null===(C=e.model)||void 0===C?void 0:C.submittedByGivenName))),(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByFamilyName," ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(N=e.model)||void 0===N?void 0:N.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(I=e.model)||void 0===I?void 0:I.returnedByFamilyName," ",null==e||null===(T=e.model)||void 0===T?void 0:T.returnedByGivenName),l().createElement("span",{className:yo.text},null==e||null===(B=e.model)||void 0===B?void 0:B.returnReason))),(null==e||null===(U=e.model)||void 0===U?void 0:U.completedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(j=e.model)||void 0===j?void 0:j.completedByFamilyName," ",null==e||null===(z=e.model)||void 0===z?void 0:z.completedByGivenName))),"CANCELLED"===(null==e||null===(F=e.model)||void 0===F?void 0:F.status)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(L=e.model)||void 0===L?void 0:L.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByFamilyName," ",null==e||null===(q=e.model)||void 0===q?void 0:q.cancelledByGivenName,l().createElement("span",{className:yo.text},null==e||null===(G=e.model)||void 0===G?void 0:G.cancelReason)))),"REJECTED"===(null==e||null===(H=e.model)||void 0===H?void 0:H.status)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(Q=e.model)||void 0===Q?void 0:Q.rejectedByFamilyName," ",null==e||null===(J=e.model)||void 0===J?void 0:J.rejectedByGivenName,l().createElement("span",null,null==e||null===(W=e.model)||void 0===W?void 0:W.rejectionReason)))))),(!(null==e||null===(K=e.model)||void 0===K||null===(V=K.permission)||void 0===V?void 0:V.canEdit)&&((null==e||null===($=e.model)||void 0===$||null===(X=$.permission)||void 0===X?void 0:X.canApprove)||(null==e||null===(te=e.model)||void 0===te||null===(ee=te.permission)||void 0===ee?void 0:ee.canReceiveItems))||(null==e||null===(re=e.model)||void 0===re||null===(ne=re.permission)||void 0===ne?void 0:ne.canEdit)||Ie||(null==e||null===(ae=e.model)||void 0===ae||null===(oe=ae.permission)||void 0===oe?void 0:oe.isRequisitionAndCanIssueStock))&&l().createElement("div",{style:{margin:"10px",display:"flex",flexDirection:"row"}},l().createElement(l().Fragment,null,!(null==e||null===(le=e.model)||void 0===le||null===(ie=le.permission)||void 0===ie?void 0:ie.canEdit)&&(null==e||null===(se=e.model)||void 0===se||null===(ce=se.permission)||void 0===ce?void 0:ce.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Gt.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Gt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Dr,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Gt.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Gt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(po,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(xr,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ir,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Br,{operation:null==e?void 0:e.model}))),!(null==e||null===(ge=e.model)||void 0===ge||null===(Ae=ge.permission)||void 0===Ae?void 0:Ae.canEdit)&&(null==e||null===(ve=e.model)||void 0===ve||null===(fe=ve.permission)||void 0===fe?void 0:fe.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(go,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ir,{operation:null==e?void 0:e.model}))),(null==e||null===(he=e.model)||void 0===he||null===(_e=he.permission)||void 0===_e?void 0:_e.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Br,{operation:null==e?void 0:e.model})),(null==e||null===(ye=e.model)||void 0===ye||null===(be=ye.permission)||void 0===be?void 0:be.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(_o,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(Ce=e.model)||void 0===Ce||null===(ke=Ce.permission)||void 0===ke?void 0:ke.isRequisitionAndCanIssueStock)||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Gt.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Gt.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Gt.RECEIPT_OPERATION_TYPE||(null==e||null===(De=e.model)||void 0===De?void 0:De.operationType)===Gt.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(uo,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(tr,null,l().createElement(qt,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Io(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function To(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Io(a,r,o,i,l,"next",e)}function l(e){Io(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Bo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Uo=function(){var e=To((function(e,t,n,o,a,i){var l,c,s,u;return Bo(this,(function(a){switch(a.label){case 0:l=t,a.label=1;case 1:return a.trys.push([1,3,,4]),"requisition"===o.operationType&&delete l.destinationName,o.operationType===Gt.STOCK_ISSUE_OPERATION_TYPE&&(delete l.completedDate,delete l.completedBy,delete l.completedByFamilyName,delete l.completedByGivenName,delete l.operationTypeUuid,delete l.permission,delete l.locked,l.operationTypeUuid="66666666-6666-6666-6666-666666666666"),[4,(n?R:L)(l)];case 2:return(null==(c=a.sent())?void 0:c.data)&&(ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation")),(0,r.showSnackbar)({isLowContrast:!0,title:n?e("editStockOperation","Edit stock operation"):e("addStockOperation","Add stock operation"),kind:"success",subtitle:n?e("stockOperationEdited","Stock operation edited successfully"):e("stockOperationAdded","Stock operation added successfully")}),Y()),[3,4];case 3:return s=a.sent(),u=oe(s),(0,r.showSnackbar)({subtitle:u.join(", "),title:e("errorSavingForm","Error on saving form"),kind:"error",isLowContrast:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a,i){return e.apply(this,arguments)}}(),Po=function(e,t,n,r,o,a){Z(n?e("editOperationTitle","Edit {{operationType}}",{operationType:null==t?void 0:t.operationTypeName}):e("newOperationTitle","New: {{operationName}}",{operationName:null==r?void 0:r.name}),l().createElement(No,{model:t,onSave:function(t){return Uo(e,t,n,r,o,a)},isEditing:n,operation:r,canEdit:!n||"NEW"===(null==t?void 0:t.status)}))},jo=function(){var e=To((function(e,t,n){var o;return Bo(this,(function(a){return o=(0,r.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return o()}}),[2]}))}));return function(t,n,r){return e.apply(this,arguments)}}();function zo(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 Fo=function(e){var t,n,r=e.operationUuid,o=e.operationNumber,c=e.model,s=e.operations,u=(0,E.useTranslation)().t,d=(t=(0,i.useState)(null),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return zo(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)?zo(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.")}()),m=d[0],p=d[1];r&&!m&&F(r).then((function(e){return p(e.data)})).catch((function(e){return console.error("Error fetching stock operation:",e)}));var A={uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1};return l().createElement(l().Fragment,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"View",kind:"ghost",onClick:function(){Po(u,null!=c?c:m,!0,A,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Lo(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 Ro(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Mo(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 Mo(e,t){if(e){if("string"==typeof e)return Lo(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)?Lo(e,t):void 0}}const qo=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Pt(t),c=o.items,s=o.isLoading,u=Ro((0,i.useState)(!1),2),d=u[0],m=u[1],p=Ro((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case ee.STATUS:g(Dt.map((function(e){return{uuid:e,display:e}})));break;case ee.SOURCES:var e;(null==c||null===(e=c.answers)||void 0===e?void 0:e.length)&&(g(function(e){if(Array.isArray(e))return Lo(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Mo(t)||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.")}()),m(s));break;case ee.OPERATION:Bt().then((function(e){var t;m(!0),(null===(t=e.data)||void 0===t?void 0:t.results.length)&&g(e.data.results.map((function(e){return{uuid:e.uuid,display:e.name}}))),m(!1)}))}var t;m(!1)}),[r,s,c.answers]),d?l().createElement(a.iTo,null):l().createElement(a.NUq,{className:Ct.filtersAlign,id:"multiSelect",label:r,size:"md",labelInline:!0,items:A,itemToString:function(e){return e?e.display:"Not Set"},onChange:function(e){var t=e.selectedItems;t&&n(t.map((function(e){return e.display})),r)},placeholder:"Filter by ".concat(r),style:{minWidth:"auto",width:"auto"}})};function Go(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 Ho(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zo(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){Ho(e,t,n[t])}))}return e}function Yo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Qo(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Go(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)?Go(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 Jo=function(){var e,t=(0,E.useTranslation)().t,n=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))},o=(0,i.useMemo)((function(){return{uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1}}),[]),c=bt({v:U.Full,totalCount:!0}),s=c.items,u=c.tableHeaders,d=c.currentPage,m=c.pageSizes,p=c.totalItems,A=c.goTo,g=c.currentPageSize,f=c.setPageSize,v=c.isLoading,_=Qo((0,i.useState)(s),2),h=_[0],b=_[1],y=Qo((0,i.useState)(null),2),k=y[0],C=y[1],w=Qo((0,i.useState)(null),2),S=w[0],D=w[1],O=Qo((0,i.useState)([]),2),x=O[0],N=O[1],I=Qo((0,i.useState)([]),2),T=I[0],B=I[1],P=Qo((0,i.useState)([]),2),j=P[0],z=P[1],F=(0,r.useConfig)(),L=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}});ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))};(0,i.useEffect)((function(){M()}),[k,S,x,T,j,d,g,s]);var R=(0,i.useCallback)((function(e,t){t===ee.SOURCES?N(e):t===ee.OPERATION?z(e):B(e)}),[]),M=function(){var e=s;x.length>0&&(e=e.filter((function(e){return x.includes(e.sourceName)}))),j.length>0&&(e=e.filter((function(e){return j.includes(e.operationTypeName)}))),T.length>0&&(e=e.filter((function(e){return T.includes(e.status)}))),k&&S?e=e.filter((function(e){var t=new Date(e.operationDate);return t>=k&&t<=S})):k?e=e.filter((function(e){return new Date(e.operationDate)>=k})):S&&(e=e.filter((function(e){return new Date(e.operationDate)<=S}))),b(e)},q=(0,i.useMemo)((function(){return null==h?void 0:h.map((function(n,r){var i,c,s,u,d,m,p,A,g,f,v,_,b,y,k,C,E,w,S;return Yo(Zo({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),operationTypeName:"".concat(null==n?void 0:n.operationTypeName),operationNumber:l().createElement(Fo,{model:h[r],operations:e}),status:"".concat(null==n?void 0:n.status),source:"".concat(null!==(i=null==n?void 0:n.sourceName)&&void 0!==i?i:""),destination:"".concat(null!==(c=null==n?void 0:n.destinationName)&&void 0!==c?c:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==n?void 0:n.sourceName)&&void 0!==s?s:""," ",(null==n?void 0:n.sourceName)&&(null==n?void 0:n.destinationName)?l().createElement(se.ol,{size:16}):""," ",null!==(u=null==n?void 0:n.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==n?void 0:n.responsiblePersonFamilyName)&&void 0!==d?d:null==n?void 0:n.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:W(null==n?void 0:n.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("created","Created")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.dateCreated))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(A=n.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=n.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==n?void 0:n.status)&&(null==n?void 0:n.status)!==Et&&(null==n?void 0:n.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("submitted","Submitted")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.submittedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(f=n.submittedByFamilyName)&&void 0!==f?f:""," ",null!==(v=n.submittedByGivenName)&&void 0!==v?v:""))),(null==n?void 0:n.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("completed","Completed")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(_=n.completedByFamilyName)&&void 0!==_?_:""," ",null!==(b=n.completedByGivenName)&&void 0!==b?b:""))),(null==n?void 0:n.status)===wt&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("cancelled","Cancelled")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.cancelledDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(y=n.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=n.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,n.cancelReason))),(null==n?void 0:n.status)===St&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Rejected"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.rejectedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(C=n.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=n.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,n.rejectionReason))),(null==n?void 0:n.status)===Et&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Returned"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},W(null==n?void 0:n.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=n.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=n.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,n.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:L}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){Po(t,h[r],!0,o,e,!1)}}))})}))}),[L,h,o,e,t]);return v?l().createElement(a.gqd,{className:Ct.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:Ct.tableOverride},l().createElement(a.x45,null,t("stockOperationTrackMovement","Stock operations to track movement of stock.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:q,headers:u,isSortable:!0,useZebraStyles:!0,render:function(o){var i=o.rows,c=o.headers,u=o.getHeaderProps,d=o.getTableProps,m=o.getRowProps,p=o.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Ct.toolbarContent},l().createElement(a.Ys1,{className:Ct.patientListSearch,expanded:!0,onChange:p,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:Ct.filterContainer},l().createElement(a.Mtg,{className:Ct.dateAlign,datePickerType:"range",dateFormat:K,value:[k,S],onChange:function(e){var t=Qo(e,2);!function(e){var t=Qo(e,2),n=t[0],r=t[1];n&&(C(n),S&&n&&S<n&&D(n)),r&&(D(r),k&&r&&k>r&&C(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:V}),l().createElement(a.aj6,{placeholder:V})),l().createElement(qo,{conceptUuid:F.stockSourceTypeUUID,filterName:ee.SOURCES,onFilterChange:R}),l().createElement(qo,{filterName:ee.STATUS,onFilterChange:R}),l().createElement(qo,{filterName:ee.OPERATION,onFilterChange:R})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Ft,{onOperationTypeSelected:function(n){Po(t,fn(),!1,n,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),c.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Yo(Zo({},u({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Ct.desktopHeader:Ct.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,i.map((function(e,n){var o,i,u,d,p,A,g,f,v,_,b,y,k,C,E,w,S,D,O,x,N,I,T,B,U,P,j,z,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Zo({className:r.isDesktop?Ct.desktopRow:Ct.tabletRow},m({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))),l().createElement(a.WdL,{colSpan:c.length+2},l().createElement(l().Fragment,null,l().createElement(a.SmK,null,l().createElement(a.s1N,{head:!0},l().createElement(a.agF,{head:!0},t("dateCreated","Date Created")),l().createElement(a.agF,{head:!0},t("dateCompleted","Date Completed")),l().createElement(a.agF,{head:!0},t("batchNumber","Batch Number")),l().createElement(a.agF,{head:!0},"Qty"))),l().createElement(a.FxI,null,l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(o=h[n])||void 0===o?void 0:o.dateCreated)?W(null===(i=h[n])||void 0===i?void 0:i.dateCreated):""," ",(null===(u=h[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(d=h[n])||void 0===d?void 0:d.dateCreated)?null===(p=h[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=h[n])||void 0===A?void 0:A.completedDate)?W(null===(g=h[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=h[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=h[n])||void 0===v?void 0:v.completedDate)?null===(_=h[n])||void 0===_?void 0:_.creatorFamilyName:""),l().createElement(a.agF,null,(null===(b=h[n])||void 0===b?void 0:b.stockOperationItems)?null===(y=h[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=h[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=h[n].stockOperationItems)||void 0===C?void 0:C.map((function(e){return e.quantity}))[0]:"")),l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(E=h[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?W(null===(w=h[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=h[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(D=h[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=h[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=h[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?W(null===(N=h[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=h[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=h[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=h[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(U=h[n])||void 0===U?void 0:U.completedDate)?null===(P=s[n])||void 0===P?void 0:P.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=h[n])||void 0===j?void 0:j.stockOperationItems)?null===(z=h[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=h[n])||void 0===F?void 0:F.stockOperationItems)?null===(L=h[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===i.length?l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("div",{className:Ct.tileContent},l().createElement("p",{className:Ct.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:Ct.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:g,pageSizes:m,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==g&&f(t),n!==d&&A(n)},className:Ct.paginationOverride}))};var Wo={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function Vo(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 Ko(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vo(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)?Vo(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 Xo(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const $o=function(e){var t,n,o,c,s=Ko((0,i.useState)(""),2),u=s[0],d=s[1],m=(0,E.useTranslation)().t,p=(t=u,o={v:U.Default,q:t,limit:20},c=function(e){var t="".concat(r.restBaseUrl,"/drug").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n||o),{drugList:c.items.results,isLoading:c.isLoading}),A=p.isLoading,g=p.drugList,f=Ko((0,i.useState)(!1),2),v=f[0],_=f[1];return l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:g||[],initialSelectedItem:null!==(n=null==g?void 0:g.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:Xo,onChange:function(t){var n,o,a,l,c;_(!1),null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),i(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid),(null==t||null===(a=t.selectedItem)||void 0===a?void 0:a.uuid)&&((c=null==t||null===(l=t.selectedItem)||void 0===l?void 0:l.uuid)&&function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem?drugUuid=").concat(e,"&limit=1");return(0,r.openmrsFetch)(t).then((function(e){return e.data}))}(c).then((function(e){var t,n,r=0!==(null!==(n=null==e||null===(t=e.results)||void 0===t?void 0:t.length)&&void 0!==n?n:0);_(r)})))},onInputChange:function(e){d(e)},inputValue:u,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),A&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}),v&&l().createElement("div",{style:{color:"#da1e28"}},m("itemAlreadyExists","Item already exits")))};var ea=on.z.string().max(255).nullish(),ta=on.z.object({isDrug:on.z.boolean(),drugUuid:on.z.string().nullish(),drugName:on.z.string().nullish(),commonName:ea,acronym:ea,hasExpiration:on.z.boolean(),expiryNotice:on.z.coerce.number().nullish(),uuid:on.z.string().nullish(),conceptUuid:on.z.string().nullish(),conceptName:on.z.string().nullish(),preferredVendorUuid:on.z.string().nullish(),preferredVendorName:on.z.string().nullish(),purchasePrice:on.z.number().nullish(),purchasePriceUoMUuid:on.z.string().nullish(),purchasePriceUoMName:on.z.string().nullish(),categoryUuid:on.z.string().nullish(),categoryName:on.z.string().nullish(),dispensingUnitUuid:on.z.string().nullish(),dispensingUnitName:on.z.string().nullish(),dispensingUnitPackagingUoMUuid:on.z.string().nullish(),dispensingUnitPackagingUoMName:on.z.string().nullish(),defaultStockOperationsUoMUuid:on.z.string().nullish(),defaultStockOperationsUoMName:on.z.string().nullish(),reorderLevel:on.z.number().nullish(),reorderLevelUoMUuid:on.z.string().nullish(),reorderLevelUoMName:on.z.string().nullish(),dateCreated:on.z.coerce.date().nullish(),creatorGivenName:on.z.string().nullish(),creatorFamilyName:on.z.string().nullish(),voided:on.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ra=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.SYO,(n=function(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){na(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t,n,r){i(t,n,r),e.onChange&&e.onChange(t,n,r)},id:e.name,ref:s,defaultSelected:e.id,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),e.options.map((function(t,n){return l().createElement(a.EUY,{key:"".concat(n,"-").concat(e.name,"-").concat(t.value),id:"".concat(e.name,"-").concat(t.value),labelText:t.label,value:t.value,checked:c===t.value,onChange:function(){return i(t.value)},ref:s})})))}})},oa=function(e){return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.Y2U,{label:e.label,id:"".concat(e.name,"-").concat(e.id,"-").concat(null===(n=e.row)||void 0===n?void 0:n.uuid),value:null!==(o=null===(r=e.row)||void 0===r?void 0:r.factor)&&void 0!==o?o:s,min:e.min,hideSteppers:e.hideSteppers||!1,ref:u,onChange:function(t,n){c(t,n),e.onChange&&e.onChange(t,n)}})}})},aa=function(e){var t=Pt((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n;null===(n=e.onDispensingUnitChange)||void 0===n||n.call(e,t.selectedItem),c(t.selectedItem.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.dispensingUnitUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.display)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})};function ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function la(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){ia(e,t,n[t])}))}return e}function ca(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}const sa=function(e){var t=ca({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.preferredVendorUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},ua=function(e){var t=(0,E.useTranslation)().t,n=Pt((0,r.useConfig)().stockItemCategoryUUID),o=n.items.answers,i=n.isLoading,c=e.itemType?null==o?void 0:o.filter((function(t){return t.display===(null==e?void 0:e.itemType)})):o;return i?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(n){var r,i,s=n.field,u=s.onChange,d=s.value,m=s.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:c||[],onChange:function(t){var n,r;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),u(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==o?void 0:o.find((function(t){return t.uuid===e.categoryUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(t(null==e?void 0:e.display)):""},shouldFilterItem:function(){return!0},value:null!==(i=t(null==o||null===(r=o.find((function(e){return e.uuid===d})))||void 0===r?void 0:r.display))&&void 0!==i?i:"",placeholder:e.placeholder,ref:m,invalid:e.invalid,invalidText:e.invalidText})}})},da=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits.find((function(t){return(null==t?void 0:t.uuid)===(null==e?void 0:e.dispensingUnitPackagingUoMUuid)})):null}),[null==e?void 0:e.packagingUnits]);return e.isLoading?l().createElement(a.xNL,null):(null==e?void 0:e.packagingUnits)&&(null==e?void 0:e.packagingUnits.length)>0?l().createElement("div",null,l().createElement(nn.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=null==n?void 0:n.uuid)&&void 0!==t?t:"",render:function(t){var r,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(r=e.packagingUnits)&&void 0!==r?r:[],onChange:function(t){var n,r;null===(n=e.onDispensingUnitPackagingUoMUuidChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),i(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:n,itemToString:function(e){return(null==e?void 0:e.packagingUomName)?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):"Not set"},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}})):l().createElement(l().Fragment,null)},ma=function(e){var t,n,r,o,i,c,s,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=fe(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),v?l().createElement(a.iJ5,null):l().createElement(oa,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(s=f.reorderLevel)&&void 0!==s?s:"",invalidText:p.reorderLevel&&(null==p||null===(r=p.reorderLevel)||void 0===r?void 0:r.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(o=p.reorderLevelUoMUuid)||void 0===o?void 0:o.message)}),v?l().createElement(a.iJ5,null):l().createElement(oa,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price:"),value:null!==(u=f.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(c=p.purchasePriceUoMUuid)||void 0===c?void 0:c.message)})):l().createElement(l().Fragment,null)};function pa(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 Aa=function(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/concept").concat(j({})),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(),c=o.items.results,s=o.isLoading,u=(t=(0,i.useState)(""),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return pa(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)?pa(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.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return s?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p,onChange:function(t){var n;null===(n=e.onConceptUuidChange)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},initialSelectedItem:(null==c?void 0:c.find((function(t){return t.uuid===e.conceptUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};var ga=[{label:"Pharmaceuticals",value:!0},{label:"Non Pharmaceuticals",value:!1}],fa=[{label:"Yes",value:!0},{label:"No",value:!1}];function va(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 _a(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ha(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return va(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)?va(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.")}()}var ba=(0,i.forwardRef)((function(e){var t,n,o,c,s,u,d,m,p,A,g,f=e.model,v=e.onSave,_=e.isEditing,h=e.handleTabChange,b=(0,E.useTranslation)().t,y=(0,nn.cI)({defaultValues:f,mode:"all",resolver:(0,rn.F)(ta)}),k=y.handleSubmit,C=y.control,w=y.formState,S=w.errors,D=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){_a(a,r,o,i,l,"next",e)}function l(e){_a(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,3,4]),I(!0),e.uuid=f.uuid,[4,v(e)];case 1:return t.sent(),h(1),ae("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),[3,4];case 2:return t.sent(),[3,4];case 3:return I(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),O=ha((0,i.useState)(!1),2),x=O[0],I=O[1],T=ha((0,i.useState)(!1),2),B=T[0],U=T[1],P=ha((0,i.useState)(""),2),j=P[0],z=P[1],F=ha((0,i.useState)(!1),2),L=F[0],R=F[1];return(0,i.useEffect)((function(){var e,t;U(null!==(e=f.isDrug)&&void 0!==e&&e),z(!0===f.isDrug?"Pharmaceuticals":!1===f.isDrug?"Non Pharmaceuticals":void 0),R(null!==(t=f.hasExpiration)&&void 0!==t&&t)}),[f.hasExpiration,f.isDrug]),l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(ra,{control:C,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!S.isDrug,invalidText:S.isDrug&&(null==S||null===(t=S.isDrug)||void 0===t?void 0:t.message),onChange:function(e){var t=ga.find((function(t){return t.value===e})),n=t?t.label:"";U(e),z(n)},options:ga})),B&&l().createElement($o,{name:"drugUuid",controllerName:"drugUuid",control:C,title:b("pleaseSpecify","Please specify:"),placeholder:"Choose a drug",invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(n=S.drugUuid)||void 0===n?void 0:n.message)}),null!=B&&!B&&l().createElement(Aa,{name:"conceptUuid",controllerName:"conceptUuid",control:C,title:b("pleaseSpecify","Please specify")+":",placeholder:b("chooseAnItem","Choose an item"),invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(o=S.drugUuid)||void 0===o?void 0:o.message)}),l().createElement(yn,{id:"commonName",name:"commonName",control:C,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(g=null==f?void 0:f.commonName)&&void 0!==g?g:""),labelText:b("commonName","Common name")+":",invalid:!!S.commonName,invalidText:S.commonName&&(null==S||null===(c=S.commonName)||void 0===c?void 0:c.message)}),l().createElement(yn,{id:"acronym",maxLength:255,name:"acronym",control:C,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation")+":",invalid:!!S.acronym,invalidText:S.acronym&&(null==S||null===(s=S.acronym)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(ra,{name:"hasExpiration",controllerName:"hasExpiration",control:C,legendText:"",invalid:!!S.hasExpiration,invalidText:S.hasExpiration&&(null==S||null===(u=S.hasExpiration)||void 0===u?void 0:u.message),onChange:function(e){R(e)},options:fa})),L&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(oa,{id:"expiryNotice",name:"expiryNotice",control:C,controllerName:"expiryNotice",min:0,size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!S.expiryNotice,invalidText:S.expiryNotice&&(null==S||null===(d=S.expiryNotice)||void 0===d?void 0:d.message)}))),l().createElement(sa,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:C,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!S.preferredVendorUuid,invalidText:S.preferredVendorUuid&&(null==S||null===(m=S.preferredVendorUuid)||void 0===m?void 0:m.message)}),l().createElement(ua,{name:"categoryUuid",controllerName:"categoryUuid",control:C,itemType:"Pharmaceuticals"===j?"Drugs":"Non Pharmaceuticals"===j?"Non Drugs":void 0,title:b("category:","Category")+":",placeholder:b("chooseACategory","Choose a category"),invalid:!!S.categoryUuid,invalidText:S.categoryUuid&&(null==S||null===(p=S.categoryUuid)||void 0===p?void 0:p.message)}),B&&l().createElement(aa,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:C,title:b("dispensingUnit","Dispensing Unit")+":",placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!S.dispensingUnitUuid,invalidText:S.dispensingUnitUuid&&(null==S||null===(A=S.dispensingUnitUuid)||void 0===A?void 0:A.message)}),B&&_&&l().createElement(ma,{control:C,formState:w,stockItemUuid:f.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:k(D),kind:"primary",renderIcon:dr.vc},x?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Y},b("cancel","Cancel"))))}));const ya=ba;function ka(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 Ca(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ka(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)?ka(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.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,i.useMemo)((function(){return[{key:"location",header:"Location"},{key:"name",header:"Name"},{key:"quantity",header:"Quantity Threshold"},{key:"evaluationFrequency",header:"Frequency Check"},{key:"actionFrequency",header:"Notification Frequency"},{key:"alertRole",header:"Alert Role"},{key:"mailRole",header:"Mail Role"},{key:"enabled",header:"Enabled?"},{header:"actions",key:"actions"}]}),[]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:f}}var Ea=n(4563),wa={};wa.styleTagTransform=h(),wa.setAttributes=g(),wa.insert=p().bind(null,"head"),wa.domAPI=d(),wa.insertStyleElement=v(),s()(Ea.Z,wa);const Sa=Ea.Z&&Ea.Z.locals?Ea.Z.locals:void 0;function Da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oa(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){Da(e,t,n[t])}))}return e}function xa(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 Na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ia(){return Ia=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ia.apply(this,arguments)}function Ta(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){Na(e,t,n[t])}))}return e}function Ba(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Ua(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xa(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)?xa(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 Pa=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t,u=Ua((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),d=u[0],m=u[1];(0,i.useEffect)((function(){m({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:c})}),[c]);var p=ge(d).items,A=Nt().stockLocations,g=It({v:U.Default}).items,f=Ua((0,i.useState)(Ta({enabled:!0},o)),2),v=f[0],_=f[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){var e=Ta({},Ia({},function(e){if(null==e)throw new TypeError("Cannot destructure "+e);return e}(o)));_(e)}}),[o]);var h=(0,i.useCallback)((function(e){e.preventDefault(),o&&(v.uuid=o.uuid),c&&(v.stockItemUuid=c),function(e){var t=null!=e.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(t?"/"+e.uuid:""),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:Oa({},e)})}(v).then((function(){(0,r.showSnackbar)({isLowContrast:!0,title:s("addedRule","Add Rule"),kind:"success",subtitle:s("stockRuleAddedSuccessfully","Stock Rule Added Successfully")}),Y()}),(function(e){(0,r.showSnackbar)({title:s("errorAddingRule","Error adding a rule"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch()}),[v,o,s,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:Sa.section},l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==v?void 0:v.locationUuid)?v.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.id===e.target.value}));_(Ba(Ta({},v),{locationUuid:t.id}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"name",type:"text",labelText:s("name","Rule Name"),size:"md",onChange:function(e){o&&(o.name=e.target.value),_(Ba(Ta({},v),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==v?void 0:v.stockItemPackagingUOMUuid)?v.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));_(Ba(Ta({},v),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:s("quantity","Quantity Threshold"),size:"md",onChange:function(e){o&&(o.quantity=Number(e.target.value)),_(Ba(Ta({},v),{quantity:Number(e.target.value)}))},value:null==o?void 0:o.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==v?void 0:v.alertRole)?v.alertRole:"",onChange:function(e){var t=null==g?void 0:g.results.find((function(t){return t.display===e.target.value}));_(Ba(Ta({},v),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==g||null===(t=g.results)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==v?void 0:v.mailRole)?v.mailRole:"",onChange:function(e){var t=null==g?void 0:g.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),_(Ba(Ta({},v),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==g||null===(n=g.results)||void 0===n?void 0:n.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:s("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){o&&(o.evaluationFrequency=Number(e.target.value)),_(Ba(Ta({},v),{evaluationFrequency:Number(e.target.value)}))},value:null==o?void 0:o.evaluationFrequency,placeholder:"e.g 30 Minutes"}),l().createElement(a.oil,{id:"actionFrequency",type:"number",labelText:s("actionFrequency","Notification Frequency (Minutes)"),size:"md",onChange:function(e){o&&(o.actionFrequency=Number(e.target.value)),_(Ba(Ta({},v),{actionFrequency:Number(e.target.value)}))},value:null==o?void 0:o.actionFrequency,placeholder:"e.g 3600 Minutes"}))),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Sa.checkboxGrid},l().createElement(a.XZJ,{onChange:function(){var e=!(null==v?void 0:v.enabled);_(Ba(Ta({},v),{enabled:e}))},checked:null==v?void 0:v.enabled,labelText:"Enabled ?",value:null==o?void 0:o.enabled,id:"chk-ruleEnabled"}))),l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Sa.checkboxGrid},l().createElement(a.XZJ,{onChange:function(){var e=!(null==v?void 0:v.enableDescendants);_(Ba(Ta({},v),{enableDescendants:e}))},name:"appliesToChildren",checked:null==v?void 0:v.enableDescendants,value:null==o?void 0:o.enableDescendants,labelText:"Applies to child locations?",id:"chk-ruleAppliesToChildren"})))),l().createElement("div",null,"This stock rule will be evaluated by checking if the stock quantities have lowered to the threshold or below and a notification will be sent to the personnel with the specified role in the given location. The notification will only be sent once per specified notification frequency.")),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Y},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},ja=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Z("Add Stock Rule",l().createElement(Pa,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("addNewStockRule","Add New Rule"))};var za=n(4907),Fa={};Fa.styleTagTransform=h(),Fa.setAttributes=g(),Fa.insert=p().bind(null,"head"),Fa.domAPI=d(),Fa.insertStyleElement=v(),s()(za.Z,Fa);const La=za.Z&&za.Z.locals?za.Z.locals:void 0;function Ra(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 Ma=function(e){var t,n=e.stockItemUuid,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}({v:U.Default,totalCount:!0,stockItemUuid:n}),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:La.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Ra(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Ra(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)?Ra(e,t):void 0}}(t)||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.")}()),itemToString:function(e){return e?e.display:"Not Set"},type:"inline",size:"sm"})))};function qa(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 Ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ha=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return qa(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)?qa(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.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t,n,a;(t=o,n="".concat(r.restBaseUrl,"/stockmanagement/stockrule/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){d(!1),(0,r.showSnackbar)({isLowContrast:!0,title:c("deletingRule","Delete Rule"),kind:"success",subtitle:c("stockRuleDeletedSuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,r.showSnackbar)({title:c("errorDeletingRule","Error deleting a rule"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteRule","Delete Rule"),renderIcon:function(e){return l().createElement(ue.ZN,function(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){Ga(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Za(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ya=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Z("Edit Stock Rule",l().createElement(Pa,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(At.I8,function(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){Za(e,t,n[t])}))}return e}({size:16},e))}})};function Qa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ja(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){Qa(e,t,n[t])}))}return e}function Wa(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Va=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t),o=Ca({v:U.Default,totalCount:!0,stockItemUuid:t}),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.currentPage,m=o.currentPageSize,p=o.pageSizes,A=o.totalItems,g=o.setPageSize,f=o.goTo,v=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e,t){var n,r;return Wa(Ja({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated:W(null==e?void 0:e.dateCreated),location:null==e?void 0:e.locationName,quantity:"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(r=null==e?void 0:e.packagingUomName)&&void 0!==r?r:""),name:"".concat(null==e?void 0:e.name),description:"".concat(null==e?void 0:e.description),evaluationFrequency:"".concat(null==e?void 0:e.evaluationFrequency," minutes"),actionFrequency:"".concat(null==e?void 0:e.actionFrequency," minutes"),lastActionDate:W(null==e?void 0:e.lastActionDate),nextActionDate:W(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Ya,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Ha,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Ct.tableOverride},l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:v,headers:u,isSortable:!0,useZebraStyles:!0,render:function(e){var o=e.rows,i=e.headers,c=e.getHeaderProps,s=e.getTableProps,u=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Ct.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Ma,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(ja,{stockItemUuid:t}))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Wa(Ja({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Ct.desktopHeader:Ct.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ja({className:r.isDesktop?Ct.desktopRow:Ct.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===o.length?l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("div",{className:Ct.tileContent},l().createElement("p",{className:Ct.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:Ct.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:m,pageSizes:p,totalItems:A,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&g(t),n!==d&&f(n)},className:Ct.paginationOverride}))};function Ka(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 Xa(e){return function(e){if(Array.isArray(e))return Ka(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ka(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)?Ka(e,t):void 0}}(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.")}()}const $a=function(e){var t=Pt((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i,c,s,u,d,m,p,A=t.field.onChange;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:"".concat(e.name,"-").concat(e.row.id,"-").concat(e.row.uuid),size:"md",items:void 0!==(null===(r=e.row)||void 0===r?void 0:r.packagingUomUuid)?Xa(n.some((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.packagingUomUuid)}))?[]:[{uuid:null===(o=e.row)||void 0===o?void 0:o.packagingUomUuid,display:null===(i=e.row)||void 0===i?void 0:i.packagingUomName}]).concat(Xa(null!=n?n:[])):n||[],onChange:function(t){var n,r;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),A((null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)||"")},initialSelectedItem:void 0!==(null===(c=e.row)||void 0===c?void 0:c.packagingUomUuid)?{uuid:null===(s=e.row)||void 0===s?void 0:s.packagingUomUuid,display:null===(u=e.row)||void 0===u?void 0:u.packagingUomName}:null,selectedItem:void 0!==(null===(d=e.row)||void 0===d?void 0:d.packagingUomUuid)?{uuid:null===(m=e.row)||void 0===m?void 0:m.packagingUomUuid,display:null===(p=e.row)||void 0===p?void 0:p.packagingUomName}:null,itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText})}})};var ei=on.z.object({id:on.z.string().nullish(),uuid:on.z.string().nullish(),stockItemUuid:on.z.string().nullish(),packagingUomName:on.z.string().nullish(),packagingUomUuid:on.z.string().nullish(),factor:on.z.coerce.number().nullish(),isDefaultStockOperationsUoM:on.z.boolean().nullish(),isDispensingUnit:on.z.boolean().nullish()});function ti(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 ni(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ri(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){ni(e,t,n[t])}))}return e}function oi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function ai(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||li(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 ii(e){return function(e){if(Array.isArray(e))return ti(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||li(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 li(e,t){if(e){if("string"==typeof e)return ti(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)?ti(e,t):void 0}}const ci=function(e){var t=e.stockItemUuid,n=e.handleTabChange,o=ye(),c=o.items,s=o.isLoading,u=o.setStockItemUuid,d=o.mutate,m=ai((0,i.useState)(c),2),p=m[0],A=m[1],g=ai((0,i.useState)({packagingUomUuid:void 0,factor:0,packagingUomName:""}),2),f=g[0],v=g[1];(0,i.useEffect)((function(){u(t)}),[t,u]),(0,i.useEffect)((function(){A(c)}),[c]);var _=(0,E.useTranslation)().t,h=(0,i.useMemo)((function(){return[{key:"packaging",header:_("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:_("packSize","Pack Size"),styles:{width:"50%"}},{key:"action",header:_("action","Actions"),styles:{width:"50%"}}]}),[_]),b=(0,nn.cI)({defaultValues:{},mode:"all",resolver:(0,rn.F)(ei)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(nn.RV,b,l().createElement(a.wQF,{rows:ii(c).concat([{}]),headers:h,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:Ee.packagingTableContainer},l().createElement(a.iA_,oi(ri({},r()),{className:Ee.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,oi(ri({},n({header:e,isSortable:!1})),{style:e.styles,key:e.key}),null!==(r=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==r?r:e.header)})),l().createElement(a.xDH,{style:{width:"70%"}}))),l().createElement(a.RMI,{className:Ee.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(si,{row:e,id:"".concat(t,"-").concat(null==e?void 0:e.uuid),onChange:function(t){return function(e,t){var n="number"==typeof t?t:parseFloat(t);A((function(t){return t.map((function(t){return t.uuid===e.uuid?oi(ri({},t),{factor:n}):t}))}))}(e,t)}})})),l().createElement(si,{row:f||{},id:"new-package-unit",isEditing:!0,onChangePackageUnit:function(e){return t=e,void v(oi(ri({},f),{packagingUomUuid:t.uuid,packagingUomName:t.display}));var t},onChange:function(e){return function(e){v(oi(ri({},f),{factor:Number(e)}))}(e)}}))))}}),l().createElement("div",{className:Ee.packageUnitsBtn},l().createElement(a.zxk,{kind:"secondary",onClick:function(){n(0)}},_("cancel","Cancel")),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=b.reset,o=f?{factor:f.factor,packagingUomUuid:f.packagingUomUuid,stockItemUuid:t}:null,a=p.filter((function(e){var t=c.find((function(t){return t.uuid===e.uuid}));return t&&t.factor!==e.factor})),i=o.packagingUomUuid?function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}(o).then((function(){(0,r.showSnackbar)({title:_("savePackingUnitTitle","Package Unit"),subtitle:_("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"}),v({factor:0,packagingUomUuid:void 0,packagingUomName:""})}),(function(){(0,r.showSnackbar)({title:_("savePackagingUnitErrorTitle","Package Unit"),subtitle:_("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})):Promise.resolve({status:"no-create"}),l=a.map((function(e){return function(e,t){var n="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:e})}(e,e.uuid).then((function(){(0,r.showSnackbar)({title:_("updatePackingUnitTitle","Package Unit"),subtitle:_("updatePackingUnitMessage","Package Unit {{ name }} updated successfully",{name:e.packagingUomName}),kind:"success"})}),(function(){(0,r.showSnackbar)({title:_("updatePackagingUnitErrorTitle","Package Unit"),subtitle:_("updatePackagingUnitErrorMessage","Error updating package unit {{name}}",{name:e.packagingUomName}),kind:"error"})}))}));Promise.all([i].concat(ii(l))).then((function(){d(),ae("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),e(),n(0)}))},kind:"primary",renderIcon:dr.vc},_("save","Save"))))};var si=function(e){var t=e.isEditing,n=e.row,r=e.id,o=e.onChange,i=e.onChangePackageUnit,c=(0,nn.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(l().Fragment,null,l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement($a,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",placeholder:"Filter",control:s,onPackageUnitChange:function(e){return i(e)},invalid:!!u.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement(oa,{row:n,controllerName:"factor",name:"factor",min:0,control:s,id:r,invalid:!!u.factor,hideSteppers:!0,onChange:function(e,t){return o(t.value)}})),l().createElement(a.pj1,null,l().createElement(de,{closeModal:function(){return!0},row:n}))))};function ui(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 di(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ui(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)?ui(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.")}()}var mi=n(3162),pi=n(4655),Ai={};Ai.styleTagTransform=h(),Ai.setAttributes=g(),Ai.insert=p().bind(null,"head"),Ai.domAPI=d(),Ai.insertStyleElement=v(),s()(pi.Z,Ai);const gi=pi.Z&&pi.Z.locals?pi.Z.locals:void 0;function fi(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 vi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _i(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||hi(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 hi(e,t){if(e){if("string"==typeof e)return fi(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)?fi(e,t):void 0}}const bi=function(e){var t=e.columns,n=e.data,o=e.children,c=e.totalItems,s=e.goToPage,u=e.hasToolbar,d=void 0===u||u,m=(0,E.useTranslation)().t,p=(0,r.useLayoutType)(),A=_i((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=_i((0,i.useState)(n),1)[0],h=[10,20,30,40,50],b=_i((0,i.useState)(10),2),y=b[0],k=b[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,D=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(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){vi(e,t,n[t])}))}return e}({},t),o=null!=(o={id:n++})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r));var r,o})),f(e)}),[S,g]);var O=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,mi.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,mi.saveAs)(o,"data.json")}},x=function(e,t){var n,r=t.map((function(e){return e.header})).join(","),o=e.map((function(e){return t.map((function(t){return JSON.stringify(e[t.key])})).join(",")}));return[r].concat((n=o,function(e){if(Array.isArray(e))return fi(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||hi(n)||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.")}())).join("\n")};return l().createElement(l().Fragment,null,l().createElement(a.wQF,{"data-floating-menu-container":!0,rows:g,headers:t,filterRows:function(e){var t=e.rowIds,n=e.headers,r=e.cellsById,o=e.inputValue,a=e.getCellId;return t.filter((function(e){return n.some((function(t){var n=t.key,i=a(e,n),l=r[i].value,c=o.toLowerCase();return"boolean"!=typeof l&&(""+l).toLowerCase().includes(c)}))}))},overflowMenuOnHover:(0,r.isDesktop)(p),size:v?"lg":"md",useZebraStyles:!0},(function(e){var t=e.rows,n=e.headers,r=e.getHeaderProps,i=e.getTableProps,u=e.onInputChange;return l().createElement("div",null,l().createElement(a.xJi,{className:gi.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:gi.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:At.rT,iconDescription:"Download As",focusTrap:!1},l().createElement(a.laM,{itemText:"Download As CSV",onClick:O}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:O}),l().createElement(a.laM,{itemText:"Download As Json",onClick:O})),l().createElement(a.Ys1,{className:gi.itemListSearch,expanded:!0,onChange:u,placeholder:m("searchThisList","Search this list"),size:"sm"})))),l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){return l().createElement(a.xDH,r({header:e}),e.header)})))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(a.SCH,{key:e.id},e.cells.map((function(e){return l().createElement(a.pj1,{key:e.id},e.value)})))})))),0===t.length?l().createElement("div",{className:gi.tileContainer},l().createElement(a.n9L,{className:gi.tile},l().createElement("div",{className:gi.tileContent},l().createElement("p",{className:gi.content},m("noData","No data to display")),l().createElement("p",{className:gi.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:D,pageSize:y,pageSizes:h,totalItems:c||(null==_?void 0:_.length),className:gi.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==D){if(s)return void s(n);w(n)}}})))})))},yi=function(e){var t=(0,E.useTranslation)().t,n=Nt().stockLocations;return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function ki(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 Ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ei(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){Ci(e,t,n[t])}))}return e}function wi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Si(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ki(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)?ki(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 Di=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=Si((0,i.useState)(),2),c=o[0],s=o[1],u=function(e){var t=di((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||U.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0}),2),n=t[0],o=t[1],a=di((0,i.useState)(10),2),l=a[0],c=a[1],s=di((0,i.useState)(null),2),u=s[0],d=s[1],m=di((0,i.useState)(1),2),p=m[0],A=m[1],g=di((0,i.useState)(null==e?void 0:e.stockItemUuid),2),f=g[0],v=g[1],_=di((0,i.useState)(null==e?void 0:e.partyUuid),2),h=_[0],b=_[1],y=di((0,i.useState)(null==e?void 0:e.locationUuid),2),k=y[0],C=y[1],E=di((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),w=E[0],S=E[1];(0,i.useEffect)((function(){o({startIndex:p-1,v:U.Default,limit:l,q:u,totalCount:!0,stockItemUuid:f,partyUuid:h,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,h,k,w]);var D=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemtransaction").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),O=D.items,x=D.isLoading,N=D.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:b,setStockBatchUuid:S}}(c),d=u.isLoading,m=u.items,p=u.tableHeaders,A=u.totalCount,g=u.setCurrentPage,f=u.setStockItemUuid,v=u.setLocationUuid,_=Si((0,i.useState)(null),2),h=(_[0],_[1],Si((0,i.useState)(null),2));h[0],h[1],(0,i.useEffect)((function(){f(t)}),[t,f]);var b,y=(0,nn.cI)({}).control,k=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e){var t,n,r,o,a,i,c;return wi(Ei({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),date:W(null==e?void 0:e.dateCreated),location:e.operationSourcePartyName&&e.operationDestinationPartyName?e.operationSourcePartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationSourcePartyName),l().createElement(se.Xd,{size:16})," ",e.operationDestinationPartyName)):e.operationDestinationPartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationDestinationPartyName),l().createElement(se.Xd,{size:16})," ",e.operationSourcePartyName)):null==e?void 0:e.partyName:null==e?void 0:e.partyName,transaction:(null==e?void 0:e.isPatientTransaction)?"Patient Dispense":e.stockOperationTypeName,quantity:"".concat(null==e||null===(t=e.quantity)||void 0===t?void 0:t.toLocaleString()," ").concat(null!==(o=null==e?void 0:e.packagingUomName)&&void 0!==o?o:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(W(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(Fo,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:b}):l().createElement(l().Fragment,null),status:null!==(a=null==e?void 0:e.stockOperationStatus)&&void 0!==a?a:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(i=null==e?void 0:e.packagingUomName)&&void 0!==i?i:""," of ").concat(e.packagingUomFactor):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(r=-1*(null==e?void 0:e.quantity))||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""," of ").concat(e.packagingUomFactor):""})}))}),[m,b]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(bi,{children:function(){return l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement(yi,{onLocationIdChange:function(e){v(e),s(wi(Ei({},c),{locationUuid:e}))},name:"TransactionLocationUuid",placeholder:n("filterByLocation","Filter by Location"),control:y,controllerName:"TransactionLocationUuid"}))},columns:p,data:k,totalItems:A,goToPage:g,hasToolbar:!0})},Oi=function(e){var t=(0,E.useTranslation)().t,n=Nt().stockLocations;return l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function xi(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 Ni(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ii(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){Ni(e,t,n[t])}))}return e}function Ti(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Bi=function(e){var t,n,r=e.stockItemUuid,o=(t=(0,i.useState)(),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return xi(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)?xi(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.")}()),c=o[0],s=o[1],u=Hn(c),d=u.isLoading,m=u.items,p=u.totalCount,A=u.setCurrentPage,g=u.setStockItemUuid,f=u.setLocationUuid,v=(0,E.useTranslation)().t,_=(0,nn.cI)({}).control;(0,i.useEffect)((function(){g(r)}),[r,g]);var h=(0,i.useMemo)((function(){return[{key:"location",header:v("location","Location")},{key:"batch",header:v("batchNumber","Batch Number")},{key:"quantity",header:v("quantity","Quantity")},{key:"packaging",header:v("packagingUnit","Packaging Unit")},{key:"expires",header:v("expires","Expires")}]}),[v]),b=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n,r,o,a,i;return Ti(Ii({},e),{id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:W(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})}))}),[m]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(bi,{children:function(){return l().createElement(l().Fragment,null,l().createElement(Oi,{control:_,onLocationIdChange:function(e){f(e),s(Ti(Ii({},c),{locationUuid:e}))},placeholder:v("filterByLocation","Filter by Location"),name:"BatchLocationUuid",controllerName:"BatchLocationUuid"}))},columns:h,data:b,totalItems:p,goToPage:A,hasToolbar:!0})};function Ui(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 Pi(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ui(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)?Ui(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 ji(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const zi=function(e){var t=e.stockItemUuid,n=function(e){var t=Pi((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Pi((0,i.useState)(10),2),a=o[0],l=o[1],c=Pi((0,i.useState)(null),2),s=c[0],u=c[1],d=Pi((0,i.useState)(1),2),m=d[0],p=d[1],A=Pi((0,i.useState)(),2),g=A[0],f=A[1],v=Pi((0,i.useState)(),2),_=v[0],h=v[1],b=Pi((0,i.useState)(),2),y=b[0],k=b[1],C=Pi((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,D=pe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}(U.Default),r=n.isLoading,o=n.items,c=n.totalCount,s=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l,c;return l=function(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){ji(e,t,n[t])}))}return e}({},e),c=null!=(c={id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:W(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(c,e))})),l}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(bi,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1})};var Fi=n(501),Li={};Li.styleTagTransform=h(),Li.setAttributes=g(),Li.insert=p().bind(null,"head"),Li.domAPI=d(),Li.insertStyleElement=v(),s()(Fi.Z,Li);const Ri=Fi.Z&&Fi.Z.locals?Fi.Z.locals:void 0,Mi=function(e){var t=ca({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(nn.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onSourceChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.uuid)})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid})}})};function qi(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 Gi(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qi(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)?qi(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 Hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zi(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){Hi(e,t,n[t])}))}return e}function Yi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Qi=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=function(e){var t=Gi((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=Gi((0,i.useState)(),2),l=a[0],c=a[1];(0,i.useEffect)((function(){o({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:l})}),[l]);var s=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),u=s.items,d=s.isLoading,m=s.isError;return{items:u.results,totalCount:u.totalCount,isLoading:d,isError:m,setStockItemUuid:c}}(),c=o.items,s=o.isLoading,u=o.setStockItemUuid;(0,i.useEffect)((function(){u(t)}),[t,u]);var d=(0,i.useMemo)((function(){return[{key:"source",header:n("source","Source"),styles:{width:"50%"}},{key:"code",header:n("code","Code"),styles:{width:"50%"}},{key:"action",header:n("action","Actions"),styles:{width:"50%"}}]}),[n]),m=(0,nn.cI)({defaultValues:{},mode:"all",resolver:(0,rn.F)(ta)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(nn.RV,m,l().createElement(a.wQF,{rows:null!=c?c:[],headers:d,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:Ri.referencesTableContainer},l().createElement(a.iA_,Yi(Zi({},r()),{className:Ri.referencesTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,Yi(Zi({},n({header:e,isSortable:!1})),{style:e.styles,key:e.key}),null!==(r=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==r?r:e.header)})),l().createElement(a.xDH,{style:{width:"70%"}}))),l().createElement(a.RMI,{className:Ri.referencesTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(Ji,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(Ji,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=(0,m.getValues)(),o=e.code,a=e.references;(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})})({referenceCode:o,stockItemUuid:t,stockSourceUuid:a}).then((function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference")),(0,r.showSnackbar)({title:n("saveReferenceTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceMessage","Stock Item Reference saved successfully"),kind:"success"})}),(function(e){ae("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"));var t=oe(e);(0,r.showSnackbar)({title:n("saveStockItemReferenceErrorTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceErrorMessage","Error saving stock item reference"+t.join(",")),kind:"error"})}))},kind:"primary",renderIcon:dr.vc},n("save","Save")))};var Ji=function(e){var t,n=e.isEditing,o=e.row,i=e.key,c=(0,E.useTranslation)().t,s=(0,nn.Gc)().control;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,n?l().createElement(Mi,{row:o,name:"references",controllerName:"references",control:s,placeholder:c("filter","Filter...")}):(!n||!o.uuid.startsWith("new-item"))&&(null==o?void 0:o.stockSourceName)),l().createElement(a.pj1,null,l().createElement("div",{className:Ri.referencesTableCell},l().createElement(yn,{id:"".concat(o.uuid,"-").concat(i),name:"code",control:s,size:"md",value:null!==(t=null==o?void 0:o.referenceCode)&&void 0!==t?t:"",controllerName:"code",labelText:""}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:ue.ZN,onClick:function(e){return function(e){var t,n,a;e.preventDefault(),(t=o.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showSnackbar)({title:c("deletePackagingUnitTitle","Delete StockItem reference"),kind:"success",subtitle:c("deleteStockItemReferenceMesaage","StockItem reference deleted Successfully")})}),(function(e){var t=oe(e);(0,r.showSnackbar)({title:c("deleteStockItemReferenceTitle","Error Deleting a stockitem reference"),kind:"error",subtitle:t.join(",")})}))}(e)}}))))};function Wi(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 Vi=function(e){var t,n,r=e.isEditing,o=e.model,a=e.onSave,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(0),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Wi(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)?Wi(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.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(ya,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(ci,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(Di,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Bi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(zi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Rules"),component:l().createElement(Va,{stockItemUuid:o.uuid}),disabled:!r},{name:c("references","References"),component:l().createElement(Qi,{stockItemUuid:o.uuid,isEditing:r}),disabled:!r}];return l().createElement(qt,{onChange:m,tabs:p,selectedIndex:u})};function Ki(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var Xi=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ki(a,r,o,i,l,"next",e)}function l(e){Ki(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e,t){var n,o,a,i,l,c,s=arguments;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:n=s.length>2&&void 0!==s[2]&&s[2],u.label=1;case 1:return u.trys.push([1,3,,4]),[4,(n?_e:ve)(t)];case 2:return(null==(o=u.sent())?void 0:o.data)&&((0,r.showSnackbar)({isLowContrast:!0,title:"".concat(n?e("editStockItem","Edit Stock Item"):e("addStockItem","Add Stock Item")),kind:"success",subtitle:"".concat(n?e("stockItemEdited","Stock Item Edited Successfully"):e("stockItemAdded","Stock Item Added Successfully"))}),n||(Y(),(a=o.data).isDrug=!!a.drugUuid,$i(e,a,!0))),[3,4];case 3:return i=u.sent(),(0,r.showSnackbar)({title:n?e("errorEditingStockItem","Error editing a stock Item"):e("errorAddingStockItem","Error adding a stock Item"),kind:"error",isLowContrast:!0,subtitle:null==i||null===(c=i.responseBody)||void 0===c||null===(l=c.error)||void 0===l?void 0:l.message}),[3,4];case 4:return[2]}}))}));return function(t,n){return e.apply(this,arguments)}}(),$i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];Z(n?e("editItem","Edit {{name}}",{name:(null==t?void 0:t.drugName)||t.conceptName||""}):e("addItem","Add {{name}}",{name:(null==t?void 0:t.drugName)||t.conceptName||""}),l().createElement(Vi,{model:t,onSave:function(t){return Xi(e,t,n)},isEditing:n}))};const el=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){$i(e,Wo,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("addNewStock","Add New"))};var tl=n(1048),nl={};nl.styleTagTransform=h(),nl.setAttributes=g(),nl.insert=p().bind(null,"head"),nl.domAPI=d(),nl.insertStyleElement=v(),s()(tl.Z,nl);const rl=tl.Z&&tl.Z.locals?tl.Z.locals:void 0,ol=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:rl.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Pharmaceuticals",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Non Pharmaceuticals",value:"false",id:"is-drug-other"}))};function al(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 il(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return al(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)?al(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 ll=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){var e=(0,r.showModal)("import-bulk-stock-items",{closeModal:function(){return e()}})}),[]);return l().createElement(a.zxk,{kind:"ghost",onClick:t,iconDescription:e("import","Import")},e("import","Import"))},cl=function(e){var t,n=e.data,r=(0,E.useTranslation)().t;return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){n.isDrug=!!n.drugUuid,$i(r,n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function sl(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 ul(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dl(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){ul(e,t,n[t])}))}return e}function ml(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const pl=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(""),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return sl(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)?sl(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.")}()),c=o[0],s=o[1],u=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stockitem"))},d=function(e){(0,E.useTranslation)().t;var t=il((0,i.useState)(1),2),n=t[0],o=t[1],a=il((0,i.useState)(10),2),l=a[0],c=a[1],s=il((0,i.useState)(null),2),u=s[0],d=s[1],m=il((0,i.useState)(""),2),p=m[0],A=m[1],g=il((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:l,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=me(f),h=_.items,b=_.isLoading,y=_.isError,k=(0,r.usePagination)(h.results,l);return(0,i.useEffect)((function(){v({startIndex:n-1,v:U.Default,limit:l,q:u,totalCount:!0,isDrug:p})}),[u,n,l,p]),{items:k.results,pagination:k,totalCount:h.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:b,isError:y,isDrug:p,setDrug:function(e){o(1),A(e)},setSearchString:d}}(U.Full),m=d.isLoading,p=d.items,A=d.totalCount,g=d.currentPageSize,f=d.setPageSize,v=d.pageSizes,_=d.currentPage,h=d.setCurrentPage,b=d.isDrug,y=d.setDrug,k=d.setSearchString,C=gn((function(e){k(e)}),1e3);(0,i.useEffect)((function(){C(c)}),[c,C]);var w=(0,i.useMemo)((function(){return[{id:0,header:n("type","Type"),key:"type"},{id:1,header:n("genericName","Generic Name"),key:"genericName"},{id:2,header:n("commonName","Common Name"),key:"commonName"},{id:3,header:n("tradeName","Trade Name"),key:"tradeName"},{id:4,header:n("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:n("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:n("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[n]),S=(0,i.useMemo)((function(){return null==p?void 0:p.map((function(e,t){var r;return ml(dl({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),type:(null==e?void 0:e.drugUuid)?n("drug","Drug"):n("other","Other"),genericName:l().createElement(cl,{data:p[t]}),commonName:null==e?void 0:e.commonName,tradeName:(null==e?void 0:e.drugUuid)?null==e?void 0:e.conceptName:"",preferredVendorName:null==e?void 0:e.preferredVendorName,dispensingUoM:null==e?void 0:e.defaultStockOperationsUoMName,dispensingUnitName:null==e?void 0:e.dispensingUnitName,defaultStockOperationsUoMName:null==e?void 0:e.defaultStockOperationsUoMName,reorderLevel:(null==e?void 0:e.reorderLevelUoMName)&&(null==e?void 0:e.reorderLevel)?"".concat(null==e||null===(r=e.reorderLevel)||void 0===r?void 0:r.toLocaleString()," ").concat(null==e?void 0:e.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){e.isDrug=!!e.drugUuid,$i(n,e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(At.I8,dl({size:16},e))}}))})}))}),[p,n]);return m?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,n("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows:S,headers:w,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,d=e.getTableProps,m=e.getRowProps,p=e.getBatchActionProps;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,p()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,value:c,onChange:function(e){return t=e.target.value,void s(t);var t}}),l().createElement(ol,{filterType:b,changeFilterType:y}),l().createElement(ll,null),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(el,null))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,o.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,ml(dl({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Ct.desktopHeader:Ct.tabletHeader,key:"".concat(e.key),isSortable:"name"!==e.key}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,ml(dl({className:r.isDesktop?Ct.desktopRow:Ct.tabletRow},m({row:e})),{key:e.id}),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("div",{className:Ct.tileContent},l().createElement("p",{className:Ct.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:Ct.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:_,pageSize:g,pageSizes:v,totalItems:A,onChange:function(e){var t=e.page,n=e.pageSize;h(t),f(n)},className:Ct.paginationOverride}))};var Al=n(5104),gl={};gl.styleTagTransform=h(),gl.setAttributes=g(),gl.insert=p().bind(null,"head"),gl.domAPI=d(),gl.insertStyleElement=v(),s()(Al.Z,gl);const fl=Al.Z&&Al.Z.locals?Al.Z.locals:void 0;function vl(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 _l(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(j(e)),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return vl(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)?vl(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.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage;return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d}}var hl=n(4300),bl={};bl.styleTagTransform=h(),bl.setAttributes=g(),bl.insert=p().bind(null,"head"),bl.domAPI=d(),bl.insertStyleElement=v(),s()(hl.Z,bl);const yl=hl.Z&&hl.Z.locals?hl.Z.locals:void 0;function kl(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 Cl(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function El(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wl(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){El(e,t,n[t])}))}return e}function Sl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Dl(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||xl(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 Ol(e){return function(e){if(Array.isArray(e))return kl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xl(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 xl(e,t){if(e){if("string"==typeof e)return kl(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)?kl(e,t):void 0}}var Nl=$();const Il=function(e){var t,n,o,c,s=e.model,u=e.editMode,d=(0,E.useTranslation)().t,m=(0,r.useSession)(),p=Dl((0,i.useState)(wl({},s)),2),A=p[0],g=p[1],f=Dl((0,i.useState)([]),2),v=f[0],_=f[1],h=null==m||null===(t=m.user)||void 0===t?void 0:t.uuid,b=Tt(),y=b.types.results,k=b.isLoading,C=Ut({v:U.Default}),w=C.items,S=C.isLoading,D=Dl((0,i.useState)(null),2),O=D[0],x=D[1],N=function(e){var t="".concat(r.restBaseUrl,"/user/").concat(e),n=(0,P.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{data:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(O),I=N.data,T=It({v:U.Default}).isLoading,B=Nt().stockLocations,j=Dl((0,i.useState)([]),2),z=j[0],F=j[1],L=null!==(c=null==w?void 0:w.results)&&void 0!==c?c:[];(0,i.useEffect)((function(){(null==s?void 0:s.userUuid)&&x(s.userUuid)}),[s]);var R,M,q,G=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Cl(a,r,o,i,l,"next",e)}function l(e){Cl(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){return e.preventDefault(),function(e){var t=new AbortController,n=null!=e.uuid,o="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(n?"/"+e.uuid:"");return(0,r.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(){ae("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),(0,r.showSnackbar)({isLowContrast:!0,title:d("addUserRole","Add User role"),kind:"success",subtitle:d("successfullysaved","You have successfully saved user role scope")}),Y()}),(function(e){(0,r.showSnackbar)({title:d("errorSavingUserRoleScope","Error Saving user role scope"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message}),Y()})),[2]}))}));return function(t){return e.apply(this,arguments)}}();return k||T||S?l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:d("loadingData","Loading data...")}):l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:yl.section},l().createElement("div",null,(null==w||null===(n=w.results)||void 0===n?void 0:n.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:yl.subTitle},d("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:d("user","User"),items:z.length?z:L,onChange:function(e){var t,n,r,o=["d210eb66-2188-11ed-9dff-507b9dea1806","cca4be4b-2188-11ed-9dff-507b9dea1806","84bdd876-4694-11ed-8109-00155dcc3fc0","a49be648-6b0a-11ed-93a2-806d973f13a9","2083fd40-3391-11ed-a667-507b9dea1806"],a=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return o.includes(e.uuid)})).filter((function(e){return e.uuid!==h}));g(Sl(wl({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),_(null!=a?a:[]),x(null==e||null===(r=e.selectedItem)||void 0===r?void 0:r.uuid)},shouldFilterItem:function(){return!0},itemToString:function(e){var t,n,r;return"".concat(null!==(r=null!==(n=null==e||null===(t=e.person)||void 0===t?void 0:t.display)&&void 0!==n?n:null==e?void 0:e.display)&&void 0!==r?r:"")},onInputChange:function(e){!function(e){if(e&&""!==e.trim()){var t=L.filter((function(e){return e.uuid!==h})).filter((function(t){var n,r,o;return(null!==(o=null!==(r=null==t||null===(n=t.person)||void 0===n?void 0:n.display)&&void 0!==r?r:null==t?void 0:t.display)&&void 0!==o?o:"").toLowerCase().includes(e.toLowerCase())}));F(t)}}(e)},placeholder:"Filter...",initialSelectedItem:null!==(R=L.find((function(e){return e.uuid===(null==s?void 0:s.userUuid)})))&&void 0!==R?R:null})))),l().createElement("section",{className:yl.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:d("role","Role"),id:"select-role",value:null!==(M=A.role)&&void 0!==M?M:"placeholder-item",onChange:function(e){var t,n,r,o=null==B||null===(t=B.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return!o||0===o.length||!o.some((function(t){return t===e.locationUuid}))})))&&void 0!==r?r:[];g(Sl(wl({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:d("chooseARole","Choose a role")}),u?l().createElement(a.QlF,{key:null==A?void 0:A.role,value:null==A?void 0:A.role,text:null==A?void 0:A.role}):null===(o=null!==(q=null==I?void 0:I.roles)&&void 0!==q?q:v)||void 0===o?void 0:o.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})}))))),l().createElement("section",{className:yl.section},l().createElement(a.cOn,{className:yl.checkboxGrid},l().createElement(a.XZJ,{onChange:function(){var e=!(null==A?void 0:A.enabled);g(Sl(wl({},A),{enabled:e}))},checked:null==A?void 0:A.enabled,labelText:d("enabled","Enabled ?"),value:null==s?void 0:s.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(){var e=!(null==A?void 0:A.permanent);g(Sl(wl({},A),{permanent:e,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==s?void 0:s.permanent,labelText:d("permanent","Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:X(Nl),locale:"en",dateFormat:K,onChange:function(e){g(Sl(wl({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,labelText:d("activeFrom","Active From"),value:X(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:V,labelText:d("activeTo","Active To"),value:X(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:yl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:yl.sectionTitle}," ",d("stockOperation","Stock Operations")),l().createElement("div",{className:yl.hr}),l().createElement("span",{className:yl.subTitle},d("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:yl.section},l().createElement(a.cOn,{className:yl.checkboxGrid},(null==y?void 0:y.length)>0&&y.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:(t=e,(null==A||null===(r=A.operationTypes)||void 0===r||null===(n=r.filter((function(e){return e.operationTypeUuid===t.uuid})))||void 0===n?void 0:n.length)>0),className:yl.checkbox,onChange:function(e){return function(e){var t,n=null==A||null===(t=A.operationTypes)||void 0===t?void 0:t.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(n){var r=Ol(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==n?void 0:n.operationTypeUuid)})));g(Sl(wl({},A),{operationTypes:r}))}else{var o,a=null==y?void 0:y.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),i={operationTypeName:null==a?void 0:a.name,operationTypeUuid:null==a?void 0:a.uuid};g(Sl(wl({},A),{operationTypes:Ol(null!==(o=null==A?void 0:A.operationTypes)&&void 0!==o?o:[]).concat([i])}))}}(e)},labelText:e.name,id:e.uuid}));var t,n,r})))),l().createElement("br",null),l().createElement("section",{className:yl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:yl.sectionTitle}," ",d("locations","Locations")),l().createElement("div",{className:yl.hr}),l().createElement("span",{className:yl.subTitle},d("toggleMessage","Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:yl.section},l().createElement(a.cOn,{className:yl.checkboxGrid},(null==B?void 0:B.length)>0&&B.map((function(e){var t,n,r,o=(t=e,(r=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return e.locationUuid===t.id})))&&r.length>0?r[0]:null);return l().createElement("div",{style:{display:"flex",flexDirection:"row",margin:"4px",padding:"5px"}},l().createElement(a.XZJ,{name:"location",key:"chk-loc-child-key-".concat(e.id),id:"chk-loc-child-".concat(e.id),value:e.id,onChange:function(e){return function(e){var t,n=null==A||null===(t=A.locations)||void 0===t?void 0:t.find((function(t){var n;return t.locationUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(n){var r,o,a=Ol(null!==(o=null==A||null===(r=A.locations)||void 0===r?void 0:r.filter((function(e){return e.locationUuid!==(null==n?void 0:n.locationUuid)})))&&void 0!==o?o:[]);g(Sl(wl({},A),{locations:a}))}else{var i,l=null==B?void 0:B.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={locationName:null==l?void 0:l.name,locationUuid:null==l?void 0:l.id,enableDescendants:!1},s=Ol(null!==(i=null==A?void 0:A.locations)&&void 0!==i?i:[]).concat([c]);g(Sl(wl({},A),{locations:s}))}}(e)},className:yl.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:yl.toggle,size:"sm",onToggleClick:function(e){var t=(null==o?void 0:o.locationUuid)===e?o:null;return!0===(null==t?void 0:t.enableDescendants)}(e.id),key:"tg-loc-child-key-".concat(e.id),id:"tg-loc-child-".concat(e.id)}))}))))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Y},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:G},d("save","Save")))))},Tl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Z(e("addStockUserRoleScope","Add Stock User Role Scope"),l().createElement(Il,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("addNewUserRoleScope","Add New User Role Scope"))};function Bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ul=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Z("Edit Stock User Role",l().createElement(Il,{model:t,editMode:!0}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:r,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(At.I8,function(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){Bl(e,t,n[t])}))}return e}({size:16},e))}})};function Pl(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 jl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const zl=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pl(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)?Pl(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.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-user-scope-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/userrolescope/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){ae("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),d(!1),(0,r.showSnackbar)({isLowContrast:!0,title:c("deletingstockUserScope","Delete Stock User Scope"),kind:"success",subtitle:c("stockUserScopeDeletedSuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,r.showSnackbar)({title:c("errorDeletingUserScope","Error deleting a user scope"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteUserScope","Delete Stock User Scope"),renderIcon:function(e){return l().createElement(ue.ZN,function(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){jl(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Fl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ll(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){Fl(e,t,n[t])}))}return e}function Rl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ml=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/userrolescope"))},o=_l({v:U.Default,totalCount:!0}),c=o.items,s=o.totalItems,u=o.currentPage,d=o.pageSizes,m=o.goTo,p=o.currentPageSize,A=o.setPageSize,g=o.isLoading,f=(0,i.useMemo)((function(){return[{id:0,header:e("user","User"),key:"user"},{id:1,header:e("role","Role"),key:"role"},{id:2,header:e("location","Location(s)"),key:"locations"},{id:3,header:e("stockOperations","Stock Operations"),key:"stockOperations"},{id:4,header:e("permanent","Permanent ?"),key:"permanent"},{id:5,header:e("ActiveFrom","Active From "),key:"activeFrom"},{id:6,header:e("activeTo","Active To"),key:"activeTo"},{id:7,header:e("enabled","Enabled ?"),key:"enabled"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),v=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(n,r){var o,i,s,u,d,m,p=t.user.uuid===n.userUuid;return Rl(Ll({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),uuid:"".concat(null==n?void 0:n.uuid),user:t.user.uuid===n.userUuid?"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName):l().createElement(a.rUS,{to:(m=null==n?void 0:n.uuid,"".concat("/user-role-scopes","/").concat(m))},"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName)),roleName:null==n?void 0:n.role,locations:null==n||null===(o=n.locations)||void 0===o?void 0:o.map((function(e){var t="loc-".concat(null==n?void 0:n.uuid,"-").concat(e.locationUuid);return l().createElement("span",{key:t},null==e?void 0:e.locationName,(null==e?void 0:e.enableDescendants)?l().createElement(se.l2,{key:"".concat(t,"-").concat(r,"-0")}):l().createElement(se.Xd,{key:"".concat(t,"-").concat(r,"-1")})," ")})),stockOperations:null==n||null===(s=n.operationTypes)||void 0===s||null===(i=s.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===i?void 0:i.join(", "),permanent:(null==n?void 0:n.permanent)?e("yes","Yes"):e("no","No"),activeFrom:null!==(u=W(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=W(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("yes","Yes"):e("no","No"),actions:l().createElement("div",{style:{display:"flex"}},!p&&l().createElement(l().Fragment,null,l().createElement(Ul,{data:c[r]}),l().createElement(zl,{uuid:c[r].uuid})))})}))}),[t.user.uuid,c,e]);return g?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:fl.tableOverride},l().createElement(a.x45,null,e("panelDescription","To access stock management features, users must have assigned roles specifying location and stock operation type scopes.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:null!=v?v:[],headers:f,isSortable:!0,useZebraStyles:!0,render:function(t){var o=t.rows,i=t.headers,c=t.getHeaderProps,s=t.getTableProps,u=t.getRowProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:fl.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Tl,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Rl(Ll({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?fl.desktopHeader:fl.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ll({className:r.isDesktop?fl.desktopRow:fl.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===o.length?l().createElement("div",{className:fl.tileContainer},l().createElement(a.n9L,{className:fl.tile},l().createElement("div",{className:fl.tileContent},l().createElement("p",{className:fl.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:fl.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:p,pageSizes:d,totalItems:s,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==u&&m(n)},className:fl.paginationOverride}))};function ql(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}var Gl=n(8098),Hl={};Hl.styleTagTransform=h(),Hl.setAttributes=g(),Hl.insert=p().bind(null,"head"),Hl.domAPI=d(),Hl.insertStyleElement=v(),s()(Gl.Z,Hl);const Zl=Gl.Z&&Gl.Z.locals?Gl.Z.locals:void 0;function Yl(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 Ql(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jl(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){Ql(e,t,n[t])}))}return e}function Wl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Vl=function(e){var t,n,o,c=e.model,s=(0,E.useTranslation)().t,u=Pt((0,r.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(Jl({},c)),o=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(n,o)||function(e,t){if(e){if("string"==typeof e)return Yl(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)?Yl(e,t):void 0}}(n,o)||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.")}()),m=d[0],p=d[1],A=(0,i.useCallback)((function(e){e.preventDefault(),c&&(m.uuid=c.uuid),function(e){var t,n,o,a=null!=e.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(a?"/"+e.uuid:""),l=new AbortController;return(0,r.openmrsFetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},signal:l.signal,body:(n=la({},e),o={sourceType:null==e||null===(t=e.sourceType)||void 0===t?void 0:t.uuid},o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n)})}(m).then((function(){(0,r.showSnackbar)({isLowContrast:!0,title:s("addedSource","Add Source"),kind:"success",subtitle:s("stockSourceAddedSuccessfully","Stock Source Added Successfully"),timeoutInMs:5e3}),ae("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),Y()}),(function(e){(0,r.showSnackbar)({title:s("errorAddingSource","Error adding a source"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch()}),[m,c,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:A},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:Zl.section},l().createElement(a.oil,{id:"fullname",type:"text",labelText:s("fullName","Full Name"),size:"md",onChange:function(e){c&&(c.name=e.target.value),p(Wl(Jl({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:Zl.section},l().createElement(a.oil,{id:"acronym",type:"text",size:"md",placeholder:"e.g NMS",onChange:function(e){c&&(c.acronym=e.target.value),p(Wl(Jl({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:Zl.section},l().createElement(a.PhF,{name:"sourceType",className:"select-field",labelText:s("sourceType","Source Type"),id:"sourceType",value:(null==m?void 0:m.sourceType)?m.sourceType.uuid:"",onChange:function(e){var t=null==u?void 0:u.answers.find((function(t){return t.uuid===e.target.value}));p(Wl(Jl({},m),{sourceType:t}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseSourceType","Choose a source type")}),null==u||null===(t=u.answers)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})}))))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Y},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},Kl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Z("Add Stock Source",l().createElement(Vl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("addNewStockSource","Add New Source"))};var Xl=n(5551),$l={};$l.styleTagTransform=h(),$l.setAttributes=g(),$l.insert=p().bind(null,"head"),$l.domAPI=d(),$l.insertStyleElement=v(),s()(Xl.Z,$l);const ec=Xl.Z&&Xl.Z.locals?Xl.Z.locals:void 0;function tc(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 nc=function(e){var t,n=e.onFilterChange,o=Pt((0,r.useConfig)().stockSourceTypeUUID),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:ec.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return tc(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return tc(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)?tc(e,t):void 0}}(t)||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.")}()),initialSelectedItem:i.answers[0],itemToString:function(e){return e?e.display:"Not Set"},titleText:"Filter: ",type:"inline",size:"sm",onChange:function(e){var t=e.selectedItem;return n(null==t?void 0:t.display)}})))};var rc=n(6940),oc={};oc.styleTagTransform=h(),oc.setAttributes=g(),oc.insert=p().bind(null,"head"),oc.domAPI=d(),oc.insertStyleElement=v(),s()(rc.Z,oc);const ac=rc.Z&&rc.Z.locals?rc.Z.locals:void 0;function ic(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 lc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const cc=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ic(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)?ic(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.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/stocksource/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){d(!1),ae("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),(0,r.showSnackbar)({isLowContrast:!0,title:c("deletingSource","Delete Source"),kind:"success",subtitle:c("stockSourceDeletedSuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,r.showSnackbar)({title:c("errorDeletingSource","Error deleting a source"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteSource","Delete Source"),renderIcon:function(e){return l().createElement(ue.ZN,function(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){lc(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function sc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uc=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Z("Edit Stock Source",l().createElement(Vl,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(At.I8,function(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){sc(e,t,n[t])}))}return e}({size:16},e))}})};function dc(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 mc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pc(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){mc(e,t,n[t])}))}return e}function Ac(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const gc=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=l().useState(""),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dc(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)?dc(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.")}()),c=o[0],s=o[1],u=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/stocksource"))},d=function(e){var t=ca(e),n=t.items,o=t.isLoading,a=t.isError,l=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ql(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)?ql(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.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n.results,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,i.useMemo)((function(){return[{id:1,header:"Name",key:"name"},{id:2,header:"Acronym",key:"acronym"},{id:3,header:"Source Type",key:"sourceType"},{id:4,header:"actions",key:"actions"}]}),[]);return{items:m,totalItems:null==n?void 0:n.totalCount,currentPage:p,currentPageSize:c,paginatedItems:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:o,isError:a,setPageSize:s,tableHeaders:A}}({v:U.Default,totalCount:!0}),m=d.items,p=d.totalItems,A=d.tableHeaders,g=d.currentPage,f=d.pageSizes,v=d.goTo,_=d.currentPageSize,h=d.setPageSize,b=d.isLoading,y=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n;return Ac(pc({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:null==e?void 0:e.uuid,name:null==e?void 0:e.name,acronym:null==e?void 0:e.acronym,sourceType:null==e||null===(n=e.sourceType)||void 0===n?void 0:n.display,actions:l().createElement(l().Fragment,null,l().createElement(uc,{data:m[t]}),l().createElement(cc,{uuid:m[t].uuid}))})}))}),[m]),k=function(e){s(e)},C=(0,i.useMemo)((function(){return c?y.filter((function(e){return e.sourceType===c})):y}),[y,c]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:ac.tableOverride},l().createElement(a.x45,null,n("panelDescription","List of partners who provide stock to the facility.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:C,headers:A,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,c=e.getTableProps,s=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:ac.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(nc,{onFilterChange:k})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(Kl,null))),l().createElement(a.iA_,c(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,o.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ac(pc({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?ac.desktopHeader:ac.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,pc({className:r.isDesktop?ac.desktopRow:ac.tabletRow},s({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:ac.tileContainer},l().createElement(a.n9L,{className:ac.tile},l().createElement("div",{className:ac.tileContent},l().createElement("p",{className:ac.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:ac.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:g,pageSize:_,pageSizes:f,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==_&&h(t),n!==g&&v(n)},className:ac.paginationOverride}))};function fc(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 vc(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function _c(){return _c=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){vc(a,r,o,i,l,"next",e)}function l(e){vc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return t=e.locationPayload,[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/location/"),{method:"POST",headers:{"Content-Type":"application/json"},body:t})];case 1:return[2,n.sent()]}}))})),_c.apply(this,arguments)}var hc=n(2761),bc={};bc.styleTagTransform=h(),bc.setAttributes=g(),bc.insert=p().bind(null,"head"),bc.domAPI=d(),bc.insertStyleElement=v(),s()(hc.Z,bc);const yc=hc.Z&&hc.Z.locals?hc.Z.locals:void 0;function kc(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 Cc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ec(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){Cc(e,t,n[t])}))}return e}function wc(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kc(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)?kc(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.")}()}var Sc=on.z.object({name:on.z.string().max(255)});const Dc=function(e){var t,n,o,c,s,u,d,m=e.showModal,p=e.onModalChange,A=e.handleCreateQuestion,g=e.headerTitle,f=e.initialData,v=(0,E.useTranslation)().t,_=wc((0,i.useState)(!1),2),h=_[0],b=_[1],y=wc((0,i.useState)(""),2),k=y[0],C=y[1],w=(o="".concat(r.restBaseUrl,"/locationtag/"),c=(0,P.ZP)(o,r.openmrsFetch),s=c.data,u=c.isLoading,d=c.mutate,{locationTagList:(null==s||null===(t=s.data)||void 0===t?void 0:t.results)?null==s||null===(n=s.data)||void 0===n?void 0:n.results:[],loading:u,mutate:d}).locationTagList,S=(0,nn.cI)({mode:"all",resolver:(0,rn.F)(Sc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),D=S.handleSubmit,O=S.control,x=S.getValues,N=S.formState.isDirty;return l().createElement(a.lpG,{open:m,onClose:function(){return p(!1)},preventCloseOnClickOutside:!0,size:"md"},l().createElement(a.xBx,{title:g}),l().createElement("form",{onSubmit:D((function(e){var t,n,r,o=x(),a=null!==(r=null==o||null===(n=o.tags)||void 0===n||null===(t=n.selectedItems)||void 0===t?void 0:t.map((function(e){return e.uuid})))&&void 0!==r?r:[],i={name:o.name,tags:a};Sc.safeParse(e).success&&(b(!1),A(i))}),(function(e){C(Object.entries(e)[0][1].message),b(!0)}))},l().createElement(a.fef,{hasScrollingContent:!0},l().createElement(a.Kqy,{gap:3},l().createElement(a.cwH,{legendText:""},l().createElement(nn.Qr,{name:"name",control:O,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,Ec({id:"location",labelText:v("location","Location Name"),placeholder:v("locationPlaceholder","Add a location"),invalidText:null===(t=r.error)||void 0===t?void 0:t.message},n)))}}),l().createElement("div",{className:yc.loaderContainer},l().createElement(nn.Qr,{name:"tags",control:O,render:function(e){var t,n,r=e.field;return l().createElement(a._nR,(t=Ec({id:"tag",titleText:v("selectTags","Select tag(s)"),helperText:"This is helper text",items:null!=w?w:[]},r),n={itemToString:function(e){return e?e.display:""},selectionFeedback:"top-after-reopen"},n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}}))),h&&l().createElement(a.K0D,{lowContrast:!0,title:v("error","Error"),style:{minWidth:"100%",margin:"0rem",padding:"0rem"},role:"alert",kind:"error",subtitle:v("pleaseFillField","{{message}}",{message:k})+".",onClose:function(){return b(!1)}}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{onClick:function(){return p(!1)},kind:"secondary"},v("cancel","Cancel")),l().createElement(a.zxk,{disabled:!N,type:"submit"},l().createElement("span",null,v("save","Save"))))))},Oc=function(e){var t=e.showModal,n=e.onModalChange,o=e.mutate,a=(0,E.useTranslation)().t,c=a("addLocation","Create new Location"),s=(0,i.useCallback)((function(e){var t=e.name,i=e.tags;(function(e){return _c.apply(this,arguments)})({locationPayload:{name:t,tags:i}}).then((function(){(0,r.showSnackbar)({title:a("formCreated","Add Location"),kind:"success",isLowContrast:!0,subtitle:a("locationCreatedSuccessfully","Location {{locationName}} was created successfully.",{locationName:t})}),o(),n(!1)})).catch((function(e){var t=oe(e);(0,r.showSnackbar)({title:a("errorCreatingForm","Error creating location"),kind:"error",isLowContrast:!0,subtitle:t.join(", ")}),n(!1)})),n(!1)}),[n,o,a]);return l().createElement(l().Fragment,null,l().createElement(Dc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};function xc(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 Nc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ic=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(!1),t=2,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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xc(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)?xc(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.")}()),c=o[0],s=o[1],u=function(e){var t=Nt(),n=t.stockLocations,o=t.error,a=t.isLoading,l=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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fc(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)?fc(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.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,E.useTranslation)().t,g=(0,i.useMemo)((function(){return[{id:0,header:A("name","Name"),key:"name"},{id:1,header:A("tags","Tags"),key:"tags"},{id:2,header:A("childLocations","Child Locations"),key:"childLocations"},{id:3,header:A("actions","Actions"),key:"actions"}]}),[A]),f=(0,i.useMemo)((function(){return n.map((function(e){var t,n,r,o,a,i;return{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),name:"".concat(null==e?void 0:e.name),tags:null!==(a=null==e||null===(n=e.meta.tag)||void 0===n||null===(t=n.filter((function(e){return"SUBSETTED"!==e.code})).map((function(e){return e.code})))||void 0===t?void 0:t.join(", "))&&void 0!==a?a:"",childLocations:null!==(i=null==e||null===(o=e.childLocations)||void 0===o||null===(r=o.map((function(e){return e.display})))||void 0===r?void 0:r.join(", "))&&void 0!==i?i:""}}))}),[n]);return{items:n,currentPage:p,currentPageSize:c,paginatedQueueEntries:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:a,error:o,setPageSize:s,tableHeaders:g,tableRows:f}}(U.Full),d=u.tableHeaders,m=u.tableRows,p=u.items,A=u.isLoading,g=function(){ae("".concat(r.restBaseUrl,"/Location?_summary=data"))};return A?l().createElement(a.gqd,{role:"progressbar"}):(null==p?void 0:p.length)?l().createElement(bi,{columns:d,data:m},(function(e){var t=e.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:t}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:g},"Refresh")),c?l().createElement(Oc,{onModalChange:s,showModal:c,mutate:P.JG}):null,l().createElement(a.zxk,{kind:"ghost",renderIcon:function(e){return l().createElement(se.mm,function(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){Nc(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:Ct.tileContainer},l().createElement(a.n9L,{className:Ct.tile},l().createElement("p",{className:Ct.content},n("noStockItemsToDisplay","No stock items to display"))))};var Tc=n(557),Bc={};Bc.styleTagTransform=h(),Bc.setAttributes=g(),Bc.insert=p().bind(null,"head"),Bc.domAPI=d(),Bc.insertStyleElement=v(),s()(Tc.Z,Bc);const Uc=Tc.Z&&Tc.Z.locals?Tc.Z.locals:void 0;function Pc(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}var jc,zc=on.z.object({startDate:on.z.coerce.date().optional(),endDate:on.z.coerce.date().optional(),location:on.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:on.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:on.z.string().optional(),mostLeastMoving:on.z.string().optional(),mostLeastMovingName:on.z.string().optional(),stockItemUuid:on.z.string().optional(),stockItemName:on.z.string().optional(),patientUuid:on.z.string().optional(),patientName:on.z.string().optional(),locationUuid:on.z.string().optional(),childLocations:on.z.boolean().optional(),stockSourceUuid:on.z.string().optional(),stockSource:on.z.string().optional(),stockSourceDestinationUuid:on.z.string().optional(),stockSourceDestination:on.z.string().optional(),inventoryGroupBy:on.z.string().optional(),stockItemCategory:on.z.string().optional(),inventoryGroupByName:on.z.string().optional(),stockItemCategoryConceptUuid:on.z.string().optional(),reportSystemName:on.z.string().optional(),maxReorderLevelRatio:on.z.number().optional(),fullFillment:on.z.string().array().optional(),limit:on.z.string().optional(),date:on.z.coerce.date().optional()}).superRefine((function(e,t){"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName&&(e.startDate||t.addIssue({code:on.z.ZodIssueCode.custom,message:"Start Date is required ",path:["startDate"]}),e.endDate||t.addIssue({code:on.z.ZodIssueCode.custom,message:"End Date is required",path:["endDate"]})),"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName||(e.date||t.addIssue({code:on.z.ZodIssueCode.custom,message:"Date is required ",path:["date"]}),e.inventoryGroupBy||t.addIssue({code:on.z.ZodIssueCode.custom,message:"Inventory by is required ",path:["inventoryGroupBy"]}))}));function Fc(e){var t="".concat(r.restBaseUrl,"/stockmanagement/batchjob"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Date="Date",e.StartDate="StartDate",e.EndDate="EndDate",e.StockItemCategory="StockItemCategory",e.Location="Location",e.ChildLocations="ChildLocations",e.StockSource="StockSource",e.StockSourceDestination="StockSourceDestination",e.InventoryGroupBy="InventoryGroupBy",e.MaxReorderLevelRatio="MaxReorderLevelRatio",e.Patient="Patient",e.StockItem="StockItem",e.Limit="Limit",e.MostLeastMoving="MostLeastMoving",e.Fullfillment="Fullfillment"}(jc||(jc={}));var Lc=function(e){return Rc(e)?4:e?20:null},Rc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Mc="Completed";function qc(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 Gc(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Hc(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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Yc(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 Zc(e){return function(e){if(Array.isArray(e))return qc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Yc(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 Yc(e,t){if(e){if("string"==typeof e)return qc(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)?qc(e,t):void 0}}const Qc=function(e){var t,n,o,c,s,u=e.model,d=(0,E.useTranslation)().t,m=(0,r.useConfig)().stockItemCategoryUUID,p=function(){var e,t,n="".concat(r.restBaseUrl,"/stockmanagement/report?v=default"),o=(0,P.ZP)(n,r.openmrsFetch),a=o.data,i=o.error,l=o.isLoading;return{reportTypes:null!==(t=null==a||null===(e=a.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[],isLoading:l,isError:i}}(),A=p.reportTypes,g=p.isLoading,f=Nt().stockLocations,v=Pt(m),_=v.items,h=(v.isLoading,Hc((0,i.useState)(!1),2)),b=h[0],y=h[1],k=Hc((0,i.useState)(!1),2),C=k[0],w=k[1],S=Hc((0,i.useState)(!1),2),D=S[0],O=S[1],x=Hc((0,i.useState)(!1),2),N=x[0],I=x[1],T=Hc((0,i.useState)(!1),2),B=T[0],U=T[1],j=Hc((0,i.useState)(!1),2),z=j[0],F=j[1],L=Hc((0,i.useState)(!1),2),R=L[0],M=L[1],q=Hc((0,i.useState)(!1),2),G=q[0],H=q[1],Z=Hc((0,i.useState)(!1),2),Q=Z[0],J=Z[1],ee=Hc((0,i.useState)(!1),2),te=ee[0],ne=ee[1],re=Hc((0,i.useState)(!1),2),oe=re[0],ae=re[1],ie=Hc((0,i.useState)(!1),2),le=ie[0],ce=ie[1],se=Hc((0,i.useState)(!1),2),ue=se[0],de=se[1],me=Hc((0,i.useState)(!1),2),pe=me[0],Ae=me[1],ge=Hc((0,i.useState)(!1),2),fe=ge[0],ve=ge[1],_e=Hc((0,i.useState)(""),2),he=_e[0],be=_e[1];(0,i.useEffect)((function(){var e=!1;if(he){var t,n,r,o,a,i,l,c,s,u,d,m,p,g,f,v=null==A?void 0:A.find((function(e){return e.name===he}));v&&(y(null===(t=v.parameters)||void 0===t?void 0:t.some((function(e){return e===jc.Date}))),w(null===(n=v.parameters)||void 0===n?void 0:n.some((function(e){return e===jc.StartDate}))),O(null===(r=v.parameters)||void 0===r?void 0:r.some((function(e){return e===jc.EndDate}))),I(null===(o=v.parameters)||void 0===o?void 0:o.some((function(e){return e===jc.StockItemCategory}))),U(null===(a=v.parameters)||void 0===a?void 0:a.some((function(e){return e===jc.Location}))),F(null===(i=v.parameters)||void 0===i?void 0:i.some((function(e){return e===jc.ChildLocations}))),M(null===(l=v.parameters)||void 0===l?void 0:l.some((function(e){return e===jc.StockSource}))),H(null===(c=v.parameters)||void 0===c?void 0:c.some((function(e){return e===jc.StockSourceDestination}))),J(null===(s=v.parameters)||void 0===s?void 0:s.some((function(e){return e===jc.InventoryGroupBy}))),ne(null===(u=v.parameters)||void 0===u?void 0:u.some((function(e){return e===jc.MaxReorderLevelRatio}))),ce(null===(d=v.parameters)||void 0===d?void 0:d.some((function(e){return e===jc.StockItem}))),ae(null===(m=v.parameters)||void 0===m?void 0:m.some((function(e){return e===jc.Patient}))),de(null===(p=v.parameters)||void 0===p?void 0:p.some((function(e){return e===jc.Limit}))),Ae(null===(g=v.parameters)||void 0===g?void 0:g.some((function(e){return e===jc.MostLeastMoving}))),ve(null===(f=v.parameters)||void 0===f?void 0:f.some((function(e){return e===jc.Fullfillment}))),e=!0)}e||(y(!1),w(!1),O(!1),I(!1),U(!1),F(!1),M(!1),H(!1),J(!1),ne(!1),ce(!1),ae(!1),de(!1),Ae(!1),ve(!1))}),[he,A]);var ye=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Zc(null!==(t=_&&(null==_||null===(e=_.answers)||void 0===e?void 0:e.length)>0?null==_?void 0:_.answers:null==_?void 0:_.setMembers)&&void 0!==t?t:[]))}),[_]),ke=(0,nn.cI)({mode:"all",resolver:(0,rn.F)(zc)}),Ce=ke.handleSubmit,Ee=ke.control,we=ke.formState,Se=we.errors,De=(we.defaultValues,we.isDirty,ke.setValue);if(g)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Oe=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Gc(a,r,o,i,l,"next",e)}function l(e){Gc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o,a,i,l,c,s,u,m,p,g,f,v,_,h,y,k,E,w,S,O,x,I,T,U,P,j,F,L,M,q,H,Z,J,V,K,X;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function($){switch($.label){case 0:n=null===(t=A.find((function(t){return t.name===e.reportName})))||void 0===t?void 0:t.systemName,$.label=1;case 1:return $.trys.push([1,,3,4]),o="\r\n",a="param.report=".concat(n).concat(o),fe&&(a+=xe(jc.Fullfillment,(null!==(i=e.fullFillment)&&void 0!==i?i:["All"]).join(","),(null!==(l=e.fullFillment)&&void 0!==l?l:["All"]).join(", "),d("editFullfillmentReport","stockmanagement.report.edit.fullfillment"),o)),oe&&(a+=xe(jc.Patient,null!==(s=e.patientUuid)&&void 0!==s?s:"",null!==(u=null===(c=e.patientName)||void 0===c?void 0:c.trim())&&void 0!==u?u:"All Patients",d("patients","Patients"),o)),le&&(a+=xe(jc.StockItem,null!==(p=e.stockItemUuid)&&void 0!==p?p:"",null!==(g=null===(m=e.stockItemName)||void 0===m?void 0:m.trim())&&void 0!==g?g:"All Stock Items",d("stockItem","Stock Item"),o)),N&&(a+=xe(jc.StockItemCategory,null!==(v=e.stockItemCategoryConceptUuid)&&void 0!==v?v:"",null!==(_=null===(f=e.stockItemCategory)||void 0===f?void 0:f.trim())&&void 0!==_?_:"All Categories",d("stockItemCategory","Stock Item Category"),o)),Q&&(a+=xe(jc.InventoryGroupBy,null!==(y=e.inventoryGroupBy)&&void 0!==y?y:"LocationStockItemBatchNo",null!==(k=null===(h=e.inventoryGroupByName)||void 0===h?void 0:h.trim())&&void 0!==k?k:"Stock Item Batch Number",d("displayInventoryReport","stockmanagement.report.edit.inventorygroupby"),o)),B&&(a+=xe(jc.Location,e.location,null!==(w=null===(E=e.location)||void 0===E?void 0:E.trim())&&void 0!==w?w:"",d("location","Location"),o),z&&(a+=xe(jc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",d("includeChildLocations","Include Child Locations"),o))),te&&(a+=xe(jc.MaxReorderLevelRatio,(null!==(S=e.maxReorderLevelRatio)&&void 0!==S?S:0).toString(),(null!==(O=e.maxReorderLevelRatio)&&void 0!==O?O:0).toString()+"%",d("displayMaxReorderReport","stockmanagement.report.edit.maxreorderlevelratio"),o)),R&&(a+=xe(jc.StockSource,null!==(I=e.stockSourceUuid)&&void 0!==I?I:"",null!==(T=null===(x=e.stockSource)||void 0===x?void 0:x.trim())&&void 0!==T?T:"All Sources",d("displayStockReport","stockmanagement.report.edit.stocksource"),o)),G&&(a+=xe(jc.StockSourceDestination,null!==(P=e.stockSourceDestinationUuid)&&void 0!==P?P:"",null!==(j=null===(U=e.stockSourceDestination)||void 0===U?void 0:U.trim())&&void 0!==j?j:"All Destinations",d("displayStockDestinationReport","stockmanagement.report.edit.stocksourcedestination"),o)),pe&&(a+=xe(jc.MostLeastMoving,null!==(L=e.mostLeastMoving)&&void 0!==L?L:"MostMoving",null!==(M=null===(F=e.mostLeastMovingName)||void 0===F?void 0:F.trim())&&void 0!==M?M:"Most Moving",d("displayMostLeastMovingReport","stockmanagement.report.edit.mostleastmoving"),o)),ue&&(a+=xe(jc.Limit,(null!==(H=null!==(q=e.limit)&&void 0!==q?q:Lc(e.reportSystemName))&&void 0!==H?H:20).toString(),(null!==(J=null!==(Z=e.limit)&&void 0!==Z?Z:Lc(e.reportSystemName))&&void 0!==J?J:20).toString(),d(function(e){return Rc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),o)),b&&(a+=xe(jc.Date,e.date?JSON.stringify(e.date).replaceAll('"',""):"",null!==(V=W(e.date))&&void 0!==V?V:"",d("displayReportDate","stockmanagement.report.edit.date"),o)),C&&(a+=xe(jc.StartDate,e.startDate?JSON.stringify(e.startDate).replaceAll('"',""):"",null!==(K=W(e.startDate))&&void 0!==K?K:"",d(function(e){return Rc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),o)),D&&(a+=xe(jc.EndDate,e.endDate?JSON.stringify(e.endDate).replaceAll('"',""):"",null!==(X=W(e.endDate))&&void 0!==X?X:"",d(function(e){return Rc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),o)),[4,Fc({batchJobType:"Report",description:e.reportName,parameters:a}).then((function(e){Y(),201===e.status?(0,r.showSnackbar)({title:d("batchJob","Batch Job"),subtitle:d("BatchJobSuccess","Batch job created successfully"),kind:"success"}):(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})})).catch((function(){(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})}))];case 2:return $.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),xe=function(e,t,n,r,o){return"param.".concat(e,".value=").concat(t).concat(o,"param.").concat(e,".value.desc=").concat(n).concat(o,"param.").concat(e,".description=").concat(r).concat(o)};return l().createElement(a.l09,{onSubmit:Ce(Oe,(function(e){console.error(e)}))},l().createElement("div",{className:Uc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,d("reportName","Report")),l().createElement(nn.Qr,{control:Ee,name:"reportName",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"report",size:"md",labelText:d("reportName","Report"),items:A,itemToString:function(e){var t,n;return"".concat(null!==(n=null!==(t=null==e?void 0:e.name)&&void 0!==t?t:null==e?void 0:e.name)&&void 0!==n?n:"")},placeholder:"Filter...",onChange:function(e){var n,r=e.selectedItem;t(r.name),n=r.name,be(n)}})}})),N&&l().createElement(l().Fragment,null,l().createElement("span",null,d("stockItemCategory","Stock Item Category")),l().createElement(nn.Qr,{control:Ee,name:"stockReportItemCategory",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"stockReportItem",size:"md",labelText:d("stockItemCategory","Stock Item Category"),items:ye,onChange:function(e){var n=e.selectedItem;t(n.uuid)},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},placeholder:"Filter..."})}})),C&&l().createElement(nn.Qr,{control:Ee,name:"startDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:o,value:i},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:V,labelText:d("startDate","Start Date"),defaultValue:"",invalid:null==Se||null===(t=Se.startDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.startDate)||void 0===n?void 0:n.message}))}}),D&&l().createElement(nn.Qr,{control:Ee,name:"endDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:o,value:i},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:V,labelText:d("endDate","End Date"),defaultValue:"",invalid:null==Se||null===(t=Se.endDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.endDate)||void 0===n?void 0:n.message}))}}),Q&&l().createElement(a.PhF,{id:"inventoryGroupBy",defaultValue:null==u?void 0:u.inventoryGroupBy,invalid:null==Se||null===(t=Se.inventoryGroupBy)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.inventoryGroupBy)||void 0===n?void 0:n.message,labelText:d("inventoryBy","Inventory by"),onChange:function(e){return De("inventoryGroupBy",e.target.value)}},l().createElement(a.QlF,{value:"",text:d("SelectOption","Select an option")}),l().createElement(a.QlF,{value:"StockItemOnly",text:d("stockItem","Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItem",text:d("locationAndStockItem","Location and Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItemBatchNo",text:d("locationAndBatchno","Location and Batch")})),B&&l().createElement(a.PhF,{name:"location",className:"select-field",labelText:d("location","Location"),id:"location",onChange:function(e){return De("location",e.target.value)},defaultValue:"",invalid:null==Se||null===(o=Se.location)||void 0===o?void 0:o.message,invalidText:null==Se||null===(c=Se.location)||void 0===c?void 0:c.message},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:d("chooseALocation","Choose a location")}),null===(s=null!=f?f:[])||void 0===s?void 0:s.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})}))),z&&l().createElement(nn.Qr,{control:Ee,name:"childLocations",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.XZJ,{id:"childLocations",onChange:n,value:r,labelText:d("includeChildLocations","Include Child Locations")})}}),pe&&l().createElement(nn.Qr,{control:Ee,name:"mostLeastMoving",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.SYO,{name:"mostLeastMoving",legendText:d("rank","Rank"),onChange:n,value:r},l().createElement(a.EUY,{value:"MostMoving",id:"mostLeastMovingMost",labelText:d("mostMoving","Most Moving")}),l().createElement(a.EUY,{value:"LeastMoving",id:"mostLeastMovingLeast",labelText:d("leastMoving","Least Moving")}))}}),ue&&l().createElement(nn.Qr,{control:Ee,name:"limit",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.Y2U,{id:"limitTop",allowEmpty:!0,value:r,onchange:n,label:d("limit","Limit"),defaultValue:20})}}),fe&&l().createElement("div",{style:{display:"flex",flexDirection:"row",gap:"0 1rem"}},l().createElement(nn.Qr,{control:Ee,name:"fullFillment",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(l().Fragment,null,l().createElement(a.XZJ,{id:"allFulfillment",checked:null==r?void 0:r.includes("All"),onChange:function(e){var t=e.target.checked;n(t?["All"]:r.filter((function(e){return"All"!==e})))},labelText:d("all","All")}),l().createElement(a.XZJ,{id:"fullFulfillment",checked:null==r?void 0:r.includes("Full"),onChange:function(e){var t=e.target.checked;n(t?Zc(r.filter((function(e){return"All"!==e}))).concat(["Full"]):r.filter((function(e){return"Full"!==e})))},labelText:d("fullFulfillment","Full Fulfillment")}),l().createElement(a.XZJ,{id:"partialFulfillment",checked:null==r?void 0:r.includes("Partial"),onChange:function(e){var t=e.target.checked;n(t?Zc(r.filter((function(e){return"All"!==e}))).concat(["Partial"]):r.filter((function(e){return"Partial"!==e})))},labelText:d("partialFulfillment","Partial Fulfillment")}),l().createElement(a.XZJ,{id:"noneFulfillment",checked:null==r?void 0:r.includes("None"),onChange:function(e){var t=e.target.checked;n(t?Zc(r.filter((function(e){return"All"!==e}))).concat(["None"]):r.filter((function(e){return"None"!==e})))},labelText:d("noneFulfillment","Non Fulfillment")}))}})),b&&l().createElement(nn.Qr,{control:Ee,name:"date",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:X($()),locale:"en",dateFormat:K,onChange:o,value:i},l().createElement(a.aj6,{id:"date",name:"date",placeholder:V,labelText:d("date","Date"),defaultValue:"",invalid:null==Se||null===(t=Se.date)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.date)||void 0===n?void 0:n.message}))}})),l().createElement("div",{className:Uc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Y},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},d("continue","Continue"))))},Jc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Z("New Report",l().createElement(Qc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var Wc=n(5861),Vc={};Vc.styleTagTransform=h(),Vc.setAttributes=g(),Vc.insert=p().bind(null,"head"),Vc.domAPI=d(),Vc.insertStyleElement=v(),s()(Wc.Z,Vc);const Kc=Wc.Z&&Wc.Z.locals?Wc.Z.locals:void 0;var Xc=n(6811),$c=n(3570),es=n(7149),ts={};ts.styleTagTransform=h(),ts.setAttributes=g(),ts.insert=p().bind(null,"head"),ts.domAPI=d(),ts.insertStyleElement=v(),s()(es.Z,ts);const ns=es.Z&&es.Z.locals?es.Z.locals:void 0;var rs=function(e){var t=e.title,n=e.description,r=(0,E.useTranslation)().t;return l().createElement("div",{className:ns.tileContainer},l().createElement(a.n9L,{className:ns.tile},l().createElement("div",{className:ns.tileContent},l().createElement(At.As,{size:"24"}),l().createElement("p",{className:ns.content},r("noPrivilagesTitle","".concat(t))),n&&l().createElement("p",{className:ns.helper},r("noViewPrivilegesDescription","Description: {{description}}",{description:n})))))};function os(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function as(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){os(e,t,n[t])}))}return e}function is(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}var ls=n(2033),cs={};cs.styleTagTransform=h(),cs.setAttributes=g(),cs.insert=p().bind(null,"head"),cs.domAPI=d(),cs.insertStyleElement=v(),s()(ls.Z,cs);const ss=ls.Z&&ls.Z.locals?ls.Z.locals:void 0;var us="@openmrs/esm-stock-management-app",ds={featureName:"stock-management",moduleName:us},ms=n(3979),ps=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=e("manageStock","Manage Stock");return l().createElement(a.mh4,null,l().createElement(a.Ohc,{href:window.getOpenmrsSpaBase()+"stock-management",rel:"noopener noreferrer"},l().createElement("div",null,l().createElement("div",{className:"heading"},t),l().createElement("div",{className:"content"},e("stockManagement","Stock Management"))),l().createElement("div",{className:"iconWrapper"},l().createElement(se.ol,{size:16}))))}),ds),As=(0,r.getSyncLifecycle)((function(){return l().createElement(r.LeftNavMenu,null)}),ds),gs=(0,r.getSyncLifecycle)((function(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(at,null),l().createElement(ft,null))}),ds),fs=(0,r.getSyncLifecycle)(_t({title:"Overview",name:"stock-management"}),ds),vs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Jo,null))}),ds),_s=(0,r.getSyncLifecycle)(_t({title:"Operations",name:"operations"}),ds),hs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(pl,null))}),ds),bs=(0,r.getSyncLifecycle)(_t({title:"Items",name:"items"}),ds),ys=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ml,null))}),ds),ks=(0,r.getSyncLifecycle)(_t({title:"User role scopes",name:"user-scopes"}),ds),Cs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(gc,null))}),ds),Es=(0,r.getSyncLifecycle)(_t({title:"Sources",name:"sources"}),ds),ws=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ic,null))}),ds),Ss=(0,r.getSyncLifecycle)(_t({title:"Locations",name:"locations"}),ds),Ds=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=function(){ae("".concat(r.restBaseUrl,"/stockmanagement/report?v=default"))},n=function(){var e,t,n,o,a,l,c,s="".concat(r.restBaseUrl,"/stockmanagement/batchjob?batchJobType=Report&v=default&limit=10&totalCount=true"),u=(0,P.ZP)(s,r.openmrsFetch),d=u.data,m=u.error,p=u.isLoading,A=(l=(0,i.useState)(10),c=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(l,c)||function(e,t){if(e){if("string"==typeof e)return Pc(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)?Pc(e,t):void 0}}(l,c)||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.")}()),g=A[0],f=A[1],v=(0,r.usePagination)(null==d||null===(e=d.data)||void 0===e?void 0:e.results,g),_=v.goTo,h=v.results,b=v.currentPage;return{reports:null!==(a=null==d||null===(t=d.data)||void 0===t?void 0:t.results)&&void 0!==a?a:[],isLoading:p,isError:m,items:h,totalItems:null==d||null===(o=d.data)||void 0===o||null===(n=o.results)||void 0===n?void 0:n.length,currentPage:b,currentPageSize:g,paginatedItems:h,goTo:_,pageSizes:[10,20,30,40,50],setPageSize:f}}(),o=n.reports,c=n.isLoading,s=n.currentPage,u=n.pageSizes,d=n.totalItems,m=n.goTo,p=n.currentPageSize,A=n.setPageSize,g=(0,r.useSession)().user,f=g.privileges.filter((function(e){return"App: stockmanagement.reports"===e.display})).length>0,v=g.privileges.filter((function(e){return"Task: stockmanagement.reports.mutate"===e.display})).length>0,_=(0,i.useMemo)((function(){return[{id:0,header:e("report","Report"),key:"report"},{id:1,header:e("parameters","Parameters"),key:"parameters"},{id:2,header:e("dateRequested","Date Requested"),key:"dateRequested"},{id:3,header:e("requestedBy","Requested By"),key:"requestedBy"},{id:4,header:e("status","Status"),key:"status"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),h=(0,i.useCallback)((function(e,t){e&&window.open(function(e,t){return"".concat(ne,"ws/rest/v1/stockmanagement/batchjobartifact?id=").concat(e).concat("&download=1")}(e),"_blank")}),[]),b=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e){var t,n,r;return is(as({},e),{checkbox:"isBatchJobActive",id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),batchJobType:e.batchJobType,dateRequested:(r=e.dateCreated,r?J()(r).format("DD-MMM-YYYY HH:mm"):""),parameters:"",report:e.description,requestedBy:null==e||null===(t=e.owners)||void 0===t?void 0:t.map((function(t,n){return l().createElement("div",{key:"".concat(e.uuid,"-owner-").concat(n)},"".concat(t.ownerFamilyName," ").concat(t.ownerGivenName))})),status:l().createElement(l().Fragment,null,"Pending"===e.status&&l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Generating report..."}),"Failed"===e.status&&l().createElement(st.Od,{className:"report-failed",title:e.status}),"Cancelled"===e.status&&l().createElement(Xc.mg,{className:"report-cancelled",title:e.status}),e.status===Mc&&l().createElement(wr.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement($c.tK,{className:"report-expired",title:e.status})),actions:l().createElement("div",{key:"".concat(null==e?void 0:e.uuid,"-actions"),style:{display:"inline-block",whiteSpace:"nowrap"}},e.outputArtifactViewable&&"hide"===e.batchJobType&&l().createElement(a.zxk,{key:"".concat(null==e?void 0:e.uuid,"-actions-view"),type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Edit",kind:"ghost",renderIcon:ue.G7}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Copy",kind:"ghost",renderIcon:Fe.CK}),(null==e?void 0:e.status)===Mc&&(null!==(n=e.outputArtifactSize)&&void 0!==n?n:0)>0&&l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Download",kind:"ghost",renderIcon:At.UW,onClick:function(){return h(e.uuid,e.outputArtifactFileExt)}}))})}))}),[o,h]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Kc.tableOverride},l().createElement(a.x45,null,e("ReportDescription","List of reports requested by users")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:b,headers:_,isSortable:!0,useZebraStyles:!0,render:function(n){var o=n.rows,i=n.headers,c=n.getHeaderProps,s=n.getTableProps,u=n.getRowProps,d=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Kc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:t},"Refresh")),v&&l().createElement(Jc,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,is(as({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Kc.desktopHeader:Kc.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,as({className:r.isDesktop?Kc.desktopRow:Kc.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),f?0===o.length?l().createElement("div",{className:Kc.tileContainer},l().createElement(a.n9L,{className:Kc.tile},l().createElement("div",{className:Kc.tileContent},l().createElement("p",{className:Kc.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:Kc.helper},e("checkFilters","Check the filters above"))))):null:l().createElement(rs,{title:"Can not view stock reports",description:"You have no permissions to view reports"}))}}),l().createElement(a.tlE,{page:s,pageSize:p,pageSizes:u,totalItems:d,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==s&&m(n)},className:Kc.paginationOverride}))}),ds),Os=(0,r.getSyncLifecycle)(_t({title:"Reports",name:"reports"}),ds),xs=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t;return l().createElement("div",{className:ss.StockSettings},l().createElement("div",{className:ss.title},e("comingSoonUnderDev","Exciting updates are on the way! In the meantime, use the link below to access Admin UI settings.")),l().createElement(a.zxk,{onClick:function(){return(0,r.navigate)({to:"${openmrsBase}/admin/maintenance/settings.list?show=Stockmanagement"})},size:"md",renderIcon:function(){return l().createElement(ue.PG,{className:"cds--btn__icon",size:24})},kind:"ghost"},e("adminSettings","Admin settings")))}),ds),Ns=(0,r.getSyncLifecycle)(_t({title:"Settings",name:"settings"}),ds),Is=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),ds),Ts=(0,r.getSyncLifecycle)((function(){var e="".concat(window.spaBase,"/stock-management");return(0,i.useEffect)((function(){return(0,r.setLeftNav)({name:"stock-page-dashboard-slot",basePath:e}),function(){return(0,r.unsetLeftNav)("stock-page-dashboard-slot")}}),[e]),l().createElement("main",{className:"omrs-main-content"},l().createElement(Se.BrowserRouter,{basename:window.spaBase},l().createElement(Se.Routes,null,l().createElement(Se.Route,{path:"/stock-management",element:l().createElement(Ge,null)}),l().createElement(Se.Route,{path:"/stock-management/:dashboard/*",element:l().createElement(Ge,null)}))))}),ds),Bs=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.title,c=e.requireReason,s=e.operation,u=e.closeModal,d=o.toLocaleLowerCase().trim(),m=(0,E.useTranslation)().t,p=ce((0,i.useState)(""),2),A=p[0],g=p[1],f=ce((0,i.useState)(!1),2),v=f[0],_=f[1],h=(t=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(e.preventDefault(),_(!0),t=null,d){case"submit":t="SUBMIT";break;case"dispatch":case"dispatchapproval":t="DISPATCH";break;case"complete":case"completedispatch":t="COMPLETE";break;case"cancel":t="CANCEL";break;case"reject":t="REJECT";break;case"return":t="RETURN";break;case"approve":t="APPROVE"}return t?(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperationaction"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}({name:t,uuid:null==s?void 0:s.uuid,reason:A}).then((function(){_(!1),(0,r.showSnackbar)({title:m("title","".concat(o," Operation")),subtitle:m("successMessage","You have successfully ".concat(o," operation ")),kind:"success"}),u(),Y(),ae("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))}),(function(e){_(!1);var t=oe(e);(0,r.showSnackbar)({title:m("errorDescriptionTitle","Error on saving form"),subtitle:m("errorDescription",t.join(", ")),kind:"error"}),u(),Y()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){le(a,r,o,i,l,"next",e)}function l(e){le(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)});return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:B.modalBody},l().createElement("section",{className:B.section},l().createElement("h5",{className:B.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:B.section},l().createElement(a.Kx8,{labelText:m("notes","Please explain the reason:"),id:"nextNotes",name:"nextNotes",invalidText:"Required",maxCount:500,enableCounter:!0,onChange:function(e){return g(e.target.value)}})))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:u},m("cancel","Cancel")),v?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),ds),Us=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},o("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this source? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-modal",moduleName:us}),Ps=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},r("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},r("deleteConfirmationText","Are you sure you want to delete this User Scope? This action can't be undone."))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},r("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},r("delete","Delete"))))}),{featureName:"delete-stock-user-scope-modal",moduleName:us}),js=(0,r.getSyncLifecycle)((function(e){var t=e.row,n=e.closeModal,o=(0,E.useTranslation)().t,c=ye(),s=c.mutate,u=c.setStockItemUuid;(0,i.useEffect)((function(){u(t.stockItemUuid)}),[t.stockItemUuid,u]);var d,m,p=(d=(0,i.useState)(""),m=2,function(e){if(Array.isArray(e))return e}(d)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(d,m)||function(e,t){if(e){if("string"==typeof e)return we(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)?we(e,t):void 0}}(d,m)||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.")}()),A=p[0],g=p[1];return l().createElement("div",null,l().createElement(a.xBx,{closeModal:n,className:Ee.productiveHeading03},o("removePackagingUnit","Remove Packaging Unit"),"?"),l().createElement(a.fef,null,l().createElement("span",null,o("removePackagingUnitConfirmation","Would you really like to remove the packaging unit ${row?.packagingUomName} from the stock item?")),l().createElement(a.Kx8,{id:"reason",labelText:o("reasonLabel","Please explain the reason:"),onChange:function(e){g(e.target.value)},maxLength:500,placeholder:o("reasonPlaceholder","Enter reason here")})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:n},o("no","No")),l().createElement(a.zxk,{kind:"danger",type:"submit",onClick:function(e){var a,i,l;e.preventDefault(),(a=t.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(a),l=new AbortController,(0,r.openmrsFetch)(i,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:l.signal})).then((function(){s(),n(),(0,r.showSnackbar)({isLowContrast:!0,title:o("deletePackagingUnitTitle","Delete packing item"),kind:"success",subtitle:o("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showSnackbar)({title:o("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})}))},disabled:A.length<1},o("yes","Yes"))))}),{featureName:"delete-packaging-unit-modal",moduleName:us}),zs=(0,r.getSyncLifecycle)(de,{featureName:"delete-packging-unit-button",moduleName:us}),Fs=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.closeModal,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(),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,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return D(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)?D(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.")}()),u=s[0],d=s[1];return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:o,title:c("importStockItems","Import Stock Items")}),l().createElement(a.fef,null,l().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"small",onChange:function(e){var t,n,r=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];r?d(r):e.preventDefault()}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:o},c("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(u){var e=new FormData;u&&(e.append("file",u,"Import_Stock_Items.csv"),e.append("hasHeader","true")),function(e){return S.apply(this,arguments)}(e).then((function(){(0,r.showSnackbar)({isLowContrast:!0,title:c("rejectOrder","Uploaded Order"),kind:"success",subtitle:c("SuccessfullyUploadedStockItem","You have successfully uploaded stock items")}),o()}),(function(e){(0,r.showSnackbar)({title:c("errorUploadingItems","An error occurred uploading stock items"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})}))}}},c("uploadStockItems","Upload StockItems")))))}),ds),Ls=(0,r.getSyncLifecycle)((function(){var e=window.getOpenmrsSpaBase();return l().createElement(a.Ohc,{className:k.customTile,id:"menu-item",href:"".concat(e,"stock-management")},l().createElement("div",{className:"customTileTitle"},l().createElement(C.yG,{size:24})),l().createElement("div",null,"Stock Management"))}),ds);function Rs(){(0,r.defineConfigSchema)(us,o)}},3979:(e,t,n)=>{var r={"./am.json":[8788,788],"./ar.json":[4460,460],"./en.json":[3574,574],"./es.json":[8319,319],"./fr.json":[2757,757],"./he.json":[5833,833],"./km.json":[7807,807],"./zh.json":[8271,271]};function o(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],o=t[0];return n.e(t[1]).then((()=>n(o)))}o.keys=()=>Object.keys(r),o.id=3979,e.exports=o}}]);
|