@openmrs/esm-stock-management-app 1.0.1-pre.435 → 1.0.1-pre.438
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/699.js +1 -1
- package/dist/699.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +6 -6
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/components/carbon/controlled-number-input/controlled-number-input.component.tsx +1 -0
- package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +14 -5
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +5 -16
- package/src/stock-items/add-stock-item/packaging-units/packaging-units.resource.tsx +2 -1
- package/src/stock-items/add-stock-item/stock-item-units-edit/stock-item-units-edit.component.tsx +5 -2
- package/src/stock-items/stock-items.resource.ts +2 -1
package/dist/699.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[699],{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;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,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,wBD5BM,CC6BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCaS,CDRX,oEDLA,wBAAA,CACA,gCAAA,CCQA,oHACE,UD/CI,CCmDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDtDM,CCuDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEiyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF/xBF,cAAA,CACA,aDhEM,CCmER,qDACE,qBDjEc,CCkEd,aDrEM,CCsEN,YDtEM,CC2EN,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},1940:(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__side-nav__heading___vgtlj{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__side-nav__heading___vgtlj:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__side-nav__mainContainer___ogiHY{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__side-nav__title___nb7UC{padding:1rem;font-size:1.2rem}.-esm-stock-management__side-nav__desktopContainer___K7J5p{width:50%}.-esm-stock-management__side-nav__tabletContainer___qoyDq{width:90%}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tab-content{width:100% !important;overflow-x:hidden;padding:0}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tab--list{flex-direction:column}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link:active,.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--col{padding-left:0;width:100%}.-esm-stock-management__side-nav__tabletTab___yprNw{width:25%}.-esm-stock-management__side-nav__desktopTab___nnk6h{width:20%}.-esm-stock-management__side-nav__tab___LsplX{display:flex}.-esm-stock-management__side-nav__tabContainer___sofYJ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__side-nav__optionCell___M_ykV{padding:0 !important}.-esm-stock-management__side-nav__optionHeader___KGdwI{width:1.5rem !important}.-esm-stock-management__side-nav__text___Q29fa{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/side-nav/side-nav.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,kDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHpBb,wDACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,wDACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,gDACE,YAAA,CACA,gBAAA,CAGF,2DACE,SAAA,CAGF,0DACE,SAAA,CAIA,4HACE,UAAA,CAGF,0EACE,qBAAA,CACA,iBAAA,CACA,SAAA,CAGF,wEACE,qBAAA,CAGF,mEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,0EACE,WAAA,CACA,eAAA,CAGF,wFACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,kGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,6EAME,eAAA,CALA,uKACE,oBAAA,CACA,2BAAA,CAMJ,kEACE,cAAA,CACA,UAAA,CAIJ,oDACE,SAAA,CAGF,qDACE,SAAA,CAGF,8CACE,YAAA,CAGF,uDACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,qDACE,oBAAA,CAGF,uDACE,uBAAA,CAGF,+CACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__side-nav__heading___vgtlj",mainContainer:"-esm-stock-management__side-nav__mainContainer___ogiHY",title:"-esm-stock-management__side-nav__title___nb7UC",desktopContainer:"-esm-stock-management__side-nav__desktopContainer___K7J5p",tabletContainer:"-esm-stock-management__side-nav__tabletContainer___qoyDq",cohortBuilder:"-esm-stock-management__side-nav__cohortBuilder___abPYF",tabletTab:"-esm-stock-management__side-nav__tabletTab___yprNw",desktopTab:"-esm-stock-management__side-nav__desktopTab___nnk6h",tab:"-esm-stock-management__side-nav__tab___LsplX",tabContainer:"-esm-stock-management__side-nav__tabContainer___sofYJ",optionCell:"-esm-stock-management__side-nav__optionCell___M_ykV",optionHeader:"-esm-stock-management__side-nav__optionHeader___KGdwI",text:"-esm-stock-management__side-nav__text___Q29fa"};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;overflow-x:hidden;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,iBAAA,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},6919:(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-management-dashboard__container___r_M20{display:"grid";grid-template-columns:16rem auto}.-esm-stock-management__stock-management-dashboard__container___r_M20>div{margin-left:16rem}',"",{version:3,sources:["webpack://./src/dashboard/stock-management-dashboard.scss"],names:[],mappings:"AAAA,sEACE,cAAA,CACA,gCAAA,CAEA,0EACE,iBAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-management-dashboard__container___r_M20"};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{min-height:15rem;display:block}.-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}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:"AAGA,8DACI,gBAAA,CACA,aAAA,CAGJ,kEACI,YAAA,CACA,kBAAA,CAGJ,oEACI,gBCyDS,CDtDb,yEACI,gBAAA,CACA,aAAA,CAGJ,+DACI,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,6HACI,eAAA,CAOK,gJACG,eAAA,CAMhB,eACI,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"};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},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},1280:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deletePackagingUnitButton:()=>bs,deletePackagingUnitModal:()=>_s,deleteStockModal:()=>fs,deleteUserScopeModal:()=>vs,importBulkStockItemsDialog:()=>hs,importTranslation:()=>ds,startupApp:()=>ks,stockManagement:()=>ps,stockManagementAdminCardLink:()=>ms,stockManagementAppMenuItem:()=>ys,stockManagementDashboard:()=>As,stockOperationDialog:()=>gs});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"}},a=n(8827),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),b=n.n(_),h=n(7813),y={};y.styleTagTransform=b(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(h.Z,y);const k=h.Z&&h.Z.locals?h.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 O(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 D(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 O(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)?O(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 x=n(49),N={};N.styleTagTransform=b(),N.setAttributes=g(),N.insert=p().bind(null,"head"),N.domAPI=d(),N.insertStyleElement=v(),s()(x.Z,N);const I=x.Z&&x.Z.locals?x.Z.locals:void 0;var T=n(1256),B={};B.styleTagTransform=b(),B.setAttributes=g(),B.insert=p().bind(null,"head"),B.domAPI=d(),B.insertStyleElement=v(),s()(T.Z,B);const P=T.Z&&T.Z.locals?T.Z.locals:void 0;var U,j=n(9820);function z(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 F(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation").concat(z(e)),n=(0,j.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 L(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function R(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 M(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 q=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 G(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 H={isOverlayOpen:!1,component:Function,header:""},Z=function(){return(0,r.getGlobalStore)("dispensing-store",H)},Y=function(e,t){Z().setState({isOverlayOpen:!0,component:t,header:e})},Q=function(){Z().setState({component:null,isOverlayOpen:!1})},J=n(2653),W=n.n(J),V=function(e,t){return e?W()(e).format(null!=t?t:"DD-MMM-YYYY"):""},K=("".concat(window.getOpenmrsSpaBase),W()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),X="d/m/Y",$=function(e){return V(e,K)},ee=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},te=Object.freeze({SOURCES:"Sources",OPERATION:"Operation",STATUS:"Status"}),ne="moduleResources/stockmanagement/assets/print-logo.svg",re="Ministry of Health",oe="Main Store",ae="/openmrs/",ie=!0;function le(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(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var ce=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function se(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 ue(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 de(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 se(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)?se(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 me=n(965),pe={};pe.styleTagTransform=b(),pe.setAttributes=g(),pe.insert=p().bind(null,"head"),pe.domAPI=d(),pe.insertStyleElement=v(),s()(me.Z,pe);const Ae=me.Z&&me.Z.locals?me.Z.locals:void 0,ge=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 fe=n(9375),ve=n(2411),_e=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:Ae.header},l().createElement("div",{className:Ae["left-justified-items"]},l().createElement(ge,null),l().createElement("div",{className:Ae["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:Ae["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:Ae["right-justified-items"]},l().createElement("div",{className:Ae["date-and-location"]},l().createElement(fe.Ye,{size:16}),l().createElement("span",{className:Ae.value},o),l().createElement("span",{className:Ae.middot},"·"),l().createElement(ve.f,{size:16}),l().createElement("span",{className:Ae.value},(0,r.formatDate)(new Date,{mode:"standard"})))))},be=n(6194),he=n(8115),ye=n(2296),ke={};ke.styleTagTransform=b(),ke.setAttributes=g(),ke.insert=p().bind(null,"head"),ke.domAPI=d(),ke.insertStyleElement=v(),s()(ye.Z,ke);const Ce=ye.Z&&ye.Z.locals?ye.Z.locals:void 0,Ee=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 G(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)?G(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(Z().getState()),Z().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?Ce.desktopOverlay:Ce.tabletOverlay},"tablet"!==c?l().createElement("div",{className:Ce.desktopHeader},l().createElement("div",{className:Ce.headerContent},t),l().createElement(a.zxk,{className:Ce.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(be.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":s("tabletOverlay","Tablet overlay"),className:Ce.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(he.Xd,{size:16})),l().createElement("div",{className:Ce.headerContent},t)),l().createElement("div",null,n)))};var we=n(6919),Se={};Se.styleTagTransform=b(),Se.setAttributes=g(),Se.insert=p().bind(null,"head"),Se.domAPI=d(),Se.insertStyleElement=v(),s()(we.Z,Se);const Oe=we.Z&&we.Z.locals?we.Z.locals:void 0;var De=n(1940),xe={};xe.styleTagTransform=b(),xe.setAttributes=g(),xe.insert=p().bind(null,"head"),xe.domAPI=d(),xe.insertStyleElement=v(),s()(De.Z,xe);const Ne=De.Z&&De.Z.locals?De.Z.locals:void 0,Ie=function(e){var t=e.tabs,n=e.selectedIndex,o=e.onSelectTab;return l().createElement("div",{className:"\n ".concat(Ne.cohortBuilder,"\n ")},l().createElement("div",{className:Ne.tab},l().createElement(a.kwZ,{isFixedNav:!0,expanded:!0,isChildOfHeader:!0,"aria-label":"Side navigation"},l().createElement(a.LDp,null,t.map((function(e,i){return l().createElement(a.yTF,{key:i,isActive:i===n,onClick:function(){i===t.length-1?(0,r.navigate)({to:"/openmrs/admin/maintenance/settings.list?show=Stockmanagement"}):(o(i),(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/").concat(e.link)}))}},e.name)}))))))};function Te(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 Be=function(){var e,t,n=(0,E.useTranslation)().t,r=(e=(0,i.useState)(0),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 Te(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)?Te(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.")}()),o=r[0],a=r[1],c=[{name:n("stockManagementOverview","Overview"),link:"overview"},{name:n("stockManagementStockItems","Items"),link:"stock-items"},{name:n("stockManagementOperations","Operations"),link:"stock-operations"},{name:n("stockManagementStockUserScopes","User Role Scopes"),link:"stock-user-scopes"},{name:n("stockManagementStockSources","Sources"),link:"stock-sources"},{name:n("stockManagementLocations","Locations"),link:"stock-locations"},{name:n("stockManagementReports","Reports"),link:"stock-reports"},{name:n("stockManagementSettings","Settings"),link:"admin/maintenance/settings.list?show=Stockmanagement"}];return l().createElement(Ie,{tabs:c,selectedIndex:o,onSelectTab:a})};var Pe=n(1914),Ue=n(2426),je={};je.styleTagTransform=b(),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(3432),Le={};Le.styleTagTransform=b(),Le.setAttributes=g(),Le.insert=p().bind(null,"head"),Le.domAPI=d(),Le.insertStyleElement=v(),s()(Fe.Z,Le);const Re=Fe.Z&&Fe.Z.locals?Fe.Z.locals:void 0;var Me=n(9697),qe=n(7412),Ge=n.n(qe);W().extend(Ge());const He=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:Re.tileContainer},l().createElement("div",{className:Re.tileHeader},l().createElement("div",{className:Re.headerLabelContainer},l().createElement("label",{className:Re.headerLabel},d),m),p&&l().createElement(r.ConfigurableLink,{className:Re.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(he.ol,{size:16,className:Re.viewListBtn}))),l().createElement("div",{className:Re.metricsGrid},l().createElement("div",null,l().createElement("label",{className:Re.totalsLabel},s),l().createElement("p",{className:Re.totalsValue},u)),!(0,Me.Z)(A)&&l().createElement("div",{className:Re.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,Me.Z)(g)&&l().createElement("div",{className:Re.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,Me.Z)(f)&&l().createElement("div",{className:Re.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 Ze(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem").concat(z(e)),n=(0,j.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 Ye(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(z(e)),n=(0,j.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 Qe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockbatch").concat(z(e)),n=(0,j.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 Je(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(z(e)),n=(0,j.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 We(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e,"?v=full"),n=(0,j.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 Ke(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 Xe(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 $e(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 Xe(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)?Xe(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=Ze(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 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(){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 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}}(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=Qe(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 nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const rt=function(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockitem?v=default&totalCount=true"),t=(0,j.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=tt(),u=s.items,d=(s.isLoading,$e().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){nt(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=F(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:ze.cardContainer},l().createElement(He,{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(He,{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(He,{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 ot=n(8629),at={};at.styleTagTransform=b(),at.setAttributes=g(),at.insert=p().bind(null,"head"),at.domAPI=d(),at.insertStyleElement=v(),s()(ot.Z,at);const it=ot.Z&&ot.Z.locals?ot.Z.locals:void 0;var lt=n(4797);function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const st=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),tt()),n=t.items,o=t.isLoading,i=$e(),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:it.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){ct(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:it.card,key:t},l().createElement("div",{className:it.colorLineRed}),l().createElement("div",{className:it.icon},l().createElement(lt.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:it.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 ut=n(8748);const dt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=F(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:it.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:it.card,key:t},l().createElement("div",{className:it.colorLineBlue}),l().createElement("div",{className:it.icon},l().createElement(ut.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:it.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 mt=n(2327);const pt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=F(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:it.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:it.card,key:t},l().createElement("div",{className:it.colorLineGreen}),l().createElement("div",{className:it.icon},l().createElement(mt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:it.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"))},At=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:it.cardContainer},l().createElement("div",{className:it.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?it.tabletHeading:it.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(st,null)))),l().createElement("div",{className:it.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?it.tabletHeading:it.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(dt,null)))),l().createElement("div",{className:it.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?it.tabletHeading:it.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(pt,null)))))};function gt(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(rt,null),l().createElement(At,null))}var ft=n(5104),vt={};vt.styleTagTransform=b(),vt.setAttributes=g(),vt.insert=p().bind(null,"head"),vt.domAPI=d(),vt.insertStyleElement=v(),s()(ft.Z,vt);const _t=ft.Z&&ft.Z.locals?ft.Z.locals:void 0;function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ht(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(z(e)),n=(0,j.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 bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bt(e,t):void 0}}(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 yt=n(4300),kt={};kt.styleTagTransform=b(),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=n(4642);function wt(){var e,t,n="".concat(r.fhirBaseUrl,"/Location?_summary=data&_tag=main store,main pharmacy,dispensary "),o=(0,j.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,Et.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}function St(e){var t="".concat(r.restBaseUrl,"/role").concat(z(e)),n=(0,j.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 Ot(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default"),t=(0,j.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 Dt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default");return(0,r.openmrsFetch)(e)}function xt(e){var t="".concat(r.restBaseUrl,"/user").concat(z(e)),n=(0,j.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 Nt(e){var t="".concat(r.restBaseUrl,"/concept/").concat(e),n=(0,j.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 It(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t,n,r,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 Bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pt(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){Bt(e,t,n[t])}))}return e}function Ut(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 jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,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)||Ft(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 zt(e){return function(e){if(Array.isArray(e))return It(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ft(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 Ft(e,t){if(e){if("string"==typeof e)return It(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?It(e,t):void 0}}var Lt=ee();const Rt=function(e){var t,n,o,c,s,u,d,m=e.model,p=(0,E.useTranslation)().t,A=jt((0,i.useState)(Pt({},m)),2),g=A[0],f=A[1],v=jt((0,i.useState)([]),2),_=v[0],b=v[1],h=jt((0,i.useState)(!1),2),y=(h[0],h[1]),k=Ot(),C=k.types.results,w=k.isLoading,S=xt({v:U.Default}),O=S.items,D=S.isLoading,x=jt((0,i.useState)(null),2),N=x[0],I=x[1],T=function(e){var t="".concat(r.restBaseUrl,"/user/").concat(e),n=(0,j.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}}(N),B=T.data,P=(T.isError,St({v:U.Default})),z=(P.items,P.isLoading),F=wt().stockLocations,L=jt((0,i.useState)(""),2),R=(L[0],L[1]),M=jt((0,i.useState)([]),2),q=M[0],G=M[1],H=null!==(o=null==O?void 0:O.results)&&void 0!==o?o:[],Z=function(e){var t,n;return(null==g||null===(n=g.operationTypes)||void 0===n||null===(t=n.filter((function(t){return t.operationTypeUuid===e.uuid})))||void 0===t?void 0:t.length)>0},Y=(c=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})}(g).then((function(e){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),(0,r.showToast)({critical:!0,title:p("addUserRole","Add User role"),kind:"success",description:p("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,r.showNotification)({title:p("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",critical:!0,description:null==e?void 0:e.message}),Q()})),[2]}))},s=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=c.apply(e,t);function a(e){Tt(o,n,r,a,i,"next",e)}function i(e){Tt(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e){return s.apply(this,arguments)});return w||z||D?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:Ct.section},l().createElement("div",null,(null==O||null===(t=O.results)||void 0===t?void 0:t.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:Ct.subTitle},p("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:p("user","User"),items:q,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)}));f(Ut(Pt({},g),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),b(null!=a?a:[]),I(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){R(e),function(e){if(""===e.trim())y(!1);else{y(!0);var t=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())}));G(t)}}(e)},placeholder:"Filter..."})))),l().createElement("section",{className:Ct.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:p("role","Role"),id:"select-role",value:null!==(u=g.role)&&void 0!==u?u:"placeholder-item",onChange:function(e){var t,n,r,o=null==F||null===(t=F.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==g||null===(n=g.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:[];f(Ut(Pt({},g),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:p("Choose a role")}),null===(n=null!==(d=null==B?void 0:B.roles)&&void 0!==d?d:_)||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:Ct.section},l().createElement(a.cOn,{className:Ct.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==g?void 0:g.enabled);f(Ut(Pt({},g),{enabled:n}))},checked:null==g?void 0:g.enabled,labelText:p("Enabled ?"),value:null==m?void 0:m.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==g?void 0:g.permanent);f(Ut(Pt({},g),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==g?void 0:g.permanent,value:null==m?void 0:m.permanent,labelText:p("Permanent ?"),id:"chk-userPermanent"}),!(null==g?void 0:g.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(Lt),locale:"en",dateFormat:X,onChange:function(e){f(Ut(Pt({},g),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:K,labelText:p("activeFrom","Active From"),value:$(null==g?void 0:g.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:K,labelText:p("activeTo","Active To"),value:$(null==g?void 0:g.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:Ct.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:Ct.sectionTitle}," ",p("stockOperation","Stock Operations")),l().createElement("div",{className:Ct.hr}),l().createElement("span",{className:Ct.subTitle},p("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:Ct.section},l().createElement(a.cOn,{className:Ct.checkboxGrid},(null==C?void 0:C.length)>0&&C.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:Z(e),className:Ct.checkbox,onChange:function(t){return function(e,t,n){var r,o=null==g||null===(r=g.operationTypes)||void 0===r?void 0:r.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(o){var a=zt(g.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==o?void 0:o.operationTypeUuid)})));f(Ut(Pt({},g),{operationTypes:a}))}else{var i,l=null==C?void 0:C.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={operationTypeName:null==l?void 0:l.name,operationTypeUuid:null==l?void 0:l.uuid};f(Ut(Pt({},g),{operationTypes:zt(null!==(i=null==g?void 0:g.operationTypes)&&void 0!==i?i:[]).concat([c])}))}}(t,e.uuid,Z(e))},labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:Ct.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:Ct.sectionTitle}," ",p("Locations")),l().createElement("div",{className:Ct.hr}),l().createElement("span",{className:Ct.subTitle},p("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:Ct.section},l().createElement(a.cOn,{className:Ct.checkboxGrid},(null==F?void 0:F.length)>0&&F.map((function(e){var t,n,r,o=(t=e,(r=null==g||null===(n=g.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(t){return function(e,t){var n,r=null==g||null===(n=g.locations)||void 0===n?void 0:n.find((function(t){var n;return t.locationUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(r){var o,a,i=zt(null!==(a=null==g||null===(o=g.locations)||void 0===o?void 0:o.filter((function(e){return e.locationUuid!==(null==r?void 0:r.locationUuid)})))&&void 0!==a?a:[]);f(Ut(Pt({},g),{locations:i}))}else{var l,c=null==F?void 0:F.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={locationName:null==c?void 0:c.name,locationUuid:null==c?void 0:c.id,enableDescendants:!1},u=zt(null!==(l=null==g?void 0:g.locations)&&void 0!==l?l:[]).concat([s]);f(Ut(Pt({},g),{locations:u}))}}(t,e.id)},className:Ct.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:Ct.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:Q},p("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:Y},p("save","Save")))))},Mt=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Rt,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gt=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Rt,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:r,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(mt.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){qt(e,t,n[t])}))}return e}({size:16},e))}})};var Ht=n(1657);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}function Yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qt=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 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,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(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),d(!1),(0,r.showToast)({critical:!0,title:c("deletingstockUserScope","Delete Stock User Scope"),kind:"success",description:c("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",critical:!0,description: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(Ht.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){Yt(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(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){Jt(e,t,n[t])}))}return e}function Vt(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 Kt=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope"))},o=ht({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;return Vt(Wt({},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(he.l2,{key:"".concat(t,"-").concat(r,"-0")}):l().createElement(he.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("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),activeFrom:null!==(u=V(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=V(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),actions:l().createElement("div",{style:{display:"flex"}},l().createElement(Gt,{data:c[r]}),l().createElement(Qt,{uuid:c[r].uuid}))})}))}),[t.user.uuid,c,e]);return g?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:_t.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:_t.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Mt,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,Vt(Wt({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?_t.desktopHeader:_t.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,Wt({className:r.isDesktop?_t.desktopRow:_t.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:_t.tileContainer},l().createElement(a.n9L,{className:_t.tile},l().createElement("div",{className:_t.tileContent},l().createElement("p",{className:_t.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:_t.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:_t.paginationOverride}))},Xt=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Kt,null))};function $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(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){$t(e,t,n[t])}))}return e}function tn(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(z(e)),n=(0,j.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 nn(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 rn=n(8098),on={};on.styleTagTransform=b(),on.setAttributes=g(),on.insert=p().bind(null,"head"),on.domAPI=d(),on.insertStyleElement=v(),s()(rn.Z,on);const an=rn.Z&&rn.Z.locals?rn.Z.locals:void 0;function ln(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 cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sn(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}function un(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 dn=function(e){var t,n,o,c=e.model,s=(0,E.useTranslation)().t,u=Nt((0,r.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(sn({},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 ln(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)?ln(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=en({},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.showToast)({critical:!0,title:s("addedSource","Add Source"),kind:"success",description:s("stocksourceaddedsuccessfully","Stock Source Added Successfully")}),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingSource', 'error adding a source"),kind:"error",critical:!0,description: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:an.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(un(sn({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:an.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(un(sn({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:an.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(un(sn({},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:Q},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},mn=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(dn,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var pn=n(5551),An={};An.styleTagTransform=b(),An.setAttributes=g(),An.insert=p().bind(null,"head"),An.domAPI=d(),An.insertStyleElement=v(),s()(pn.Z,An);const gn=pn.Z&&pn.Z.locals?pn.Z.locals:void 0;function fn(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 vn=function(e){var t,n=e.onFilterChange,o=Nt((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:gn.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return fn(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 fn(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)?fn(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 _n=n(6940),bn={};bn.styleTagTransform=b(),bn.setAttributes=g(),bn.insert=p().bind(null,"head"),bn.domAPI=d(),bn.insertStyleElement=v(),s()(_n.Z,bn);const hn=_n.Z&&_n.Z.locals?_n.Z.locals:void 0;function yn(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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cn=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 yn(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)?yn(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),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),(0,r.showToast)({critical:!0,title:c("deletingSource","Delete Source"),kind:"success",description:c("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingSource', 'error deleting a source"),kind:"error",critical:!0,description: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(Ht.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){kn(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wn=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(dn,{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(mt.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){En(e,t,n[t])}))}return e}({size:16},e))}})};function Sn(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){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dn(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){On(e,t,n[t])}))}return e}function xn(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 Nn=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 Sn(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)?Sn(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(){ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource"))},d=function(e){var t=tn(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 nn(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)?nn(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,b=d.setPageSize,h=d.isLoading,y=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n;return xn(Dn({},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(wn,{data:m[t]}),l().createElement(Cn,{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 h?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:hn.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:hn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(vn,{onFilterChange:k})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(mn,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,xn(Dn({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?hn.desktopHeader:hn.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,Dn({className:r.isDesktop?hn.desktopRow:hn.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:hn.tileContainer},l().createElement(a.n9L,{className:hn.tile},l().createElement("div",{className:hn.tileContent},l().createElement("p",{className:hn.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:hn.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!==_&&b(t),n!==g&&v(n)},className:hn.paginationOverride}))},In=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Nn,null))};function Tn(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 Bn(e){var t,n,o=F(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 Tn(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)?Tn(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 Pn=n(1535),Un={};Un.styleTagTransform=b(),Un.setAttributes=g(),Un.insert=p().bind(null,"head"),Un.domAPI=d(),Un.insertStyleElement=v(),s()(Pn.Z,Un);const jn=Pn.Z&&Pn.Z.locals?Pn.Z.locals:void 0;var zn="RETURNED",Fn="CANCELLED",Ln="REJECTED",Rn=["NEW","SUBMITTED","DISPATCHED","COMPLETED",zn,Fn,Ln],Mn=n(6817);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}const Gn=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Ot(),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,j.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 qn(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 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}}(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(Mn.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 Hn=n(5260),Zn={};Zn.styleTagTransform=b(),Zn.setAttributes=g(),Zn.insert=p().bind(null,"head"),Zn.domAPI=d(),Zn.insertStyleElement=v(),s()(Hn.Z,Zn);const Yn=Hn.Z&&Hn.Z.locals?Hn.Z.locals:void 0,Qn=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?Yn.tabContainer:"","\n ").concat(Yn.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Yn.heading},n),l().createElement("div",{className:Yn.tab},l().createElement(a.mQc,{className:"".concat(Yn.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 Jn,Wn;function Vn(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}(Wn=Jn||(Jn={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Wn.DISPOSED_OPERATION_TYPE="disposed",Wn.STOCK_ISSUE_OPERATION_TYPE="stockissue",Wn.STOCK_TAKE_OPERATION_TYPE="stocktake",Wn.REQUISITION_OPERATION_TYPE="requisition",Wn.OPENING_STOCK_OPERATION_TYPE="initial",Wn.RECEIPT_OPERATION_TYPE="receipt",Wn.RETURN_OPERATION_TYPE="return",Wn.ADJUSTMENT_OPERATION_TYPE="adjustment";var Kn=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Xn=function(e){return!$n(e)&&"requisition"!==e},$n=function(e){return"receipt"===e||"initial"===e},er=function(e){return"requisition"===e},tr=function(e){return"receipt"===e||"initial"===e},nr=function(e){return"stockissue"===e||"return"===e},rr=function(e){return"stockissue"===e||or(e)||ar(e)||ir(e)},or=function(e){return"requisition"===e},ar=function(e){return"receipt"===e},ir=function(e){return"transferout"===e},lr=n(7536),cr=n(6312),sr=n(1604),ur=sr.z.object({id:sr.z.string().nullish(),uuid:sr.z.string().nullish(),stockItemUuid:sr.z.string().nullish(),packagingUomName:sr.z.string().nullish(),packagingUomUuid:sr.z.string().nullish(),factor:sr.z.number().nullish(),isDefaultStockOperationsUoM:sr.z.boolean().nullish(),isDispensingUnit:sr.z.boolean().nullish()}),dr=sr.z.object({canView:sr.z.boolean(),canEdit:sr.z.boolean(),canApprove:sr.z.boolean().nullish(),canReceiveItems:sr.z.boolean().nullish(),canDisplayReceivedItems:sr.z.boolean().nullish(),isRequisitionAndCanIssueStock:sr.z.boolean().nullish(),canUpdateBatchInformation:sr.z.boolean().nullish()}),mr=sr.z.object({itemIndex:sr.z.number().nullish(),id:sr.z.string().nullish(),uuid:sr.z.string().nullish(),stockItemUuid:sr.z.string().nullish(),stockItemName:sr.z.string().nullish(),stockItemPackagingUOMUuid:sr.z.string().nullish(),stockItemPackagingUOMName:sr.z.string().nullish(),stockBatchUuid:sr.z.string().nullish(),batchNo:sr.z.string().nullish(),expiration:sr.z.coerce.date().nullish(),quantity:sr.z.number().nullish(),purchasePrice:sr.z.number().nullish(),permission:dr.nullish(),edit:sr.z.boolean().nullish(),hasExpiration:sr.z.boolean().nullish(),packagingUnits:ur.array(),quantityReceived:sr.z.number().nullish(),quantityReceivedPackagingUOMName:sr.z.string().nullish(),quantityReceivedPackagingUOMUuid:sr.z.string().nullish(),quantityRequested:sr.z.number().nullish(),quantityRequestedPackagingUOMUuid:sr.z.string().nullish(),quantityRequestedPackagingUOMName:sr.z.string().nullish(),commonName:sr.z.string().nullish(),acronym:sr.z.string().nullish()}),pr=(sr.z.object({uuid:sr.z.string().nullish(),cancelReason:sr.z.string().nullish(),cancelledBy:sr.z.coerce.number(),cancelledByGivenName:sr.z.string().nullish(),cancelledByFamilyName:sr.z.string().nullish(),cancelledDate:sr.z.coerce.date(),completedBy:sr.z.coerce.number(),completedByGivenName:sr.z.string().nullish(),completedByFamilyName:sr.z.string().nullish(),completedDate:sr.z.coerce.date(),destinationUuid:sr.z.string().nullish(),destinationName:sr.z.string().nullish(),externalReference:sr.z.string().nullish(),atLocationUuid:sr.z.string().nullish(),atLocationName:sr.z.string().nullish(),operationDate:sr.z.coerce.date(),submitted:sr.z.boolean(),submittedBy:sr.z.string().nullish(),submittedByGivenName:sr.z.string().nullish(),submittedByFamilyName:sr.z.string().nullish(),locked:sr.z.boolean(),operationNumber:sr.z.string().nullish(),operationOrder:sr.z.coerce.number(),remarks:sr.z.string().nullish(),sourceUuid:sr.z.string().nullish(),sourceName:sr.z.string().nullish(),status:sr.z.enum(Rn),returnReason:sr.z.string().nullish(),rejectionReason:sr.z.string().nullish(),operationTypeUuid:sr.z.string().nullish(),operationType:sr.z.string().nullish(),operationTypeName:sr.z.string().nullish(),responsiblePerson:sr.z.coerce.number(),responsiblePersonUuid:sr.z.string().nullish(),responsiblePersonGivenName:sr.z.string().nullish(),responsiblePersonFamilyName:sr.z.string().nullish(),responsiblePersonOther:sr.z.string().nullish(),creator:sr.z.coerce.number(),dateCreated:sr.z.coerce.date(),creatorGivenName:sr.z.string().nullish(),creatorFamilyName:sr.z.string().nullish(),permission:dr.nullish(),reasonUuid:sr.z.string().nullish(),reasonName:sr.z.string().nullish(),approvalRequired:sr.z.boolean().nullish(),stockOperationItems:mr.array(),submittedDate:sr.z.coerce.date(),returnedByGivenName:sr.z.string().nullish(),returnedByFamilyName:sr.z.string().nullish(),returnedDate:sr.z.coerce.date(),rejectedByGivenName:sr.z.string().nullish(),rejectedByFamilyName:sr.z.string().nullish(),rejectedDate:sr.z.coerce.date(),dispatchedByGivenName:sr.z.string().nullish(),dispatchedByFamilyName:sr.z.string().nullish(),dispatchedDate:sr.z.coerce.date(),requisitionStockOperationUuid:sr.z.string()}),sr.z.object({operationDate:sr.z.coerce.date(),sourceUuid:sr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:sr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:sr.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:sr.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:sr.z.string().nullish(),remarks:sr.z.string().nullish()})),Ar=function(e){switch(e){case Jn.OPENING_STOCK_OPERATION_TYPE:return pr.omit({destinationUuid:!0,reasonUuid:!0});case Jn.STOCK_TAKE_OPERATION_TYPE:case Jn.ADJUSTMENT_OPERATION_TYPE:case Jn.DISPOSED_OPERATION_TYPE:return pr.omit({destinationUuid:!0});case Jn.TRANSFER_OUT_OPERATION_TYPE:case Jn.STOCK_ISSUE_OPERATION_TYPE:return pr.omit({reasonUuid:!0}).merge(sr.z.object({destinationUuid:sr.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Jn.RETURN_OPERATION_TYPE:case Jn.REQUISITION_OPERATION_TYPE:case Jn.RECEIPT_OPERATION_TYPE:return pr.omit({reasonUuid:!0}).merge(sr.z.object({sourceUuid:sr.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const gr=function(e){return l().createElement(lr.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 fr(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 vr(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 fr(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)?fr(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 _r(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 br(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 _r(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 _r(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)?_r(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 hr=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:""}},yr={uuid:"Other",display:"Other",person:{display:"Other"}};function kr(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const Cr=function(e){var t=function(e){var t=vr((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=xt(n),a=o.items.results,l=o.isLoading,c=vr((0,i.useState)(null),2),s=c[0],u=c[1],d=vr((0,i.useState)(10),2),m=d[0],p=d[1],A=vr((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=br((function(e){o(e)}),1e3);return r&&r.push(yr),l().createElement("div",null,l().createElement(lr.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:kr,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 Er(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wr=function(e){return l().createElement(lr.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){Er(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))}})},Sr=function(e){var t=Nt((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(lr.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 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 Dr=function(e){return l().createElement(lr.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){Or(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 xr(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 Nr=(0,i.createContext)(null),Ir=function(){return(0,i.useContext)(Nr)},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 xr(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)?xr(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(Nr.Provider,{value:a},r)},Br=[Jn.ADJUSTMENT_OPERATION_TYPE,Jn.RECEIPT_OPERATION_TYPE,Jn.STOCK_ISSUE_OPERATION_TYPE,Jn.STOCK_TAKE_OPERATION_TYPE,Jn.RETURN_OPERATION_TYPE,Jn.DISPOSED_OPERATION_TYPE,Jn.OPENING_STOCK_OPERATION_TYPE,Jn.TRANSFER_OUT_OPERATION_TYPE],Pr=[Jn.ADJUSTMENT_OPERATION_TYPE,Jn.DISPOSED_OPERATION_TYPE,Jn.STOCK_TAKE_OPERATION_TYPE,Jn.OPENING_STOCK_OPERATION_TYPE];function Ur(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 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 zr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 Ur(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)?Ur(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 Lr=function(e){var t,n,r,o,c,s,u,d,m,p,A,g,f,v=e.model,_=e.onSave,b=e.operation,h=e.canEdit,y=e.isEditing,k=e.setup,C=k.requiresStockAdjustmentReason,w=k.shouldLockSource,S=k.shouldLockDestination,O=k.sourcePartyList,D=k.destinationPartyList,x=(0,E.useTranslation)().t,N=(Ir().setFormContext,Bn({v:U.Full,totalCount:!0})),T=N.isLoading,B=(N.items,Vn(null==b?void 0:b.operationType)),P=(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){zr(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,lr.cI)({defaultValues:"stockissue"===B?P:v,mode:"all",resolver:(0,cr.F)(Ar(B))}),z=j.handleSubmit,F=j.control,L=j.formState.errors,R=j.setValue,M=Fr((0,i.useState)(),2),q=M[0],G=M[1],H=Fr((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,V,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 Br.includes(e)}(n)&&delete r.destinationName,function(e){return Pr.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){jr(a,r,o,i,l,"next",e)}function l(e){jr(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(I.formContainer," ").concat(I.verticalForm)},h&&l().createElement(lr.Qr,{control:F,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=Fr(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:K,labelText:x("operationDate","Operation Date"),defaultValue:$(null==v?void 0:v.operationDate)}))},name:"operationDate"}),!h&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(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"}),h&&!w&&(null==b?void 0:b.hasSource)&&l().createElement(gr,{controllerName:"sourceUuid",name:"sourceUuid",control:F,title:(null==b?void 0:b.hasDestination)?x("from","From"):x("location:","Location"),placeholder:b.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:O||[]}),(!h||y||w)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:"stockissue"===B?P.sourceName:null!==(Q=null==v?void 0:v.sourceName)&&void 0!==Q?Q:"",readOnly:!0,labelText:(null==b||b.hasDestination,"From")}),h&&!S&&(null==b?void 0:b.hasDestination)&&l().createElement(gr,{controllerName:"destinationUuid",name:"destinationUuid",control:F,title:(null==b?void 0:b.hasSource)?"To":"Location",placeholder:(null==b?void 0:b.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:D||[]}),(!h||y||S)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:"stockissue"===B?P.destinationName:null!==(J=null==v?void 0:v.destinationName)&&void 0!==J?J:"",readOnly:!0,labelText:(null==b||b.hasSource,"To")}),h&&l().createElement(Cr,{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)===yr.uuid&&G(!0)}}),q&&l().createElement(wr,{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)}),!h&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(V=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==yr.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==V?V:"",readOnly:!0,labelText:"Responsible Person"}),C&&h&&l().createElement(Sr,{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&&!h&&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(Dr,{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:he.ol},Z?l().createElement(a.lSo,null):x("next","Next")))))};var Rr={stockItemUuid:sr.z.string().min(1,{message:"Required"}),stockItemName:sr.z.string().min(1).nullish(),stockItemPackagingUOMUuid:sr.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:sr.z.string().min(1).nullish(),batchNo:sr.z.string().min(1,{message:"Required"}),stockBatchUuid:sr.z.string().optional(),expiration:sr.z.coerce.date({required_error:"Required"}),quantity:sr.z.coerce.number().min(1,{message:"Required"}),purchasePrice:sr.z.coerce.number().nullish(),hasExpiration:sr.z.boolean().nullish()},Mr=sr.z.object(Rr),qr=(Mr.omit({expiration:!0}),sr.z.object({stockItems:sr.z.array(Mr)})),Gr=n(6781),Hr={};Hr.styleTagTransform=b(),Hr.setAttributes=g(),Hr.insert=p().bind(null,"head"),Hr.domAPI=d(),Hr.insertStyleElement=v(),s()(Gr.Z,Hr);const Zr=Gr.Z&&Gr.Z.locals?Gr.Z.locals:void 0;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 Qr(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 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}}(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 Jr(e){return e.drugName||e.conceptName}const Wr=function(e){var t=function(e){var t=Qr((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=Ze(n),a=o.items.results,l=o.isLoading,c=Qr((0,i.useState)(null),2),s=c[0],u=c[1],d=Qr((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Qr((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=br((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(lr.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:Jr,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Vr=function(e){var t,n=We(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(lr.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){var t;return null!==(t=e.packagingUomName)&&void 0!==t?t:""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Kr(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 Xr(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 Kr(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)?Kr(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 $r(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){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 $r(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)?$r(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 to(e){var t=eo((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=eo((0,i.useState)(10),2),a=o[0],l=o[1],c=eo((0,i.useState)(null),2),s=c[0],u=c[1],d=eo((0,i.useState)(1),2),m=d[0],p=d[1],A=eo((0,i.useState)(null==e?void 0:e.stockItemUuid),2),g=A[0],f=A[1],v=eo((0,i.useState)(null==e?void 0:e.partyUuid),2),_=v[0],b=v[1],h=eo((0,i.useState)(null==e?void 0:e.locationUuid),2),y=h[0],k=h[1],C=eo((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,O=Ye(n),D=O.items,x=O.isLoading,N=O.isError;return{items:null!==(S=D.results)&&void 0!==S?S:[],totalCount:D.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:b,setStockBatchUuid:w}}function no(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ro=function(e){var t=function(e){var t=Xr((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=Qe(n),a=o.items.results,l=o.isLoading,c=Xr((0,i.useState)(null),2),s=c[0],u=c[1],d=Xr((0,i.useState)(10),2),m=d[0],p=d[1],A=Xr((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=to(),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){no(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(lr.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 oo(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 ao(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 oo(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)?oo(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 io=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=ao((0,i.useState)(),2),_=(v[0],v[1]),b=ao((0,i.useState)(),2),h=(b[0],b[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,b,y,k,C,E,w,S,O,D,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,V,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Zr.desktopRow:Zr.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(Wr,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:re,control:m,invalid:!!(null==A||null===(b=A.stockItems)||void 0===b||null===(v=b[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(ro,{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),h(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===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=ao(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:K,defaultValue:$(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)&&$(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!==(V=null===(z=d[null==e?void 0:e.stockBatchUuid])||void 0===z?void 0:z.quantityUoM)&&void 0!==V?V:""):"",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(Vr,{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:Ht.ZN,onClick:function(){return g(i)}})))})))};var lo=n(6360),co={};co.styleTagTransform=b(),co.setAttributes=g(),co.insert=p().bind(null,"head"),co.domAPI=d(),co.insertStyleElement=v(),s()(lo.Z,co);const so=lo.Z&&lo.Z.locals?lo.Z.locals:void 0;function uo(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,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 po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ao(e){return function(e){if(Array.isArray(e))return uo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||go(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 go(e,t){if(e){if("string"==typeof e)return uo(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)?uo(e,t):void 0}}const fo=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,b=e.canEdit,h=void 0===b||b,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,O=Ir().formContext,D=function(e){if("requisition"===e){var t=Mr.omit({batchNo:!0,expiration:!0});return sr.z.object({stockItems:sr.z.array(t)})}return qr}(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.showToast)({critical:!0,title:"No stock items",kind:"error",description:"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){mo(a,r,o,i,l,"next",e)}function l(e){mo(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,lr.cI)({resolver:(0,cr.F)(D),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)||go(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,lr.Dq)({name:"stockItems",control:T}),z=j.fields,F=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==O?void 0:O.stockItems){var e=null==O?void 0:O.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==O?void 0:O.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(Ao(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),Ao(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),Ao(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),Ao(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")}],Ao(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:so.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){po(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?so.desktopHeader:so.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)})),h&&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:he.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:he.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(io,{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:h,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:z})," ")))}})))};var vo=n(8808);function _o(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 bo(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 ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){bo(a,r,o,i,l,"next",e)}function l(e){bo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function yo(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 _o(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)?_o(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 ko(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 Co=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=yo((0,i.useState)(!1),2),d=u[0],m=u[1],p=yo((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:ho((function(){return ko(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:fe.X4},s("complete","Complete")),o&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:ho((function(){return ko(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:ut.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:vo.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:ho((function(){return ko(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:vo.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:Ht.WP},s("goBack","Go Back"))))};var Eo="Location",wo="Other";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 Oo(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,b,h,y,k,C,E,w,S,O,D,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H;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(Z){switch(Z.label){case 0:return A=!!t,g=[],f=!1,v=n,b=null!==(_=null==t||null===(o=t.permission)||void 0===o?void 0:o.isRequisitionAndCanIssueStock)&&void 0!==_&&_,y=null!==(h=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!==h?h:[],k=1===y.length&&y[0]===oe,E=null!==(C=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!==C?C:[],w=1===E.length&&E[0]===oe,S=null,A?(p=structuredClone(hr()),p=Object.assign(p,{operationDate:ee(),operationTypeName:null==e?void 0:e.name,operationTypeUuid:null==e?void 0:e.uuid,operationType:null==e?void 0:e.operationType}),e.operationType,Jn.STOCK_ISSUE_OPERATION_TYPE,[4,(Q="".concat(r.restBaseUrl,"/stockmanagement/party?v=default"),(0,r.openmrsFetch)(Q))]):[3,2];case 1:if(!(I=Z.sent()).ok)throw Error("Error loading parties");return O=null==I||null===(N=I.data)||void 0===N||null===(x=N.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Eo&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wo})),(null==e?void 0:e.hasSource)&&A&&k&&(null==O?void 0:O.length)>0&&(T=O[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(D=null==I||null===(P=I.data)||void 0===P||null===(B=P.results)||void 0===B?void 0:B.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Eo&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wo})),A&&w&&(null==D?void 0:D.length)>0&&(U=D[0],p.destinationUuid=U.uuid,p.destinationName=U.name)),[3,4];case 2:return[4,Dt()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return z=Vn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=z,"adjustment"===Y),requiresBatchUuid:Xn(z),requiresActualBatchInfo:$n(z),isQuantityOptional:er(z),canCaptureQuantityPrice:tr(z),requiresStockAdjustmentReason:Kn(z),requiresDispatchAcknowledgement:nr(z),allowExpiredBatchNumbers:null!==(F=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==F&&F,canEditModel:null!==(L=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==L&&L,canViewModel:null!==(R=null==t||null===(c=t.permission)||void 0===c?void 0:c.canView)&&void 0!==R&&R,canApproveModel:null!==(M=null==t||null===(s=t.permission)||void 0===s?void 0:s.canApprove)&&void 0!==M&&M,canIssueStock:b,canReceiveItems:null!==(q=null==t||null===(u=t.permission)||void 0===u?void 0:u.canReceiveItems)&&void 0!==q&&q,canDisplayReceivedItems:null!==(G=null==t||null===(d=t.permission)||void 0===d?void 0:d.canDisplayReceivedItems)&&void 0!==G&&G,canUpdateItemsBatchInformation:null!==(H=null==t||null===(m=t.permission)||void 0===m?void 0:m.canUpdateBatchInformation)&&void 0!==H&&H,canPrint:b||rr(z),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Eo&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wo},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Eo&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wo},location:S,sourcePartyList:O,destinationPartyList:D,stockOperationTypes:v,hasQtyRequested:f}]}var Y,Q}))},Oo=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)}))},Oo.apply(this,arguments)}function Do(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 Do(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)?Do(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 No=n(3133);function Io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const To=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(No.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){Io(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Bo(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:"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){Bo(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};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 jo=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(be.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){Uo(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};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}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:"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(mt.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){zo(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function Lo(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 Ro,Mo,qo=(Ro=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={},Jn.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):Jn.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]}))},Mo=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=Ro.apply(e,t);function a(e){Lo(o,n,r,a,i,"next",e)}function i(e){Lo(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Mo.apply(this,arguments)});function Go(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 Ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Go(a,r,o,i,l,"next",e)}function l(e){Go(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Zo(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 Yo=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>")},Qo=function(){var e=Ho((function(){var e,t;return Zo(this,(function(n){switch(n.label){case 0:e=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(r=ne?"".concat(ae).concat(ne):"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",new Promise((function(e,t){var n;if(r){var o=document.getElementById("hdnTxtPrintLogo");if(o&&(null===(n=o.value)||void 0===n?void 0:n.length)>0){var a=o.getAttribute("isSvg");e({image:o.value,isSvg:"1"===a})}else if(r.toLowerCase().endsWith(".svg"))fetch(r,{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=r}}else e(null)})))];case 2:return e=n.sent(),[3,4];case 3:return t=n.sent(),console.info(t),[3,4];case 4:return[2,e||re?'\n<div class="logo" >\n '.concat(e?e.isSvg?e.image:"<img alt='' src='".concat(e.image,"' />"):"","\n ").concat(re?"<span class='logo-text text'>".concat(re,"</span>"):"","\n</div> \n "):""]}var r}))}));return function(){return e.apply(this,arguments)}}(),Jo=function(){var e=Ho((function(){var e;return Zo(this,(function(t){switch(t.label){case 0:return[4,Qo()];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)}}(),Wo=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 Vo(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 Ko(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Vo(a,r,o,i,l,"next",e)}function l(e){Vo(a,r,o,i,l,"throw",e)}i(void 0)}))}}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])}}}var $o=function(){var e=Ko((function(e){var t,n,r,o,a,i,l,c,s;return Xo(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,Jo()];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(V(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(V(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)}}(),ea=function(){var e=Ko((function(e){var t;return Xo(this,(function(n){switch(n.label){case 0:return[4,$o(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ta(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 na(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ta(a,r,o,i,l,"next",e)}function l(e){ta(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ra(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 oa=function(){var e=na((function(e){var t,n,r,o,a,i,l,c,s;return ra(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,Jo()];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(V(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(V(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)}}(),aa=function(){var e=na((function(e){var t;return ra(this,(function(n){switch(n.label){case 0:return[4,oa(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ia(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 la(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ia(a,r,o,i,l,"next",e)}function l(e){ia(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ca(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 sa=function(){var e=la((function(e){var t,n,r,o,a,i,l,c;return ca(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,Jo()];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(V(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)}}(),ua=function(){var e=la((function(e){var t;return ca(this,(function(n){switch(n.label){case 0:return[4,sa(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function da(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 ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=((0,r.useConfig)().config,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){da(a,r,o,i,l,"next",e)}function l(e){da(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&&(L(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(z(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,qo(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,ea(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,aa(c)];case 4:return u.sent(),[3,7];case 5:return[4,ua(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){ma(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function Aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ga=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(ut.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){Aa(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const va=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(he.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){fa(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function _a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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){_a(e,t,n[t])}))}return e}const ha=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=ba({},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(){za(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(ut.ei,ba({size:16},e))}},s("issueStock","Issue Stock "))};var ya=n(2496),ka={};ka.styleTagTransform=b(),ka.setAttributes=g(),ka.insert=p().bind(null,"head"),ka.domAPI=d(),ka.insertStyleElement=v(),s()(ya.Z,ka);const Ca=ya.Z&&ya.Z.locals?ya.Z.locals:void 0;function Ea(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 wa(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 Sa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){wa(a,r,o,i,l,"next",e)}function l(e){wa(a,r,o,i,l,"throw",e)}i(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 Da(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 xa(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 Na(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 Ea(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)?Ea(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 Ia(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 Ta=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,b,h,y,k,C,w,S,O,D,x,N,I,T,B,P,U,j,z,F,L,R,M,G,H,Z,Y,J,W,V,K,X,$,ee,te,ne,re,oe,ae,ie,le,ce,se,ue,de,me,pe,Ae,ge,fe,ve,_e,be,he,ye,ke,Ce,Ee,we,Se,Oe,De=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=xo((0,i.useState)(!0),2),n=t[0],r=t[1],o=xo((0,i.useState)(!1),2),a=o[0],l=o[1],c=xo((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return Oo.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=Na((0,i.useState)(null==e?void 0:e.isEditing),2),ze=je[0],Fe=je[1],Le=Na((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Na((0,i.useState)(0),2),Ge=qe[0],He=qe[1];if(Be)return l().createElement(a.MHR,null);if(Pe)return Q(),void(0,r.showSnackbar)({kind:"error",title:De("error","Error"),subtitle:De("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(Lr,xa(Da({},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:Sa((function(){return Ia(this,(function(e){return Fe(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:De("stockItems","Stock Items"),component:l().createElement(fo,xa(Da({},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:Sa((function(){return Ia(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(Co,xa(Da({},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=Sa((function(t){return Ia(this,(function(n){switch(n.label){case 0:return[4,ja(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:Sa((function(){return Ia(this,(function(t){switch(t.label){case 0:return[4,Fa("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Sa((function(){return Ia(this,(function(t){switch(t.label){case 0:return[4,Fa("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Sa((function(){return Ia(this,(function(t){switch(t.label){case 0:return[4,Fa("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:Ca.textHeading},De("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(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:Ca.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("started","Started"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(_=e.model)||void 0===_?void 0:_.creatorFamilyName," ",null==e||null===(b=e.model)||void 0===b?void 0:b.creatorGivenName))),(null==e||null===(h=e.model)||void 0===h?void 0:h.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("submitted","Submitted"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.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:Ca.textHeading},De("dispatched","Dispatched"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByFamilyName," ",null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("returned","Returned"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.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:Ca.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:Ca.textHeading},De("completed","Completed"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.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:Ca.textHeading},De("cancelled","Cancelled"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByFamilyName," ",null==e||null===(M=e.model)||void 0===M?void 0:M.cancelledByGivenName,l().createElement("span",{className:Ca.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:Ca.textHeading},De("rejected","Rejected"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(Y=e.model)||void 0===Y?void 0:Y.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)===Jn.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Jn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(To,{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)===Jn.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Jn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ga,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Po,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Fo,{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(va,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jo,{operation:null==e?void 0:e.model}))),(null==e||null===(be=e.model)||void 0===be||null===(_e=be.permission)||void 0===_e?void 0:_e.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Fo,{operation:null==e?void 0:e.model})),(null==e||null===(ye=e.model)||void 0===ye||null===(he=ye.permission)||void 0===he?void 0:he.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ha,{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)===Jn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Jn.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Jn.RECEIPT_OPERATION_TYPE||(null==e||null===(Oe=e.model)||void 0===Oe?void 0:Oe.operationType)===Jn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(pa,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Tr,null,l().createElement(Qn,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Ba(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 Pa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ba(a,r,o,i,l,"next",e)}function l(e){Ba(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Ua(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 ja=function(){var e=Pa((function(e,t,n,o,a){var i,l,c,s;return Ua(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===Jn.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?M:R)(i)];case 2:return(null==(l=o.sent())?void 0:l.data)&&(ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation")),(0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",description:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Q()),[3,4];case 3:return c=o.sent(),s=le(c),(0,r.showNotification)({description:s.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),za=function(e,t,n,r,o){Y("".concat(t?"Edit":"New: "," ").concat(t?null==e?void 0:e.operationTypeName:null==n?void 0:n.name),l().createElement(Ta,{model:e,onSave:function(e){return ja(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},Fa=function(){var e=Pa((function(e,t,n){var o;return Ua(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 La(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 Ra=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 La(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)?La(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&&L(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(){za(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};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}function qa(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)||Ga(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 Ga(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}}const Ha=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Nt(t),c=o.items,s=o.isLoading,u=qa((0,i.useState)(!1),2),d=u[0],m=u[1],p=qa((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(Rn.map((function(e){return{uuid:e,display:e}})));break;case te.SOURCES:var e;(null==c||null===(e=c.answers)||void 0===e?void 0:e.length)&&(g(function(e){if(Array.isArray(e))return Ma(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Ga(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 te.OPERATION:Dt().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:jn.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 Za(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 Ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qa(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}function Ja(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 Wa(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 Za(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)?Za(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 Va=function(){var e,t=(0,E.useTranslation)().t,n=function(){ce("".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=Bn({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,_=Wa((0,i.useState)(s),2),b=_[0],h=_[1],y=Wa((0,i.useState)(null),2),k=y[0],C=y[1],w=Wa((0,i.useState)(null),2),S=w[0],O=w[1],D=Wa((0,i.useState)([]),2),x=D[0],N=D[1],I=Wa((0,i.useState)([]),2),T=I[0],B=I[1],P=Wa((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()}});ce("".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===te.SOURCES?N(e):t===te.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}))),h(e)},q=(0,i.useMemo)((function(){return null==b?void 0:b.map((function(n,r){var i,c,s,u,d,m,p,A,g,f,v,_,h,y,k,C,E,w,S;return Ja(Qa({},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(Ra,{model:b[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(he.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:V(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"},V(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)!==zn&&(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"},V(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"},V(null==n?void 0:n.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(_=n.completedByFamilyName)&&void 0!==_?_:""," ",null!==(h=n.completedByGivenName)&&void 0!==h?h:""))),(null==n?void 0:n.status)===Fn&&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"},V(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)===Ln&&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"},V(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)===zn&&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"},V(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(){za(b[r],!0,o,e,!1)}}))})}))}),[L,b,o,e,s]);return v?l().createElement(a.gqd,{className:jn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:jn.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:jn.toolbarContent},l().createElement(a.Ys1,{className:jn.patientListSearch,expanded:!0,onChange:p,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:jn.filterContainer},l().createElement(a.Mtg,{className:jn.dateAlign,datePickerType:"range",dateFormat:X,value:[k,S],onChange:function(e){var t=Wa(e,2);!function(e){var t=Wa(e,2),n=t[0],r=t[1];n&&(C(n),S&&n&&S<n&&O(n)),r&&(O(r),k&&r&&k>r&&C(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:K}),l().createElement(a.aj6,{placeholder:K})),l().createElement(Ha,{conceptUuid:F.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:R}),l().createElement(Ha,{filterName:te.STATUS,onFilterChange:R}),l().createElement(Ha,{filterName:te.OPERATION,onFilterChange:R})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Gn,{onOperationTypeSelected:function(t){za(hr(),!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,Ja(Qa({},u({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jn.desktopHeader:jn.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,_,h,y,k,C,E,w,S,O,D,x,N,I,T,B,P,U,j,z,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Qa({className:r.isDesktop?jn.desktopRow:jn.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=b[n])||void 0===o?void 0:o.dateCreated)?V(null===(i=b[n])||void 0===i?void 0:i.dateCreated):""," ",(null===(u=b[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(d=b[n])||void 0===d?void 0:d.dateCreated)?null===(p=b[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=b[n])||void 0===A?void 0:A.completedDate)?V(null===(g=b[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=b[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=b[n])||void 0===v?void 0:v.completedDate)?null===(_=b[n])||void 0===_?void 0:_.creatorFamilyName:""),l().createElement(a.agF,null,(null===(h=b[n])||void 0===h?void 0:h.stockOperationItems)?null===(y=b[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=b[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=b[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=b[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(w=b[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=b[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(O=b[n])||void 0===O?void 0:O.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(D=b[n])||void 0===D?void 0:D.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=b[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(N=b[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=b[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=b[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=b[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=b[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=b[n])||void 0===j?void 0:j.stockOperationItems)?null===(z=b[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=b[n])||void 0===F?void 0:F.stockOperationItems)?null===(L=b[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===i.length?l().createElement("div",{className:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("div",{className:jn.tileContent},l().createElement("p",{className:jn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:jn.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:jn.paginationOverride}))},Ka=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Va,null))};var Xa={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 $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 ei(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.")}()}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){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const ri=function(e){var t,n,o=function(e){var t=ei((0,i.useState)(e||{v:U.Default,startIndex:0}),2),n=t[0],o=(t[1],function(e){var t="".concat(r.restBaseUrl,"/drug").concat(z(e)),n=(0,j.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)),a=o.items.results,l=o.isLoading,c=ei((0,i.useState)(""),2),s=c[0],u=c[1],d=ei((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=ei((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){}),[s,m,g]),{drugList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(),c=o.isLoading,s=o.drugList,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 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}}(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()?s:s.filter((function(e){return e.name.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,s]);return l().createElement("div",null,l().createElement(lr.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:p||[],initialSelectedItem:null!==(n=null==s?void 0:s.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:ni,onChange:function(t){var n;null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),o(t.selectedItem.uuid)},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),c&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};var oi=sr.z.string().max(255).nullish(),ai=sr.z.object({isDrug:sr.z.boolean(),drugUuid:sr.z.string().nullish(),drugName:sr.z.string().nullish(),commonName:oi,acronym:oi,hasExpiration:sr.z.boolean(),expiryNotice:sr.z.coerce.number().nullish(),uuid:sr.z.string().nullish(),conceptUuid:sr.z.string().nullish(),conceptName:sr.z.string().nullish(),preferredVendorUuid:sr.z.string().nullish(),preferredVendorName:sr.z.string().nullish(),purchasePrice:sr.z.number().nullish(),purchasePriceUoMUuid:sr.z.string().nullish(),purchasePriceUoMName:sr.z.string().nullish(),categoryUuid:sr.z.string().nullish(),categoryName:sr.z.string().nullish(),dispensingUnitUuid:sr.z.string().nullish(),dispensingUnitName:sr.z.string().nullish(),dispensingUnitPackagingUoMUuid:sr.z.string().nullish(),dispensingUnitPackagingUoMName:sr.z.string().nullish(),defaultStockOperationsUoMUuid:sr.z.string().nullish(),defaultStockOperationsUoMName:sr.z.string().nullish(),reorderLevel:sr.z.number().nullish(),reorderLevelUoMUuid:sr.z.string().nullish(),reorderLevelUoMName:sr.z.string().nullish(),dateCreated:sr.z.coerce.date().nullish(),creatorGivenName:sr.z.string().nullish(),creatorFamilyName:sr.z.string().nullish(),voided:sr.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 ii(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const li=function(e){return l().createElement(lr.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){ii(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})})))}})},ci=function(e){return l().createElement(lr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o,i,c=t.field,s=c.onChange,u=c.value,d=c.ref;return l().createElement(a.Y2U,{id:"".concat(e.name,"-").concat(null===(n=e.row)||void 0===n?void 0:n.id,"-").concat(null===(r=e.row)||void 0===r?void 0:r.uuid),value:null!==(i=null===(o=e.row)||void 0===o?void 0:o.factor)&&void 0!==i?i:u,min:e.min,hideSteppers:e.hideSteppers||!1,ref:d,onChange:function(t,n){s(t,n),e.onChange&&e.onChange(t,n)}})}})},si=function(e){var t=Nt((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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})}})},ui=function(e){var t=tn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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})}})},di=function(e){var t=(0,E.useTranslation)().t,n=Nt((0,r.useConfig)().stockItemCategoryUUID),o=n.items.answers;return n.isLoading?l().createElement(a.znL,null):l().createElement(lr.Qr,{name:e.controllerName,control:e.control,render:function(n){var r,i,c=n.field,s=c.onChange,u=c.value,d=c.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:o||[],onChange:function(t){var n,r;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),s(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===u})))||void 0===r?void 0:r.display))&&void 0!==i?i:"",placeholder:e.placeholder,ref:d,invalid:e.invalid,invalidText:e.invalidText})}})},mi=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(lr.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)},pi=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=We(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(mi,{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(mi,{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(ci,{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(mi,{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(ci,{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(mi,{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 Ai(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 gi=function(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/concept").concat(z({})),n=(0,j.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 Ai(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)?Ai(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(lr.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 fi=[{label:"Pharmaceuticals",value:!0},{label:"Non Pharmaceuticals",value:!1}],vi=[{label:"Yes",value:!0},{label:"No",value:!1}];function _i(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 bi(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 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 _i(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)?_i(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 yi=(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,b=e.handleTabChange,h=(0,E.useTranslation)().t,y=(0,lr.cI)({defaultValues:f,mode:"all",resolver:(0,cr.F)(ai)}),k=y.handleSubmit,C=y.control,w=y.formState,S=w.errors,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){bi(a,r,o,i,l,"next",e)}function l(e){bi(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]),N(!0),e.uuid=f.uuid,[4,v(e)];case 1:return t.sent(),b(1),ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),[3,4];case 2:return t.sent(),[3,4];case 3:return N(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),D=hi((0,i.useState)(!1),2),x=D[0],N=D[1],T=hi((0,i.useState)(!1),2),B=T[0],P=T[1],U=hi((0,i.useState)(!1),2),j=U[0],z=U[1];return(0,i.useEffect)((function(){var e,t;P(null!==(e=f.isDrug)&&void 0!==e&&e),z(null!==(t=f.hasExpiration)&&void 0!==t&&t)}),[f.hasExpiration,f.isDrug]),l().createElement("form",{className:"".concat(I.formContainer," ").concat(I.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:h("itemType","Item Type"),title:h("itemType","Item Type")},l().createElement(li,{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){P(e)},options:fi})),B&&l().createElement(ri,{name:"drugUuid",controllerName:"drugUuid",control:C,title:h("pleaseSpecify","Please specify:"),invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(n=S.drugUuid)||void 0===n?void 0:n.message)}),null!=B&&!B&&l().createElement(gi,{name:"conceptUuid",controllerName:"conceptUuid",control:C,title:h("pleaseSpecify","Please specify:"),placeholder:h("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(wr,{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:h("commonName","Common name:"),invalid:!!S.commonName,invalidText:S.commonName&&(null==S||null===(c=S.commonName)||void 0===c?void 0:c.message)}),l().createElement(wr,{id:"acronym",maxLength:255,name:"acronym",control:C,controllerName:"acronym",size:"md",labelText:h("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:h("hasExpiration","Does the item expire?"),title:h("hasExpiration","Does the item expire?")},l().createElement(li,{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){z(e)},options:vi})),j&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:h("expirationNotice","Expiration Notice (days)"),title:h("expirationNotice","Expiration Notice (days)")},l().createElement(ci,{id:"expiryNotice",name:"expiryNotice",control:C,controllerName:"expiryNotice",min:0,size:"md",allowEmpty:!0,label:h("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(ui,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:C,title:h("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:h("chooseVendor","Choose vendor"),invalid:!!S.preferredVendorUuid,invalidText:S.preferredVendorUuid&&(null==S||null===(m=S.preferredVendorUuid)||void 0===m?void 0:m.message)}),l().createElement(di,{name:"categoryUuid",controllerName:"categoryUuid",control:C,title:h("category:","Category:"),placeholder:h("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(si,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:C,title:h("dispensingUnit","Dispensing Unit:"),placeholder:h("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(pi,{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(O),kind:"primary",renderIcon:vo.vc},x?l().createElement(a.lSo,null):h("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},h("cancel","Cancel"))))}));const ki=yi;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){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(z(e)),n=(0,j.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 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}}(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 wi=n(4563),Si={};Si.styleTagTransform=b(),Si.setAttributes=g(),Si.insert=p().bind(null,"head"),Si.domAPI=d(),Si.insertStyleElement=v(),s()(wi.Z,Si);const Oi=wi.Z&&wi.Z.locals?wi.Z.locals:void 0;function Di(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(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){Di(e,t,n[t])}))}return e}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}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 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}}(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 Ui=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t,u=Pi((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=Je(d).items,A=wt().stockLocations,g=St({v:U.Default}),f=g.items,v=(g.isError,g.isLoading,Pi((0,i.useState)(Ti({enabled:!0},o)),2)),_=v[0],b=v[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){o.dateCreated,o.creatorGivenName,o.creatorFamilyName;var e=Ti({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(o,["dateCreated","creatorGivenName","creatorFamilyName"]));b(e)}}),[o]);var h=(0,i.useCallback)((function(e){e.preventDefault(),o&&(_.uuid=o.uuid),c&&(_.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:xi({},e)})}(_).then((function(){(0,r.showToast)({critical:!0,title:s("addedRule","Add Rule"),kind:"success",description:s("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[_,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:Oi.section},l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==_?void 0:_.locationUuid)?_.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.id===e.target.value}));b(Bi(Ti({},_),{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:Oi.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),b(Bi(Ti({},_),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==_?void 0:_.stockItemPackagingUOMUuid)?_.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));b(Bi(Ti({},_),{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:Oi.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)),b(Bi(Ti({},_),{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:Oi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==_?void 0:_.alertRole)?_.alertRole:"",onChange:function(e){var t=null==f?void 0:f.results.find((function(t){return t.display===e.target.value}));b(Bi(Ti({},_),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==f||null===(t=f.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:Oi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==_?void 0:_.mailRole)?_.mailRole:"",onChange:function(e){var t=null==f?void 0:f.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),b(Bi(Ti({},_),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==f||null===(n=f.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:Oi.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)),b(Bi(Ti({},_),{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)),b(Bi(Ti({},_),{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:Oi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enabled);b(Bi(Ti({},_),{enabled:n}))},checked:null==_?void 0:_.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:Oi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enableDescendants);b(Bi(Ti({},_),{enableDescendants:n}))},name:"appliesToChildren",checked:null==_?void 0:_.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:Q},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},ji=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Ui,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var zi=n(4907),Fi={};Fi.styleTagTransform=b(),Fi.setAttributes=g(),Fi.insert=p().bind(null,"head"),Fi.domAPI=d(),Fi.insertStyleElement=v(),s()(zi.Z,Fi);const Li=zi.Z&&zi.Z.locals?zi.Z.locals:void 0;function Ri(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 Mi=function(e){var t,n=e.stockItemUuid,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(z(e)),n=(0,j.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:Li.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Ri(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 Ri(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)?Ri(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 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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hi=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 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}}(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.showToast)({critical:!0,title:c("deletingRule","Delete Rule"),kind:"success",description:c("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingRule', 'error deleting a rule"),kind:"error",critical:!0,description: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(Ht.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){Gi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};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 Yi=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Ui,{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(mt.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){Zi(e,t,n[t])}))}return e}({size:16},e))}})};function Qi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ji(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){Qi(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}const Vi=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t),o=Ei({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 Wi(Ji({},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:V(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:V(null==e?void 0:e.lastActionDate),nextActionDate:V(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Yi,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Hi,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:jn.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:jn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Mi,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(ji,{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,Wi(Ji({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jn.desktopHeader:jn.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,Ji({className:r.isDesktop?jn.desktopRow:jn.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:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("div",{className:jn.tileContent},l().createElement("p",{className:jn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:jn.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:jn.paginationOverride}))};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 Xi(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.")}()}function $i(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){return function(e){if(Array.isArray(e))return $i(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 $i(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)?$i(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 tl=function(e){var t=Nt((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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)?el(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(el(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 nl=sr.z.object({id:sr.z.string().nullish(),uuid:sr.z.string().nullish(),stockItemUuid:sr.z.string().nullish(),packagingUomName:sr.z.string().nullish(),packagingUomUuid:sr.z.string().nullish(),factor:sr.z.coerce.number().nullish(),isDefaultStockOperationsUoM:sr.z.boolean().nullish(),isDispensingUnit:sr.z.boolean().nullish()});const rl=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:Ht.ZN,onClick:n}))};var ol=n(4158),al={};al.styleTagTransform=b(),al.setAttributes=g(),al.insert=p().bind(null,"head"),al.domAPI=d(),al.insertStyleElement=v(),s()(ol.Z,al);const il=ol.Z&&ol.Z.locals?ol.Z.locals:void 0;function ll(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){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){cl(e,t,n[t])}))}return e}function ul(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 dl=function(e){var t=e.stockItemUuid,n=e.handleTabChange,o=function(e){var t=Xi((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Xi((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=Je(n),s=c.items,u=c.isLoading,d=c.isError;return{items:s.results,totalCount:s.totalCount,isLoading:u,isError:d,setStockItemUuid:l}}(),c=o.items,s=o.isLoading,u=o.setStockItemUuid;(0,i.useEffect)((function(){u(t)}),[t,u]);var d,m=(0,E.useTranslation)().t,p=(0,i.useMemo)((function(){return[{key:"packaging",header:m("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:m("packSize","Pack Size"),styles:{width:"50%"}},{key:"action",header:m("action","Actions"),styles:{width:"50%"}}]}),[m]),A=(0,lr.cI)({defaultValues:{},mode:"all",resolver:(0,cr.F)(nl)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(lr.RV,A,l().createElement(a.wQF,{rows:(d=c,function(e){if(Array.isArray(e))return ll(e)}(d)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(d)||function(e,t){if(e){if("string"==typeof e)return ll(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)?ll(e,t):void 0}}(d)||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.")}()).concat([{}]),headers:p,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:il.packagingTableContainer},l().createElement(a.iA_,ul(sl({},r()),{className:il.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,ul(sl({},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:il.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(ml,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(ml,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=A.getValues,o=A.setValue,a=e(),i={factor:a.factor,packagingUomUuid:a.packagingUomUuid,stockItemUuid:t},l={startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:t},c="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(z(l));(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})})(i).then((function(){ce(c),(0,r.showSnackbar)({title:m("savePackingUnitTitle","Package Unit"),subtitle:m("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"}),o("factor",0)}),(function(){(0,r.showSnackbar)({title:m("savePackagingUnitErrorTitle","Package Unit"),subtitle:m("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})),n(0)},kind:"primary",renderIcon:vo.vc},m("save","Save")))};var ml=function(e){var t=e.isEditing,n=e.row,r=e.key,o=(0,lr.Gc)(),i=o.control,c=o.formState.errors;return l().createElement(l().Fragment,null,l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(tl,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",control:i,invalid:!!c.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement("div",{className:il.packingTableCell},l().createElement(ci,{row:n,controllerName:"factor",name:"factor",min:0,control:i,id:"".concat(n.uuid,"-").concat(r),invalid:!!c.factor,hideSteppers:!0}),l().createElement(rl,{closeModal:function(){return!0},row:n})))))};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 Al(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 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}}(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 gl=n(3162),fl=n(4655),vl={};vl.styleTagTransform=b(),vl.setAttributes=g(),vl.insert=p().bind(null,"head"),vl.domAPI=d(),vl.insertStyleElement=v(),s()(fl.Z,vl);const _l=fl.Z&&fl.Z.locals?fl.Z.locals:void 0;function bl(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,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yl(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)||kl(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 kl(e,t){if(e){if("string"==typeof e)return bl(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)?bl(e,t):void 0}}const Cl=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=yl((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=yl((0,i.useState)(n),1)[0],b=[10,20,30,40,50],h=yl((0,i.useState)(10),2),y=h[0],k=h[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,O=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){hl(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 D=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,gl.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,gl.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 bl(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||kl(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:_l.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:_l.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:mt.rT,iconDescription:"Download As",focusTrap:!1},l().createElement(a.laM,{itemText:"Download As CSV",onClick:D}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:D}),l().createElement(a.laM,{itemText:"Download As Json",onClick:D})),l().createElement(a.Ys1,{className:_l.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:_l.tileContainer},l().createElement(a.n9L,{className:_l.tile},l().createElement("div",{className:_l.tileContent},l().createElement("p",{className:_l.content},m("No data","No data to display")),l().createElement("p",{className:_l.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:O,pageSize:y,pageSizes:b,totalItems:c||(null==_?void 0:_.length),className:_l.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==O){if(s)return void s(n);w(n)}}})))})))},El=function(e){var t=(0,E.useTranslation)().t,n=wt().stockLocations;return l().createElement(lr.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 wl(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 Sl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ol(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){Sl(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 xl(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 wl(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)?wl(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 Nl=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=xl((0,i.useState)(),2),c=o[0],s=o[1],u=function(e){var t=Al((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=Al((0,i.useState)(10),2),l=a[0],c=a[1],s=Al((0,i.useState)(null),2),u=s[0],d=s[1],m=Al((0,i.useState)(1),2),p=m[0],A=m[1],g=Al((0,i.useState)(null==e?void 0:e.stockItemUuid),2),f=g[0],v=g[1],_=Al((0,i.useState)(null==e?void 0:e.partyUuid),2),b=_[0],h=_[1],y=Al((0,i.useState)(null==e?void 0:e.locationUuid),2),k=y[0],C=y[1],E=Al((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:b,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,b,k,w]);var O=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemtransaction").concat(z(e)),n=(0,j.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),D=O.items,x=O.isLoading,N=O.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:D.results,totalCount:D.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:h,setStockBatchUuid:S}}(c),d=u.isLoading,m=u.items,p=u.tableHeaders,A=u.totalCount,g=u.setCurrentPage,f=u.setStockItemUuid,v=u.setLocationUuid,_=xl((0,i.useState)(null),2),b=(_[0],_[1],xl((0,i.useState)(null),2));b[0],b[1],(0,i.useEffect)((function(){f(t)}),[t,f]);var h,y=(0,lr.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 Dl(Ol({},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:V(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(he.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(he.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(V(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(Ra,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:h}):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,h]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(Cl,{children:function(){return l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement(El,{onLocationIdChange:function(e){v(e),s(Dl(Ol({},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})},Il=function(e){var t=(0,E.useTranslation)().t,n=wt().stockLocations;return l().createElement(lr.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 Tl(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 Bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pl(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}function Ul(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 jl=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 Tl(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)?Tl(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=to(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,lr.cI)({}).control;(0,i.useEffect)((function(){g(r)}),[r,g]);var b=(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]),h=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n,r,o,a,i;return Ul(Pl({},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:V(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(Cl,{children:function(){return l().createElement(l().Fragment,null,l().createElement(Il,{control:_,onLocationIdChange:function(e){f(e),s(Ul(Pl({},c),{locationUuid:e}))},placeholder:v("filterByLocation","Filter by Location"),name:"BatchLocationUuid",controllerName:"BatchLocationUuid"}))},columns:b,data:h,totalItems:p,goToPage:A,hasToolbar:!0})};function zl(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 Fl(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 zl(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)?zl(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 Ll(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Rl=function(e){var t=e.stockItemUuid,n=function(e){var t=Fl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Fl((0,i.useState)(10),2),a=o[0],l=o[1],c=Fl((0,i.useState)(null),2),s=c[0],u=c[1],d=Fl((0,i.useState)(1),2),m=d[0],p=d[1],A=Fl((0,i.useState)(),2),g=A[0],f=A[1],v=Fl((0,i.useState)(),2),_=v[0],b=v[1],h=Fl((0,i.useState)(),2),y=h[0],k=h[1],C=Fl((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,O=Ye(n),D=O.items,x=O.isLoading,N=O.isError;return{items:null!==(S=D.results)&&void 0!==S?S:[],totalCount:D.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:b,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){Ll(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:V(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(Cl,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1})};var Ml=n(501),ql={};ql.styleTagTransform=b(),ql.setAttributes=g(),ql.insert=p().bind(null,"head"),ql.domAPI=d(),ql.insertStyleElement=v(),s()(Ml.Z,ql);const Gl=Ml.Z&&Ml.Z.locals?Ml.Z.locals:void 0,Hl=function(e){var t=tn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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 Zl(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 Yl(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 Zl(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)?Zl(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 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){e.isEditing;var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=function(e){var t=Yl((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=Yl((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(z(e)),n=(0,j.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,lr.cI)({defaultValues:{},mode:"all",resolver:(0,cr.F)(ai)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(lr.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:Gl.referencesTableContainer},l().createElement(a.iA_,Wl(Jl({},r()),{className:Gl.referencesTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,Wl(Jl({},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:Gl.referencesTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(Kl,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(Kl,{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(){ce("".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){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"));var t=le(e);(0,r.showSnackbar)({title:n("saveStockItemReferenceErrorTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceErrorMessage","Error saving stock item reference"+t.join(",")),kind:"error"})}))},kind:"primary",renderIcon:vo.vc},n("save","Save")))};var Kl=function(e){var t,n=e.isEditing,o=e.row,i=e.key,c=(0,E.useTranslation)().t,s=(0,lr.Gc)(),u=s.control,d=(s.formState.errors,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=le(e);(0,r.showSnackbar)({title:c("deleteStockItemReferenceTitle","Error Deleting a stockitem reference"),kind:"error",subtitle:t.join(",")})}))});return l().createElement(a.SCH,null,l().createElement(a.pj1,null,n?l().createElement(Hl,{row:o,name:"references",controllerName:"references",control:u,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:Gl.referencesTableCell},l().createElement(wr,{id:"".concat(o.uuid,"-").concat(i),name:"code",control:u,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:Ht.ZN,onClick:function(e){return d(e)}}))))};function Xl(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 $l=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 Xl(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)?Xl(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(ki,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(dl,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(Nl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(jl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(Rl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Rules"),component:l().createElement(Vi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("references","References"),component:l().createElement(Vl,{stockItemUuid:o.uuid,isEditing:r}),disabled:!r}];return l().createElement(Qn,{onChange:m,tabs:p,selectedIndex:u})};function ec(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 tc=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){ec(a,r,o,i,l,"next",e)}function l(e){ec(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?Ke:Ve)(e)];case 2:return(null==(n=s.sent())?void 0:n.data)&&((0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Item"),kind:"success",description:"Stock Item ".concat(t?"Edited":"Added"," Successfully")}),t||(Q(),(o=n.data).isDrug=!!o.drugUuid,nc(o,!0))),[3,4];case 3:return a=s.sent(),(0,r.showNotification)({title:"Error ".concat(t?"edit":"add","ing a stock item"),kind:"error",critical:!0,description: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)}}(),nc=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Y("".concat(t?"Edit":"Add"," ").concat((null==e?void 0:e.drugName)||""),l().createElement($l,{model:e,onSave:function(e){return tc(e,t)},isEditing:t}))};const rc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){nc(Xa,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var oc=n(1048),ac={};ac.styleTagTransform=b(),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,lc=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:ic.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 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 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.")}()}const uc=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"))},dc=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,nc(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};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=(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 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(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem"))},d=function(e){(0,E.useTranslation)().t;var t=sc((0,i.useState)(1),2),n=t[0],o=t[1],a=sc((0,i.useState)(10),2),l=a[0],c=a[1],s=sc((0,i.useState)(null),2),u=s[0],d=s[1],m=sc((0,i.useState)(""),2),p=m[0],A=m[1],g=sc((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:l,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=Ze(f),b=_.items,h=_.isLoading,y=_.isError,k=(0,r.usePagination)(b.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:b.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:h,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,b=d.setCurrentPage,h=d.isDrug,y=d.setDrug,k=d.setSearchString,C=br((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 gc(Ac({},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(dc,{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,nc(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(mt.I8,Ac({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(lc,{filterType:h,changeFilterType:y}),l().createElement(uc,null),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(rc,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,gc(Ac({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jn.desktopHeader:jn.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,gc(Ac({className:r.isDesktop?jn.desktopRow:jn.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:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("div",{className:jn.tileContent},l().createElement("p",{className:jn.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:jn.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;b(t),f(n)},className:jn.paginationOverride}))},vc=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(fc,null))},_c=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function bc(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 yc(){return yc=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;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=le(n),(0,r.showToast)({description:o.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))})),yc.apply(this,arguments)}var kc=n(2761),Cc={};Cc.styleTagTransform=b(),Cc.setAttributes=g(),Cc.insert=p().bind(null,"head"),Cc.domAPI=d(),Cc.insertStyleElement=v(),s()(kc.Z,Cc);const Ec=kc.Z&&kc.Z.locals?kc.Z.locals:void 0;function wc(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 Sc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oc(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}function Dc(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 wc(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)?wc(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 xc=sr.z.object({name:sr.z.string().max(255)});const Nc=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,_=Dc((0,i.useState)(!1),2),b=_[0],h=_[1],y=Dc((0,i.useState)(""),2),k=y[0],C=y[1],w=(o="".concat(r.restBaseUrl,"/locationtag/"),s=(c=(0,j.ZP)(o,r.openmrsFetch)).data,c.error,u=c.isLoading,c.isValidating,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,lr.cI)({mode:"all",resolver:(0,cr.F)(xc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),O=S.handleSubmit,D=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:O((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};xc.safeParse(e).success&&(h(!1),A(i))}),(function(e){C(Object.entries(e)[0][1].message),h(!0)}))},l().createElement(a.fef,{hasScrollingContent:!0},l().createElement(a.Kqy,{gap:3},l().createElement(a.cwH,{legendText:""},l().createElement(lr.Qr,{name:"name",control:D,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,Oc({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:Ec.loaderContainer},l().createElement(lr.Qr,{name:"tags",control:D,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=Oc({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))}}))),b&&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 h(!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"))))))},Ic=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 yc.apply(this,arguments)})({locationPayload:{name:t,tags:i}}).then((function(){(0,r.showToast)({title:a("formCreated","Add Location"),kind:"success",critical:!0,description:a("Location ".concat(t," was created successfully."))}),o(),n(!1)})).catch((function(e){(0,r.showNotification)({title:a("errorCreatingForm","Error creating location"),kind:"error",critical:!0,description:null==e?void 0:e.message}),n(!1)})),n(!1)}),[n,o,a]);return l().createElement(l().Fragment,null,l().createElement(Nc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};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}function Bc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Pc=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 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}}(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=wt(),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 bc(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)?bc(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(){ce("".concat(r.restBaseUrl,"/Location?_summary=data"))};return A?l().createElement(a.gqd,{role:"progressbar"}):(null==p?void 0:p.length)?l().createElement(Cl,{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(Ic,{onModalChange:s,showModal:c,mutate:j.JG}):null,l().createElement(a.zxk,{kind:"ghost",renderIcon:function(e){return l().createElement(he.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){Bc(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("p",{className:jn.content},"No stock items to display")))},Uc=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Pc,null))};var jc=n(557),zc={};zc.styleTagTransform=b(),zc.setAttributes=g(),zc.insert=p().bind(null,"head"),zc.domAPI=d(),zc.insertStyleElement=v(),s()(jc.Z,zc);const Fc=jc.Z&&jc.Z.locals?jc.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}var Rc,Mc=sr.z.object({startDate:sr.z.coerce.date().optional(),endDate:sr.z.coerce.date().optional(),location:sr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:sr.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:sr.z.string().optional(),mostLeastMoving:sr.z.string().optional(),mostLeastMovingName:sr.z.string().optional(),stockItemUuid:sr.z.string().optional(),stockItemName:sr.z.string().optional(),patientUuid:sr.z.string().optional(),patientName:sr.z.string().optional(),locationUuid:sr.z.string().optional(),childLocations:sr.z.boolean().optional(),stockSourceUuid:sr.z.string().optional(),stockSource:sr.z.string().optional(),stockSourceDestinationUuid:sr.z.string().optional(),stockSourceDestination:sr.z.string().optional(),inventoryGroupBy:sr.z.string().optional(),stockItemCategory:sr.z.string().optional(),inventoryGroupByName:sr.z.string().optional(),stockItemCategoryConceptUuid:sr.z.string().optional(),reportSystemName:sr.z.string().optional(),maxReorderLevelRatio:sr.z.number().optional(),fullFillment:sr.z.string().array().optional(),limit:sr.z.string().optional(),date:sr.z.coerce.date().optional()}).superRefine((function(e,t){"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName&&(e.startDate||t.addIssue({code:sr.z.ZodIssueCode.custom,message:"Start Date is required ",path:["startDate"]}),e.endDate||t.addIssue({code:sr.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:sr.z.ZodIssueCode.custom,message:"Date is required ",path:["date"]}),e.inventoryGroupBy||t.addIssue({code:sr.z.ZodIssueCode.custom,message:"Inventory by is required ",path:["inventoryGroupBy"]}))}));function qc(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"}(Rc||(Rc={}));var Gc=function(e){return Hc(e)?4:e?20:null},Hc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Zc="Completed";function Yc(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 Qc(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 Jc(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)||Vc(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 Wc(e){return function(e){if(Array.isArray(e))return Yc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Vc(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 Vc(e,t){if(e){if("string"==typeof e)return Yc(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)?Yc(e,t):void 0}}const Kc=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,j.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=wt().stockLocations,v=Nt(m),_=v.items,b=(v.isLoading,Jc((0,i.useState)(!1),2)),h=b[0],y=b[1],k=Jc((0,i.useState)(!1),2),C=k[0],w=k[1],S=Jc((0,i.useState)(!1),2),O=S[0],D=S[1],x=Jc((0,i.useState)(!1),2),N=x[0],I=x[1],T=Jc((0,i.useState)(!1),2),B=T[0],P=T[1],U=Jc((0,i.useState)(!1),2),z=U[0],F=U[1],L=Jc((0,i.useState)(!1),2),R=L[0],M=L[1],q=Jc((0,i.useState)(!1),2),G=q[0],H=q[1],Z=Jc((0,i.useState)(!1),2),Y=Z[0],J=Z[1],W=Jc((0,i.useState)(!1),2),te=W[0],ne=W[1],re=Jc((0,i.useState)(!1),2),oe=re[0],ae=re[1],ie=Jc((0,i.useState)(!1),2),le=ie[0],ce=ie[1],se=Jc((0,i.useState)(!1),2),ue=se[0],de=se[1],me=Jc((0,i.useState)(!1),2),pe=me[0],Ae=me[1],ge=Jc((0,i.useState)(!1),2),fe=ge[0],ve=ge[1],_e=Jc((0,i.useState)(""),2),be=_e[0],he=_e[1];(0,i.useEffect)((function(){var e=!1;if(be){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===be}));v&&(y(null===(t=v.parameters)||void 0===t?void 0:t.some((function(e){return e===Rc.Date}))),w(null===(n=v.parameters)||void 0===n?void 0:n.some((function(e){return e===Rc.StartDate}))),D(null===(r=v.parameters)||void 0===r?void 0:r.some((function(e){return e===Rc.EndDate}))),I(null===(o=v.parameters)||void 0===o?void 0:o.some((function(e){return e===Rc.StockItemCategory}))),P(null===(a=v.parameters)||void 0===a?void 0:a.some((function(e){return e===Rc.Location}))),F(null===(i=v.parameters)||void 0===i?void 0:i.some((function(e){return e===Rc.ChildLocations}))),M(null===(l=v.parameters)||void 0===l?void 0:l.some((function(e){return e===Rc.StockSource}))),H(null===(c=v.parameters)||void 0===c?void 0:c.some((function(e){return e===Rc.StockSourceDestination}))),J(null===(s=v.parameters)||void 0===s?void 0:s.some((function(e){return e===Rc.InventoryGroupBy}))),ne(null===(u=v.parameters)||void 0===u?void 0:u.some((function(e){return e===Rc.MaxReorderLevelRatio}))),ce(null===(d=v.parameters)||void 0===d?void 0:d.some((function(e){return e===Rc.StockItem}))),ae(null===(m=v.parameters)||void 0===m?void 0:m.some((function(e){return e===Rc.Patient}))),de(null===(p=v.parameters)||void 0===p?void 0:p.some((function(e){return e===Rc.Limit}))),Ae(null===(g=v.parameters)||void 0===g?void 0:g.some((function(e){return e===Rc.MostLeastMoving}))),ve(null===(f=v.parameters)||void 0===f?void 0:f.some((function(e){return e===Rc.Fullfillment}))),e=!0)}e||(y(!1),w(!1),D(!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))}),[be,A]);var ye=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Wc(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,lr.cI)({mode:"all",resolver:(0,cr.F)(Mc)}),Ce=ke.handleSubmit,Ee=ke.control,we=ke.formState,Se=we.errors,Oe=(we.defaultValues,we.isDirty,ke.setValue);if(g)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var De=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){Qc(a,r,o,i,l,"next",e)}function l(e){Qc(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,_,b,y,k,E,w,S,D,x,I,T,P,U,j,F,L,M,q,H,Z,J,W,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(Rc.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(Rc.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(Rc.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(Rc.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)),Y&&(a+=xe(Rc.InventoryGroupBy,null!==(y=e.inventoryGroupBy)&&void 0!==y?y:"LocationStockItemBatchNo",null!==(k=null===(b=e.inventoryGroupByName)||void 0===b?void 0:b.trim())&&void 0!==k?k:"Stock Item Batch Number",d("stockmanagement.report.edit.inventorygroupby"),o)),B&&(a+=xe(Rc.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(Rc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",d("Include Child Locations"),o))),te&&(a+=xe(Rc.MaxReorderLevelRatio,(null!==(S=e.maxReorderLevelRatio)&&void 0!==S?S:0).toString(),(null!==(D=e.maxReorderLevelRatio)&&void 0!==D?D:0).toString()+"%",d("stockmanagement.report.edit.maxreorderlevelratio"),o)),R&&(a+=xe(Rc.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(Rc.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(Rc.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(Rc.Limit,(null!==(H=null!==(q=e.limit)&&void 0!==q?q:Gc(e.reportSystemName))&&void 0!==H?H:20).toString(),(null!==(J=null!==(Z=e.limit)&&void 0!==Z?Z:Gc(e.reportSystemName))&&void 0!==J?J:20).toString(),d(function(e){return Hc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),o)),h&&(a+=xe(Rc.Date,e.date?JSON.stringify(e.date).replaceAll('"',""):"",null!==(W=V(e.date))&&void 0!==W?W:"",d("stockmanagement.report.edit.date"),o)),C&&(a+=xe(Rc.StartDate,e.startDate?JSON.stringify(e.startDate).replaceAll('"',""):"",null!==(K=V(e.startDate))&&void 0!==K?K:"",d(function(e){return Hc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),o)),O&&(a+=xe(Rc.EndDate,e.endDate?JSON.stringify(e.endDate).replaceAll('"',""):"",null!==(X=V(e.endDate))&&void 0!==X?X:"",d(function(e){return Hc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),o)),[4,qc({batchJobType:"Report",description:e.reportName,parameters:a}).then((function(e){Q(),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(De,(function(e){console.error(e)}))},l().createElement("div",{className:Fc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,d("reportName","Report")),l().createElement(lr.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,he(n)}})}})),N&&l().createElement(l().Fragment,null,l().createElement("span",null,d("stockItemCategory","Stock Item Category")),l().createElement(lr.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(lr.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:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:K,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}))}}),O&&l().createElement(lr.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:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:K,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}))}}),Y&&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 Oe("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 Oe("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(lr.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(lr.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(lr.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(lr.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?Wc(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?Wc(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?Wc(r.filter((function(e){return"All"!==e}))).concat(["None"]):r.filter((function(e){return"None"!==e})))},labelText:d("noneFulfillment","Non Fulfillment")}))}})),h&&l().createElement(lr.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:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"date",name:"date",placeholder:K,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:Fc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Q},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},d("continue","Continue"))))},Xc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("New Report",l().createElement(Kc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var $c=n(5861),es={};es.styleTagTransform=b(),es.setAttributes=g(),es.insert=p().bind(null,"head"),es.domAPI=d(),es.insertStyleElement=v(),s()($c.Z,es);const ts=$c.Z&&$c.Z.locals?$c.Z.locals:void 0;var ns=n(6811),rs=n(3570);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}const ls=function(){var e=(0,E.useTranslation)().t,t=function(){ce("".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,j.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 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}}(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,b=v.results,h=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:b,totalItems:null==d||null===(o=d.data)||void 0===o||null===(n=o.results)||void 0===n?void 0:n.length,currentPage:h,currentPageSize:g,paginatedItems:b,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,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"}]}),[]),f=(0,i.useCallback)((function(e,t){e&&window.open(function(e,t){return"".concat(ae,"ws/rest/v1/stockmanagement/batchjobartifact?id=").concat(e).concat("&download=1")}(e),"_blank")}),[]),v=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o;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:(o=e.dateCreated,o?W()(o).format("DD-MMM-YYYY HH:mm"):""),parameters:"",report:e.description,requestedBy:null==e||null===(n=e.owners)||void 0===n?void 0:n.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(lt.Od,{className:"report-failed",title:e.status}),"Cancelled"===e.status&&l().createElement(ns.mg,{className:"report-cancelled",title:e.status}),e.status===Zc&&l().createElement(No.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(rs.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:Ht.G7}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Copy",kind:"ghost",renderIcon:be.CK}),(null==e?void 0:e.status)===Zc&&(null!==(r=e.outputArtifactSize)&&void 0!==r?r:0)>0&&l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Download",kind:"ghost",renderIcon:mt.UW,onClick:function(){return f(e.uuid,e.outputArtifactFileExt)}}))})}))}),[o,f]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:ts.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:v,headers:g,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:ts.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:t},"Refresh")),l().createElement(Xc,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?ts.desktopHeader:ts.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?ts.desktopRow:ts.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:ts.tileContainer},l().createElement(a.n9L,{className:ts.tile},l().createElement("div",{className:ts.tileContent},l().createElement("p",{className:ts.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:ts.helper},e("checkFilters","Check the filters above"))))):null)}}),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:ts.paginationOverride}))};function cs(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 ss="@openmrs/esm-stock-management-app",us={featureName:"stock-management",moduleName:ss},ds=n(3979),ms=(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(he.ol,{size:16}))))}),us),ps=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),us),As=(0,r.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Pe.BrowserRouter,{basename:e},l().createElement("div",{className:Oe.container},l().createElement(Be,null),l().createElement("div",null,l().createElement(_e,null),l().createElement(Pe.Routes,null,l().createElement(Pe.Route,{path:"overview",element:l().createElement(gt,null)}),l().createElement(Pe.Route,{path:"",element:l().createElement(gt,null)}),l().createElement(Pe.Route,{path:"stock-items",element:l().createElement(vc,null)}),l().createElement(Pe.Route,{path:"stock-operations",element:l().createElement(Ka,null)}),l().createElement(Pe.Route,{path:"stock-user-scopes",element:l().createElement(Xt,null)}),l().createElement(Pe.Route,{path:"stock-sources",element:l().createElement(In,null)}),l().createElement(Pe.Route,{path:"stock-locations",element:l().createElement(Uc,null)}),l().createElement(Pe.Route,{path:"stock-reports",element:l().createElement(ls,null)}),l().createElement(Pe.Route,{path:"stock-settings",element:l().createElement(_c,null)}))),l().createElement(Ee,null)))}),us),gs=(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=de((0,i.useState)(""),2),A=p[0],g=p[1],f=de((0,i.useState)(!1),2),v=f[0],_=f[1],b=(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(),Q(),ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))}),(function(e){_(!1);var t=le(e);(0,r.showSnackbar)({title:m("errorDescriptionTitle","Error on saving form"),subtitle:m("errorDescription",t.join(", ")),kind:"error"}),u(),Q()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){ue(a,r,o,i,l,"next",e)}function l(e){ue(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:b},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:P.modalBody},l().createElement("section",{className:P.section},l().createElement("h5",{className:P.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:P.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")))))}),us),fs=(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:I.productiveHeading03},o("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.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:ss}),vs=(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:I.productiveHeading03},o("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.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:ss}),_s=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.row,c=e.closeModal,s=(0,E.useTranslation)().t,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 cs(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)?cs(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];return l().createElement("div",null,l().createElement(a.xBx,{closeModal:c,className:il.productiveHeading03},s("removePackagingUnit","Remove Packaging Unit"),"?"),l().createElement(a.fef,null,l().createElement("span",null,s("removePackagingUnitConfirmation","Would you really like to remove the packaging unit ".concat(null==o?void 0:o.packagingUomName," from the stock item?"))),l().createElement(a.Kx8,{id:"reason",labelText:s("reasonLabel","Please explain the reason:"),onChange:function(e){m(e.target.value)},maxLength:500,placeholder:s("reasonPlaceholder","Enter reason here")})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:c},s("no","No")),l().createElement(a.zxk,{kind:"danger",type:"submit",onClick:function(e){var t,n,a;e.preventDefault(),(t=o.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showToast)({critical:!0,title:s("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:s("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showNotification)({title:s("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))},disabled:d.length<1},s("yes","Yes"))))}),{featureName:"delete-packaging-unit-modal",moduleName:ss}),bs=(0,r.getSyncLifecycle)(rl,{featureName:"delete-packging-unit-button",moduleName:ss}),hs=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=D((0,i.useState)(),2),c=o[0],s=o[1],u=D((0,i.useState)(!0),2),d=u[0],m=(u[1],D((0,i.useState)(!0),2)),p=(m[0],m[1]);return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:t,title:n("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?(s(r),p(!1)):e.preventDefault()},onDelete:function(){p(!0)}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:t},n("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(c){var e=new FormData;c&&(e.append("file",c,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,r.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,r.showNotification)({title:n("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}}},n("uploadStockItems","Upload StockItems")))))}),us),ys=(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"))}),us);function ks(){(0,r.defineConfigSchema)(ss,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([[699],{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;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,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,wBD5BM,CC6BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCaS,CDRX,oEDLA,wBAAA,CACA,gCAAA,CCQA,oHACE,UD/CI,CCmDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDtDM,CCuDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEiyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF/xBF,cAAA,CACA,aDhEM,CCmER,qDACE,qBDjEc,CCkEd,aDrEM,CCsEN,YDtEM,CC2EN,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},1940:(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__side-nav__heading___vgtlj{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__side-nav__heading___vgtlj:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__side-nav__mainContainer___ogiHY{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__side-nav__title___nb7UC{padding:1rem;font-size:1.2rem}.-esm-stock-management__side-nav__desktopContainer___K7J5p{width:50%}.-esm-stock-management__side-nav__tabletContainer___qoyDq{width:90%}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tab-content{width:100% !important;overflow-x:hidden;padding:0}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tab--list{flex-direction:column}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link:active,.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__side-nav__cohortBuilder___abPYF .cds--col{padding-left:0;width:100%}.-esm-stock-management__side-nav__tabletTab___yprNw{width:25%}.-esm-stock-management__side-nav__desktopTab___nnk6h{width:20%}.-esm-stock-management__side-nav__tab___LsplX{display:flex}.-esm-stock-management__side-nav__tabContainer___sofYJ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__side-nav__optionCell___M_ykV{padding:0 !important}.-esm-stock-management__side-nav__optionHeader___KGdwI{width:1.5rem !important}.-esm-stock-management__side-nav__text___Q29fa{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/side-nav/side-nav.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,kDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHpBb,wDACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,wDACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,gDACE,YAAA,CACA,gBAAA,CAGF,2DACE,SAAA,CAGF,0DACE,SAAA,CAIA,4HACE,UAAA,CAGF,0EACE,qBAAA,CACA,iBAAA,CACA,SAAA,CAGF,wEACE,qBAAA,CAGF,mEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,0EACE,WAAA,CACA,eAAA,CAGF,wFACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,kGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,6EAME,eAAA,CALA,uKACE,oBAAA,CACA,2BAAA,CAMJ,kEACE,cAAA,CACA,UAAA,CAIJ,oDACE,SAAA,CAGF,qDACE,SAAA,CAGF,8CACE,YAAA,CAGF,uDACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,qDACE,oBAAA,CAGF,uDACE,uBAAA,CAGF,+CACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__side-nav__heading___vgtlj",mainContainer:"-esm-stock-management__side-nav__mainContainer___ogiHY",title:"-esm-stock-management__side-nav__title___nb7UC",desktopContainer:"-esm-stock-management__side-nav__desktopContainer___K7J5p",tabletContainer:"-esm-stock-management__side-nav__tabletContainer___qoyDq",cohortBuilder:"-esm-stock-management__side-nav__cohortBuilder___abPYF",tabletTab:"-esm-stock-management__side-nav__tabletTab___yprNw",desktopTab:"-esm-stock-management__side-nav__desktopTab___nnk6h",tab:"-esm-stock-management__side-nav__tab___LsplX",tabContainer:"-esm-stock-management__side-nav__tabContainer___sofYJ",optionCell:"-esm-stock-management__side-nav__optionCell___M_ykV",optionHeader:"-esm-stock-management__side-nav__optionHeader___KGdwI",text:"-esm-stock-management__side-nav__text___Q29fa"};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;overflow-x:hidden;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,iBAAA,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},6919:(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-management-dashboard__container___r_M20{display:"grid";grid-template-columns:16rem auto}.-esm-stock-management__stock-management-dashboard__container___r_M20>div{margin-left:16rem}',"",{version:3,sources:["webpack://./src/dashboard/stock-management-dashboard.scss"],names:[],mappings:"AAAA,sEACE,cAAA,CACA,gCAAA,CAEA,0EACE,iBAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-management-dashboard__container___r_M20"};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{min-height:15rem;display:block}.-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}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:"AAGA,8DACI,gBAAA,CACA,aAAA,CAGJ,kEACI,YAAA,CACA,kBAAA,CAGJ,oEACI,gBCyDS,CDtDb,yEACI,gBAAA,CACA,aAAA,CAGJ,+DACI,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,6HACI,eAAA,CAOK,gJACG,eAAA,CAMhB,eACI,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"};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},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},1280:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deletePackagingUnitButton:()=>hs,deletePackagingUnitModal:()=>bs,deleteStockModal:()=>vs,deleteUserScopeModal:()=>_s,importBulkStockItemsDialog:()=>ys,importTranslation:()=>ms,startupApp:()=>Cs,stockManagement:()=>As,stockManagementAdminCardLink:()=>ps,stockManagementAppMenuItem:()=>ks,stockManagementDashboard:()=>gs,stockOperationDialog:()=>fs});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"}},a=n(8827),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),b=n.n(_),h=n(7813),y={};y.styleTagTransform=b(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(h.Z,y);const k=h.Z&&h.Z.locals?h.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 O(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 D(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 O(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)?O(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 x=n(49),N={};N.styleTagTransform=b(),N.setAttributes=g(),N.insert=p().bind(null,"head"),N.domAPI=d(),N.insertStyleElement=v(),s()(x.Z,N);const I=x.Z&&x.Z.locals?x.Z.locals:void 0;var T=n(1256),B={};B.styleTagTransform=b(),B.setAttributes=g(),B.insert=p().bind(null,"head"),B.domAPI=d(),B.insertStyleElement=v(),s()(T.Z,B);const P=T.Z&&T.Z.locals?T.Z.locals:void 0;var U,j=n(9820);function F(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(F(e)),n=(0,j.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 L(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function R(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 M(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 q=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 G(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 H={isOverlayOpen:!1,component:Function,header:""},Z=function(){return(0,r.getGlobalStore)("dispensing-store",H)},Y=function(e,t){Z().setState({isOverlayOpen:!0,component:t,header:e})},Q=function(){Z().setState({component:null,isOverlayOpen:!1})},J=n(2653),W=n.n(J),V=function(e,t){return e?W()(e).format(null!=t?t:"DD-MMM-YYYY"):""},K=("".concat(window.getOpenmrsSpaBase),W()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),X="d/m/Y",$=function(e){return V(e,K)},ee=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},te=Object.freeze({SOURCES:"Sources",OPERATION:"Operation",STATUS:"Status"}),ne="moduleResources/stockmanagement/assets/print-logo.svg",re="Ministry of Health",oe="Main Store",ae="/openmrs/",ie=!0;function le(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(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var ce=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function se(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 ue(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 de(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 se(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)?se(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 me=n(965),pe={};pe.styleTagTransform=b(),pe.setAttributes=g(),pe.insert=p().bind(null,"head"),pe.domAPI=d(),pe.insertStyleElement=v(),s()(me.Z,pe);const Ae=me.Z&&me.Z.locals?me.Z.locals:void 0,ge=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 fe=n(9375),ve=n(2411),_e=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:Ae.header},l().createElement("div",{className:Ae["left-justified-items"]},l().createElement(ge,null),l().createElement("div",{className:Ae["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:Ae["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:Ae["right-justified-items"]},l().createElement("div",{className:Ae["date-and-location"]},l().createElement(fe.Ye,{size:16}),l().createElement("span",{className:Ae.value},o),l().createElement("span",{className:Ae.middot},"·"),l().createElement(ve.f,{size:16}),l().createElement("span",{className:Ae.value},(0,r.formatDate)(new Date,{mode:"standard"})))))},be=n(6194),he=n(8115),ye=n(2296),ke={};ke.styleTagTransform=b(),ke.setAttributes=g(),ke.insert=p().bind(null,"head"),ke.domAPI=d(),ke.insertStyleElement=v(),s()(ye.Z,ke);const Ce=ye.Z&&ye.Z.locals?ye.Z.locals:void 0,Ee=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 G(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)?G(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(Z().getState()),Z().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?Ce.desktopOverlay:Ce.tabletOverlay},"tablet"!==c?l().createElement("div",{className:Ce.desktopHeader},l().createElement("div",{className:Ce.headerContent},t),l().createElement(a.zxk,{className:Ce.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(be.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":s("tabletOverlay","Tablet overlay"),className:Ce.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(he.Xd,{size:16})),l().createElement("div",{className:Ce.headerContent},t)),l().createElement("div",null,n)))};var we=n(6919),Se={};Se.styleTagTransform=b(),Se.setAttributes=g(),Se.insert=p().bind(null,"head"),Se.domAPI=d(),Se.insertStyleElement=v(),s()(we.Z,Se);const Oe=we.Z&&we.Z.locals?we.Z.locals:void 0;var De=n(1940),xe={};xe.styleTagTransform=b(),xe.setAttributes=g(),xe.insert=p().bind(null,"head"),xe.domAPI=d(),xe.insertStyleElement=v(),s()(De.Z,xe);const Ne=De.Z&&De.Z.locals?De.Z.locals:void 0,Ie=function(e){var t=e.tabs,n=e.selectedIndex,o=e.onSelectTab;return l().createElement("div",{className:"\n ".concat(Ne.cohortBuilder,"\n ")},l().createElement("div",{className:Ne.tab},l().createElement(a.kwZ,{isFixedNav:!0,expanded:!0,isChildOfHeader:!0,"aria-label":"Side navigation"},l().createElement(a.LDp,null,t.map((function(e,i){return l().createElement(a.yTF,{key:i,isActive:i===n,onClick:function(){i===t.length-1?(0,r.navigate)({to:"/openmrs/admin/maintenance/settings.list?show=Stockmanagement"}):(o(i),(0,r.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/").concat(e.link)}))}},e.name)}))))))};function Te(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 Be=function(){var e,t,n=(0,E.useTranslation)().t,r=(e=(0,i.useState)(0),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 Te(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)?Te(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.")}()),o=r[0],a=r[1],c=[{name:n("stockManagementOverview","Overview"),link:"overview"},{name:n("stockManagementStockItems","Items"),link:"stock-items"},{name:n("stockManagementOperations","Operations"),link:"stock-operations"},{name:n("stockManagementStockUserScopes","User Role Scopes"),link:"stock-user-scopes"},{name:n("stockManagementStockSources","Sources"),link:"stock-sources"},{name:n("stockManagementLocations","Locations"),link:"stock-locations"},{name:n("stockManagementReports","Reports"),link:"stock-reports"},{name:n("stockManagementSettings","Settings"),link:"admin/maintenance/settings.list?show=Stockmanagement"}];return l().createElement(Ie,{tabs:c,selectedIndex:o,onSelectTab:a})};var Pe=n(1914),Ue=n(2426),je={};je.styleTagTransform=b(),je.setAttributes=g(),je.insert=p().bind(null,"head"),je.domAPI=d(),je.insertStyleElement=v(),s()(Ue.Z,je);const Fe=Ue.Z&&Ue.Z.locals?Ue.Z.locals:void 0;var ze=n(3432),Le={};Le.styleTagTransform=b(),Le.setAttributes=g(),Le.insert=p().bind(null,"head"),Le.domAPI=d(),Le.insertStyleElement=v(),s()(ze.Z,Le);const Re=ze.Z&&ze.Z.locals?ze.Z.locals:void 0;var Me=n(9697),qe=n(7412),Ge=n.n(qe);W().extend(Ge());const He=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:Re.tileContainer},l().createElement("div",{className:Re.tileHeader},l().createElement("div",{className:Re.headerLabelContainer},l().createElement("label",{className:Re.headerLabel},d),m),p&&l().createElement(r.ConfigurableLink,{className:Re.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(he.ol,{size:16,className:Re.viewListBtn}))),l().createElement("div",{className:Re.metricsGrid},l().createElement("div",null,l().createElement("label",{className:Re.totalsLabel},s),l().createElement("p",{className:Re.totalsValue},u)),!(0,Me.Z)(A)&&l().createElement("div",{className:Re.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,Me.Z)(g)&&l().createElement("div",{className:Re.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,Me.Z)(f)&&l().createElement("div",{className:Re.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 Ze(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem").concat(F(e)),n=(0,j.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 Ye(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(F(e)),n=(0,j.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 Qe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockbatch").concat(F(e)),n=(0,j.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 Je(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(F(e)),n=(0,j.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 We(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e,"?v=full"),n=(0,j.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 Ke(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 Xe(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 $e(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 Xe(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)?Xe(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=Ze(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 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(){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 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}}(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=Qe(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 nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const rt=function(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockitem?v=default&totalCount=true"),t=(0,j.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=tt(),u=s.items,d=(s.isLoading,$e().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){nt(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:Fe.cardContainer},l().createElement(He,{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(He,{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(He,{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 ot=n(8629),at={};at.styleTagTransform=b(),at.setAttributes=g(),at.insert=p().bind(null,"head"),at.domAPI=d(),at.insertStyleElement=v(),s()(ot.Z,at);const it=ot.Z&&ot.Z.locals?ot.Z.locals:void 0;var lt=n(4797);function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const st=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),tt()),n=t.items,o=t.isLoading,i=$e(),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:it.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){ct(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:it.card,key:t},l().createElement("div",{className:it.colorLineRed}),l().createElement("div",{className:it.icon},l().createElement(lt.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:it.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 ut=n(8748);const dt=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:it.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:it.card,key:t},l().createElement("div",{className:it.colorLineBlue}),l().createElement("div",{className:it.icon},l().createElement(ut.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:it.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 mt=n(2327);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"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:it.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:it.card,key:t},l().createElement("div",{className:it.colorLineGreen}),l().createElement("div",{className:it.icon},l().createElement(mt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:it.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"))},At=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:it.cardContainer},l().createElement("div",{className:it.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?it.tabletHeading:it.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(st,null)))),l().createElement("div",{className:it.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?it.tabletHeading:it.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(dt,null)))),l().createElement("div",{className:it.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?it.tabletHeading:it.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(pt,null)))))};function gt(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(rt,null),l().createElement(At,null))}var ft=n(5104),vt={};vt.styleTagTransform=b(),vt.setAttributes=g(),vt.insert=p().bind(null,"head"),vt.domAPI=d(),vt.insertStyleElement=v(),s()(ft.Z,vt);const _t=ft.Z&&ft.Z.locals?ft.Z.locals:void 0;function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ht(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(F(e)),n=(0,j.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 bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bt(e,t):void 0}}(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 yt=n(4300),kt={};kt.styleTagTransform=b(),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=n(4642);function wt(){var e,t,n="".concat(r.fhirBaseUrl,"/Location?_summary=data&_tag=main store,main pharmacy,dispensary "),o=(0,j.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,Et.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}function St(e){var t="".concat(r.restBaseUrl,"/role").concat(F(e)),n=(0,j.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 Ot(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default"),t=(0,j.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 Dt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default");return(0,r.openmrsFetch)(e)}function xt(e){var t="".concat(r.restBaseUrl,"/user").concat(F(e)),n=(0,j.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 Nt(e){var t="".concat(r.restBaseUrl,"/concept/").concat(e),n=(0,j.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 It(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Tt(e,t,n,r,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 Bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pt(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){Bt(e,t,n[t])}))}return e}function Ut(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 jt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,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)||zt(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 Ft(e){return function(e){if(Array.isArray(e))return It(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zt(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 zt(e,t){if(e){if("string"==typeof e)return It(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?It(e,t):void 0}}var Lt=ee();const Rt=function(e){var t,n,o,c,s,u,d,m=e.model,p=(0,E.useTranslation)().t,A=jt((0,i.useState)(Pt({},m)),2),g=A[0],f=A[1],v=jt((0,i.useState)([]),2),_=v[0],b=v[1],h=jt((0,i.useState)(!1),2),y=(h[0],h[1]),k=Ot(),C=k.types.results,w=k.isLoading,S=xt({v:U.Default}),O=S.items,D=S.isLoading,x=jt((0,i.useState)(null),2),N=x[0],I=x[1],T=function(e){var t="".concat(r.restBaseUrl,"/user/").concat(e),n=(0,j.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}}(N),B=T.data,P=(T.isError,St({v:U.Default})),F=(P.items,P.isLoading),z=wt().stockLocations,L=jt((0,i.useState)(""),2),R=(L[0],L[1]),M=jt((0,i.useState)([]),2),q=M[0],G=M[1],H=null!==(o=null==O?void 0:O.results)&&void 0!==o?o:[],Z=function(e){var t,n;return(null==g||null===(n=g.operationTypes)||void 0===n||null===(t=n.filter((function(t){return t.operationTypeUuid===e.uuid})))||void 0===t?void 0:t.length)>0},Y=(c=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})}(g).then((function(e){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),(0,r.showToast)({critical:!0,title:p("addUserRole","Add User role"),kind:"success",description:p("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,r.showNotification)({title:p("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",critical:!0,description:null==e?void 0:e.message}),Q()})),[2]}))},s=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=c.apply(e,t);function a(e){Tt(o,n,r,a,i,"next",e)}function i(e){Tt(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e){return s.apply(this,arguments)});return w||F||D?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:Ct.section},l().createElement("div",null,(null==O||null===(t=O.results)||void 0===t?void 0:t.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:Ct.subTitle},p("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:p("user","User"),items:q,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)}));f(Ut(Pt({},g),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),b(null!=a?a:[]),I(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){R(e),function(e){if(""===e.trim())y(!1);else{y(!0);var t=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())}));G(t)}}(e)},placeholder:"Filter..."})))),l().createElement("section",{className:Ct.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:p("role","Role"),id:"select-role",value:null!==(u=g.role)&&void 0!==u?u:"placeholder-item",onChange:function(e){var t,n,r,o=null==z||null===(t=z.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==g||null===(n=g.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:[];f(Ut(Pt({},g),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:p("Choose a role")}),null===(n=null!==(d=null==B?void 0:B.roles)&&void 0!==d?d:_)||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:Ct.section},l().createElement(a.cOn,{className:Ct.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==g?void 0:g.enabled);f(Ut(Pt({},g),{enabled:n}))},checked:null==g?void 0:g.enabled,labelText:p("Enabled ?"),value:null==m?void 0:m.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==g?void 0:g.permanent);f(Ut(Pt({},g),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==g?void 0:g.permanent,value:null==m?void 0:m.permanent,labelText:p("Permanent ?"),id:"chk-userPermanent"}),!(null==g?void 0:g.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(Lt),locale:"en",dateFormat:X,onChange:function(e){f(Ut(Pt({},g),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:K,labelText:p("activeFrom","Active From"),value:$(null==g?void 0:g.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:K,labelText:p("activeTo","Active To"),value:$(null==g?void 0:g.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:Ct.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:Ct.sectionTitle}," ",p("stockOperation","Stock Operations")),l().createElement("div",{className:Ct.hr}),l().createElement("span",{className:Ct.subTitle},p("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:Ct.section},l().createElement(a.cOn,{className:Ct.checkboxGrid},(null==C?void 0:C.length)>0&&C.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:Z(e),className:Ct.checkbox,onChange:function(t){return function(e,t,n){var r,o=null==g||null===(r=g.operationTypes)||void 0===r?void 0:r.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(o){var a=Ft(g.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==o?void 0:o.operationTypeUuid)})));f(Ut(Pt({},g),{operationTypes:a}))}else{var i,l=null==C?void 0:C.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={operationTypeName:null==l?void 0:l.name,operationTypeUuid:null==l?void 0:l.uuid};f(Ut(Pt({},g),{operationTypes:Ft(null!==(i=null==g?void 0:g.operationTypes)&&void 0!==i?i:[]).concat([c])}))}}(t,e.uuid,Z(e))},labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:Ct.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:Ct.sectionTitle}," ",p("Locations")),l().createElement("div",{className:Ct.hr}),l().createElement("span",{className:Ct.subTitle},p("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:Ct.section},l().createElement(a.cOn,{className:Ct.checkboxGrid},(null==z?void 0:z.length)>0&&z.map((function(e){var t,n,r,o=(t=e,(r=null==g||null===(n=g.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(t){return function(e,t){var n,r=null==g||null===(n=g.locations)||void 0===n?void 0:n.find((function(t){var n;return t.locationUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(r){var o,a,i=Ft(null!==(a=null==g||null===(o=g.locations)||void 0===o?void 0:o.filter((function(e){return e.locationUuid!==(null==r?void 0:r.locationUuid)})))&&void 0!==a?a:[]);f(Ut(Pt({},g),{locations:i}))}else{var l,c=null==z?void 0:z.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={locationName:null==c?void 0:c.name,locationUuid:null==c?void 0:c.id,enableDescendants:!1},u=Ft(null!==(l=null==g?void 0:g.locations)&&void 0!==l?l:[]).concat([s]);f(Ut(Pt({},g),{locations:u}))}}(t,e.id)},className:Ct.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:Ct.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:Q},p("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:Y},p("save","Save")))))},Mt=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Rt,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function qt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gt=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Rt,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:r,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(mt.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){qt(e,t,n[t])}))}return e}({size:16},e))}})};var Ht=n(1657);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}function Yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Qt=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 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,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(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),d(!1),(0,r.showToast)({critical:!0,title:c("deletingstockUserScope","Delete Stock User Scope"),kind:"success",description:c("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",critical:!0,description: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(Ht.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){Yt(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Jt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wt(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){Jt(e,t,n[t])}))}return e}function Vt(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 Kt=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope"))},o=ht({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;return Vt(Wt({},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(he.l2,{key:"".concat(t,"-").concat(r,"-0")}):l().createElement(he.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("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),activeFrom:null!==(u=V(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=V(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),actions:l().createElement("div",{style:{display:"flex"}},l().createElement(Gt,{data:c[r]}),l().createElement(Qt,{uuid:c[r].uuid}))})}))}),[t.user.uuid,c,e]);return g?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:_t.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:_t.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Mt,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,Vt(Wt({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?_t.desktopHeader:_t.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,Wt({className:r.isDesktop?_t.desktopRow:_t.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:_t.tileContainer},l().createElement(a.n9L,{className:_t.tile},l().createElement("div",{className:_t.tileContent},l().createElement("p",{className:_t.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:_t.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:_t.paginationOverride}))},Xt=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Kt,null))};function $t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(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){$t(e,t,n[t])}))}return e}function tn(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(F(e)),n=(0,j.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 nn(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 rn=n(8098),on={};on.styleTagTransform=b(),on.setAttributes=g(),on.insert=p().bind(null,"head"),on.domAPI=d(),on.insertStyleElement=v(),s()(rn.Z,on);const an=rn.Z&&rn.Z.locals?rn.Z.locals:void 0;function ln(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 cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sn(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}function un(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 dn=function(e){var t,n,o,c=e.model,s=(0,E.useTranslation)().t,u=Nt((0,r.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(sn({},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 ln(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)?ln(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=en({},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.showToast)({critical:!0,title:s("addedSource","Add Source"),kind:"success",description:s("stocksourceaddedsuccessfully","Stock Source Added Successfully")}),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingSource', 'error adding a source"),kind:"error",critical:!0,description: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:an.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(un(sn({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:an.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(un(sn({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:an.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(un(sn({},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:Q},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},mn=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(dn,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var pn=n(5551),An={};An.styleTagTransform=b(),An.setAttributes=g(),An.insert=p().bind(null,"head"),An.domAPI=d(),An.insertStyleElement=v(),s()(pn.Z,An);const gn=pn.Z&&pn.Z.locals?pn.Z.locals:void 0;function fn(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 vn=function(e){var t,n=e.onFilterChange,o=Nt((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:gn.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return fn(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 fn(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)?fn(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 _n=n(6940),bn={};bn.styleTagTransform=b(),bn.setAttributes=g(),bn.insert=p().bind(null,"head"),bn.domAPI=d(),bn.insertStyleElement=v(),s()(_n.Z,bn);const hn=_n.Z&&_n.Z.locals?_n.Z.locals:void 0;function yn(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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cn=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 yn(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)?yn(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),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),(0,r.showToast)({critical:!0,title:c("deletingSource","Delete Source"),kind:"success",description:c("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingSource', 'error deleting a source"),kind:"error",critical:!0,description: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(Ht.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){kn(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function En(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wn=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(dn,{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(mt.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){En(e,t,n[t])}))}return e}({size:16},e))}})};function Sn(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){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dn(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){On(e,t,n[t])}))}return e}function xn(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 Nn=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 Sn(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)?Sn(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(){ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource"))},d=function(e){var t=tn(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 nn(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)?nn(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,b=d.setPageSize,h=d.isLoading,y=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n;return xn(Dn({},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(wn,{data:m[t]}),l().createElement(Cn,{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 h?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:hn.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:hn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(vn,{onFilterChange:k})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(mn,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,xn(Dn({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?hn.desktopHeader:hn.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,Dn({className:r.isDesktop?hn.desktopRow:hn.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:hn.tileContainer},l().createElement(a.n9L,{className:hn.tile},l().createElement("div",{className:hn.tileContent},l().createElement("p",{className:hn.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:hn.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!==_&&b(t),n!==g&&v(n)},className:hn.paginationOverride}))},In=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Nn,null))};function Tn(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 Bn(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 Tn(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)?Tn(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 Pn=n(1535),Un={};Un.styleTagTransform=b(),Un.setAttributes=g(),Un.insert=p().bind(null,"head"),Un.domAPI=d(),Un.insertStyleElement=v(),s()(Pn.Z,Un);const jn=Pn.Z&&Pn.Z.locals?Pn.Z.locals:void 0;var Fn="RETURNED",zn="CANCELLED",Ln="REJECTED",Rn=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Fn,zn,Ln],Mn=n(6817);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}const Gn=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Ot(),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,j.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 qn(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 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}}(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(Mn.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 Hn=n(5260),Zn={};Zn.styleTagTransform=b(),Zn.setAttributes=g(),Zn.insert=p().bind(null,"head"),Zn.domAPI=d(),Zn.insertStyleElement=v(),s()(Hn.Z,Zn);const Yn=Hn.Z&&Hn.Z.locals?Hn.Z.locals:void 0,Qn=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?Yn.tabContainer:"","\n ").concat(Yn.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Yn.heading},n),l().createElement("div",{className:Yn.tab},l().createElement(a.mQc,{className:"".concat(Yn.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 Jn,Wn;function Vn(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}(Wn=Jn||(Jn={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Wn.DISPOSED_OPERATION_TYPE="disposed",Wn.STOCK_ISSUE_OPERATION_TYPE="stockissue",Wn.STOCK_TAKE_OPERATION_TYPE="stocktake",Wn.REQUISITION_OPERATION_TYPE="requisition",Wn.OPENING_STOCK_OPERATION_TYPE="initial",Wn.RECEIPT_OPERATION_TYPE="receipt",Wn.RETURN_OPERATION_TYPE="return",Wn.ADJUSTMENT_OPERATION_TYPE="adjustment";var Kn=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Xn=function(e){return!$n(e)&&"requisition"!==e},$n=function(e){return"receipt"===e||"initial"===e},er=function(e){return"requisition"===e},tr=function(e){return"receipt"===e||"initial"===e},nr=function(e){return"stockissue"===e||"return"===e},rr=function(e){return"stockissue"===e||or(e)||ar(e)||ir(e)},or=function(e){return"requisition"===e},ar=function(e){return"receipt"===e},ir=function(e){return"transferout"===e},lr=n(7536),cr=n(6312),sr=n(1604),ur=sr.z.object({id:sr.z.string().nullish(),uuid:sr.z.string().nullish(),stockItemUuid:sr.z.string().nullish(),packagingUomName:sr.z.string().nullish(),packagingUomUuid:sr.z.string().nullish(),factor:sr.z.number().nullish(),isDefaultStockOperationsUoM:sr.z.boolean().nullish(),isDispensingUnit:sr.z.boolean().nullish()}),dr=sr.z.object({canView:sr.z.boolean(),canEdit:sr.z.boolean(),canApprove:sr.z.boolean().nullish(),canReceiveItems:sr.z.boolean().nullish(),canDisplayReceivedItems:sr.z.boolean().nullish(),isRequisitionAndCanIssueStock:sr.z.boolean().nullish(),canUpdateBatchInformation:sr.z.boolean().nullish()}),mr=sr.z.object({itemIndex:sr.z.number().nullish(),id:sr.z.string().nullish(),uuid:sr.z.string().nullish(),stockItemUuid:sr.z.string().nullish(),stockItemName:sr.z.string().nullish(),stockItemPackagingUOMUuid:sr.z.string().nullish(),stockItemPackagingUOMName:sr.z.string().nullish(),stockBatchUuid:sr.z.string().nullish(),batchNo:sr.z.string().nullish(),expiration:sr.z.coerce.date().nullish(),quantity:sr.z.number().nullish(),purchasePrice:sr.z.number().nullish(),permission:dr.nullish(),edit:sr.z.boolean().nullish(),hasExpiration:sr.z.boolean().nullish(),packagingUnits:ur.array(),quantityReceived:sr.z.number().nullish(),quantityReceivedPackagingUOMName:sr.z.string().nullish(),quantityReceivedPackagingUOMUuid:sr.z.string().nullish(),quantityRequested:sr.z.number().nullish(),quantityRequestedPackagingUOMUuid:sr.z.string().nullish(),quantityRequestedPackagingUOMName:sr.z.string().nullish(),commonName:sr.z.string().nullish(),acronym:sr.z.string().nullish()}),pr=(sr.z.object({uuid:sr.z.string().nullish(),cancelReason:sr.z.string().nullish(),cancelledBy:sr.z.coerce.number(),cancelledByGivenName:sr.z.string().nullish(),cancelledByFamilyName:sr.z.string().nullish(),cancelledDate:sr.z.coerce.date(),completedBy:sr.z.coerce.number(),completedByGivenName:sr.z.string().nullish(),completedByFamilyName:sr.z.string().nullish(),completedDate:sr.z.coerce.date(),destinationUuid:sr.z.string().nullish(),destinationName:sr.z.string().nullish(),externalReference:sr.z.string().nullish(),atLocationUuid:sr.z.string().nullish(),atLocationName:sr.z.string().nullish(),operationDate:sr.z.coerce.date(),submitted:sr.z.boolean(),submittedBy:sr.z.string().nullish(),submittedByGivenName:sr.z.string().nullish(),submittedByFamilyName:sr.z.string().nullish(),locked:sr.z.boolean(),operationNumber:sr.z.string().nullish(),operationOrder:sr.z.coerce.number(),remarks:sr.z.string().nullish(),sourceUuid:sr.z.string().nullish(),sourceName:sr.z.string().nullish(),status:sr.z.enum(Rn),returnReason:sr.z.string().nullish(),rejectionReason:sr.z.string().nullish(),operationTypeUuid:sr.z.string().nullish(),operationType:sr.z.string().nullish(),operationTypeName:sr.z.string().nullish(),responsiblePerson:sr.z.coerce.number(),responsiblePersonUuid:sr.z.string().nullish(),responsiblePersonGivenName:sr.z.string().nullish(),responsiblePersonFamilyName:sr.z.string().nullish(),responsiblePersonOther:sr.z.string().nullish(),creator:sr.z.coerce.number(),dateCreated:sr.z.coerce.date(),creatorGivenName:sr.z.string().nullish(),creatorFamilyName:sr.z.string().nullish(),permission:dr.nullish(),reasonUuid:sr.z.string().nullish(),reasonName:sr.z.string().nullish(),approvalRequired:sr.z.boolean().nullish(),stockOperationItems:mr.array(),submittedDate:sr.z.coerce.date(),returnedByGivenName:sr.z.string().nullish(),returnedByFamilyName:sr.z.string().nullish(),returnedDate:sr.z.coerce.date(),rejectedByGivenName:sr.z.string().nullish(),rejectedByFamilyName:sr.z.string().nullish(),rejectedDate:sr.z.coerce.date(),dispatchedByGivenName:sr.z.string().nullish(),dispatchedByFamilyName:sr.z.string().nullish(),dispatchedDate:sr.z.coerce.date(),requisitionStockOperationUuid:sr.z.string()}),sr.z.object({operationDate:sr.z.coerce.date(),sourceUuid:sr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:sr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:sr.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:sr.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:sr.z.string().nullish(),remarks:sr.z.string().nullish()})),Ar=function(e){switch(e){case Jn.OPENING_STOCK_OPERATION_TYPE:return pr.omit({destinationUuid:!0,reasonUuid:!0});case Jn.STOCK_TAKE_OPERATION_TYPE:case Jn.ADJUSTMENT_OPERATION_TYPE:case Jn.DISPOSED_OPERATION_TYPE:return pr.omit({destinationUuid:!0});case Jn.TRANSFER_OUT_OPERATION_TYPE:case Jn.STOCK_ISSUE_OPERATION_TYPE:return pr.omit({reasonUuid:!0}).merge(sr.z.object({destinationUuid:sr.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Jn.RETURN_OPERATION_TYPE:case Jn.REQUISITION_OPERATION_TYPE:case Jn.RECEIPT_OPERATION_TYPE:return pr.omit({reasonUuid:!0}).merge(sr.z.object({sourceUuid:sr.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const gr=function(e){return l().createElement(lr.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 fr(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 vr(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 fr(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)?fr(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 _r(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 br(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 _r(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 _r(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)?_r(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 hr=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:""}},yr={uuid:"Other",display:"Other",person:{display:"Other"}};function kr(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const Cr=function(e){var t=function(e){var t=vr((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=xt(n),a=o.items.results,l=o.isLoading,c=vr((0,i.useState)(null),2),s=c[0],u=c[1],d=vr((0,i.useState)(10),2),m=d[0],p=d[1],A=vr((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=br((function(e){o(e)}),1e3);return r&&r.push(yr),l().createElement("div",null,l().createElement(lr.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:kr,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 Er(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const wr=function(e){return l().createElement(lr.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){Er(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))}})},Sr=function(e){var t=Nt((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(lr.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 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 Dr=function(e){return l().createElement(lr.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){Or(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 xr(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 Nr=(0,i.createContext)(null),Ir=function(){return(0,i.useContext)(Nr)},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 xr(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)?xr(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(Nr.Provider,{value:a},r)},Br=[Jn.ADJUSTMENT_OPERATION_TYPE,Jn.RECEIPT_OPERATION_TYPE,Jn.STOCK_ISSUE_OPERATION_TYPE,Jn.STOCK_TAKE_OPERATION_TYPE,Jn.RETURN_OPERATION_TYPE,Jn.DISPOSED_OPERATION_TYPE,Jn.OPENING_STOCK_OPERATION_TYPE,Jn.TRANSFER_OUT_OPERATION_TYPE],Pr=[Jn.ADJUSTMENT_OPERATION_TYPE,Jn.DISPOSED_OPERATION_TYPE,Jn.STOCK_TAKE_OPERATION_TYPE,Jn.OPENING_STOCK_OPERATION_TYPE];function Ur(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 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 Fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zr(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 Ur(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)?Ur(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 Lr=function(e){var t,n,r,o,c,s,u,d,m,p,A,g,f,v=e.model,_=e.onSave,b=e.operation,h=e.canEdit,y=e.isEditing,k=e.setup,C=k.requiresStockAdjustmentReason,w=k.shouldLockSource,S=k.shouldLockDestination,O=k.sourcePartyList,D=k.destinationPartyList,x=(0,E.useTranslation)().t,N=(Ir().setFormContext,Bn({v:U.Full,totalCount:!0})),T=N.isLoading,B=(N.items,Vn(null==b?void 0:b.operationType)),P=(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){Fr(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,lr.cI)({defaultValues:"stockissue"===B?P:v,mode:"all",resolver:(0,cr.F)(Ar(B))}),F=j.handleSubmit,z=j.control,L=j.formState.errors,R=j.setValue,M=zr((0,i.useState)(),2),q=M[0],G=M[1],H=zr((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,V,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 Br.includes(e)}(n)&&delete r.destinationName,function(e){return Pr.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){jr(a,r,o,i,l,"next",e)}function l(e){jr(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(I.formContainer," ").concat(I.verticalForm)},h&&l().createElement(lr.Qr,{control:z,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=zr(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:K,labelText:x("operationDate","Operation Date"),defaultValue:$(null==v?void 0:v.operationDate)}))},name:"operationDate"}),!h&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(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"}),h&&!w&&(null==b?void 0:b.hasSource)&&l().createElement(gr,{controllerName:"sourceUuid",name:"sourceUuid",control:z,title:(null==b?void 0:b.hasDestination)?x("from","From"):x("location:","Location"),placeholder:b.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:O||[]}),(!h||y||w)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:"stockissue"===B?P.sourceName:null!==(Q=null==v?void 0:v.sourceName)&&void 0!==Q?Q:"",readOnly:!0,labelText:(null==b||b.hasDestination,"From")}),h&&!S&&(null==b?void 0:b.hasDestination)&&l().createElement(gr,{controllerName:"destinationUuid",name:"destinationUuid",control:z,title:(null==b?void 0:b.hasSource)?"To":"Location",placeholder:(null==b?void 0:b.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:D||[]}),(!h||y||S)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:"stockissue"===B?P.destinationName:null!==(J=null==v?void 0:v.destinationName)&&void 0!==J?J:"",readOnly:!0,labelText:(null==b||b.hasSource,"To")}),h&&l().createElement(Cr,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:z,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)===yr.uuid&&G(!0)}}),q&&l().createElement(wr,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:z,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)}),!h&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(V=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==yr.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==V?V:"",readOnly:!0,labelText:"Responsible Person"}),C&&h&&l().createElement(Sr,{controllerName:"reasonUuid",name:"reasonUuid",control:z,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&&!h&&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(Dr,{id:"remarks",name:"remarks",control:z,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:F(re),kind:"primary",renderIcon:he.ol},Z?l().createElement(a.lSo,null):x("next","Next")))))};var Rr={stockItemUuid:sr.z.string().min(1,{message:"Required"}),stockItemName:sr.z.string().min(1).nullish(),stockItemPackagingUOMUuid:sr.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:sr.z.string().min(1).nullish(),batchNo:sr.z.string().min(1,{message:"Required"}),stockBatchUuid:sr.z.string().optional(),expiration:sr.z.coerce.date({required_error:"Required"}),quantity:sr.z.coerce.number().min(1,{message:"Required"}),purchasePrice:sr.z.coerce.number().nullish(),hasExpiration:sr.z.boolean().nullish()},Mr=sr.z.object(Rr),qr=(Mr.omit({expiration:!0}),sr.z.object({stockItems:sr.z.array(Mr)})),Gr=n(6781),Hr={};Hr.styleTagTransform=b(),Hr.setAttributes=g(),Hr.insert=p().bind(null,"head"),Hr.domAPI=d(),Hr.insertStyleElement=v(),s()(Gr.Z,Hr);const Zr=Gr.Z&&Gr.Z.locals?Gr.Z.locals:void 0;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 Qr(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 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}}(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 Jr(e){return e.drugName||e.conceptName}const Wr=function(e){var t=function(e){var t=Qr((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=Ze(n),a=o.items.results,l=o.isLoading,c=Qr((0,i.useState)(null),2),s=c[0],u=c[1],d=Qr((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Qr((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=br((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(lr.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:Jr,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Vr=function(e){var t,n=We(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(lr.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){var t;return null!==(t=e.packagingUomName)&&void 0!==t?t:""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Kr(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 Xr(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 Kr(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)?Kr(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 $r(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){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 $r(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)?$r(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 to(e){var t=eo((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=eo((0,i.useState)(10),2),a=o[0],l=o[1],c=eo((0,i.useState)(null),2),s=c[0],u=c[1],d=eo((0,i.useState)(1),2),m=d[0],p=d[1],A=eo((0,i.useState)(null==e?void 0:e.stockItemUuid),2),g=A[0],f=A[1],v=eo((0,i.useState)(null==e?void 0:e.partyUuid),2),_=v[0],b=v[1],h=eo((0,i.useState)(null==e?void 0:e.locationUuid),2),y=h[0],k=h[1],C=eo((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,O=Ye(n),D=O.items,x=O.isLoading,N=O.isError;return{items:null!==(S=D.results)&&void 0!==S?S:[],totalCount:D.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:b,setStockBatchUuid:w}}function no(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ro=function(e){var t=function(e){var t=Xr((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=Qe(n),a=o.items.results,l=o.isLoading,c=Xr((0,i.useState)(null),2),s=c[0],u=c[1],d=Xr((0,i.useState)(10),2),m=d[0],p=d[1],A=Xr((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=to(),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){no(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(lr.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 oo(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 ao(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 oo(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)?oo(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 io=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=ao((0,i.useState)(),2),_=(v[0],v[1]),b=ao((0,i.useState)(),2),h=(b[0],b[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,b,y,k,C,E,w,S,O,D,x,N,I,T,B,P,U,j,F,z,L,R,M,q,G,H,Z,Y,Q,J,W,V,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Zr.desktopRow:Zr.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(Wr,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:re,control:m,invalid:!!(null==A||null===(b=A.stockItems)||void 0===b||null===(v=b[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(ro,{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),h(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===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=ao(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:K,defaultValue:$(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)&&$(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!==(V=null===(F=d[null==e?void 0:e.stockBatchUuid])||void 0===F?void 0:F.quantityUoM)&&void 0!==V?V:""):"",invalid:!!(null==A||null===(L=A.stockItems)||void 0===L||null===(z=L[i])||void 0===z?void 0:z.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Vr,{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:Ht.ZN,onClick:function(){return g(i)}})))})))};var lo=n(6360),co={};co.styleTagTransform=b(),co.setAttributes=g(),co.insert=p().bind(null,"head"),co.domAPI=d(),co.insertStyleElement=v(),s()(lo.Z,co);const so=lo.Z&&lo.Z.locals?lo.Z.locals:void 0;function uo(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,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 po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ao(e){return function(e){if(Array.isArray(e))return uo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||go(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 go(e,t){if(e){if("string"==typeof e)return uo(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)?uo(e,t):void 0}}const fo=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,b=e.canEdit,h=void 0===b||b,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,O=Ir().formContext,D=function(e){if("requisition"===e){var t=Mr.omit({batchNo:!0,expiration:!0});return sr.z.object({stockItems:sr.z.array(t)})}return qr}(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.showToast)({critical:!0,title:"No stock items",kind:"error",description:"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){mo(a,r,o,i,l,"next",e)}function l(e){mo(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,lr.cI)({resolver:(0,cr.F)(D),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)||go(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,lr.Dq)({name:"stockItems",control:T}),F=j.fields,z=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==O?void 0:O.stockItems){var e=null==O?void 0:O.stockItems;null==e||e.forEach((function(e){return z(e)}))}}),[z,null==O?void 0:O.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(Ao(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),Ao(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),Ao(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),Ao(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")}],Ao(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)));z({uuid:e,id:e})};return l().createElement("div",{style:{margin:"10px"}},l().createElement("div",{className:so.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){po(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?so.desktopHeader:so.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)})),h&&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:he.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:he.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(io,{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:z,canEdit:h,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:F})," ")))}})))};var vo=n(8808);function _o(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 bo(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 ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){bo(a,r,o,i,l,"next",e)}function l(e){bo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function yo(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 _o(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)?_o(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 ko(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 Co=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=yo((0,i.useState)(!1),2),d=u[0],m=u[1],p=yo((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:ho((function(){return ko(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:fe.X4},s("complete","Complete")),o&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:ho((function(){return ko(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:ut.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:vo.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:ho((function(){return ko(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:vo.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:Ht.WP},s("goBack","Go Back"))))};var Eo="Location",wo="Other";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 Oo(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,b,h,y,k,C,E,w,S,O,D,x,N,I,T,B,P,U,j,F,z,L,R,M,q,G,H;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(Z){switch(Z.label){case 0:return A=!!t,g=[],f=!1,v=n,b=null!==(_=null==t||null===(o=t.permission)||void 0===o?void 0:o.isRequisitionAndCanIssueStock)&&void 0!==_&&_,y=null!==(h=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!==h?h:[],k=1===y.length&&y[0]===oe,E=null!==(C=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!==C?C:[],w=1===E.length&&E[0]===oe,S=null,A?(p=structuredClone(hr()),p=Object.assign(p,{operationDate:ee(),operationTypeName:null==e?void 0:e.name,operationTypeUuid:null==e?void 0:e.uuid,operationType:null==e?void 0:e.operationType}),e.operationType,Jn.STOCK_ISSUE_OPERATION_TYPE,[4,(Q="".concat(r.restBaseUrl,"/stockmanagement/party?v=default"),(0,r.openmrsFetch)(Q))]):[3,2];case 1:if(!(I=Z.sent()).ok)throw Error("Error loading parties");return O=null==I||null===(N=I.data)||void 0===N||null===(x=N.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Eo&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wo})),(null==e?void 0:e.hasSource)&&A&&k&&(null==O?void 0:O.length)>0&&(T=O[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(D=null==I||null===(P=I.data)||void 0===P||null===(B=P.results)||void 0===B?void 0:B.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Eo&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wo})),A&&w&&(null==D?void 0:D.length)>0&&(U=D[0],p.destinationUuid=U.uuid,p.destinationName=U.name)),[3,4];case 2:return[4,Dt()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return F=Vn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=F,"adjustment"===Y),requiresBatchUuid:Xn(F),requiresActualBatchInfo:$n(F),isQuantityOptional:er(F),canCaptureQuantityPrice:tr(F),requiresStockAdjustmentReason:Kn(F),requiresDispatchAcknowledgement:nr(F),allowExpiredBatchNumbers:null!==(z=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==z&&z,canEditModel:null!==(L=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==L&&L,canViewModel:null!==(R=null==t||null===(c=t.permission)||void 0===c?void 0:c.canView)&&void 0!==R&&R,canApproveModel:null!==(M=null==t||null===(s=t.permission)||void 0===s?void 0:s.canApprove)&&void 0!==M&&M,canIssueStock:b,canReceiveItems:null!==(q=null==t||null===(u=t.permission)||void 0===u?void 0:u.canReceiveItems)&&void 0!==q&&q,canDisplayReceivedItems:null!==(G=null==t||null===(d=t.permission)||void 0===d?void 0:d.canDisplayReceivedItems)&&void 0!==G&&G,canUpdateItemsBatchInformation:null!==(H=null==t||null===(m=t.permission)||void 0===m?void 0:m.canUpdateBatchInformation)&&void 0!==H&&H,canPrint:b||rr(F),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Eo&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wo},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Eo&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wo},location:S,sourcePartyList:O,destinationPartyList:D,stockOperationTypes:v,hasQtyRequested:f}]}var Y,Q}))},Oo=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)}))},Oo.apply(this,arguments)}function Do(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 Do(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)?Do(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 No=n(3133);function Io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const To=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(No.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){Io(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Bo(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:"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){Bo(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};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 jo=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(be.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){Uo(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};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}const zo=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(mt.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){Fo(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function Lo(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 Ro,Mo,qo=(Ro=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={},Jn.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):Jn.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]}))},Mo=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=Ro.apply(e,t);function a(e){Lo(o,n,r,a,i,"next",e)}function i(e){Lo(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Mo.apply(this,arguments)});function Go(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 Ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Go(a,r,o,i,l,"next",e)}function l(e){Go(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Zo(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 Yo=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>")},Qo=function(){var e=Ho((function(){var e,t;return Zo(this,(function(n){switch(n.label){case 0:e=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(r=ne?"".concat(ae).concat(ne):"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",new Promise((function(e,t){var n;if(r){var o=document.getElementById("hdnTxtPrintLogo");if(o&&(null===(n=o.value)||void 0===n?void 0:n.length)>0){var a=o.getAttribute("isSvg");e({image:o.value,isSvg:"1"===a})}else if(r.toLowerCase().endsWith(".svg"))fetch(r,{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=r}}else e(null)})))];case 2:return e=n.sent(),[3,4];case 3:return t=n.sent(),console.info(t),[3,4];case 4:return[2,e||re?'\n<div class="logo" >\n '.concat(e?e.isSvg?e.image:"<img alt='' src='".concat(e.image,"' />"):"","\n ").concat(re?"<span class='logo-text text'>".concat(re,"</span>"):"","\n</div> \n "):""]}var r}))}));return function(){return e.apply(this,arguments)}}(),Jo=function(){var e=Ho((function(){var e;return Zo(this,(function(t){switch(t.label){case 0:return[4,Qo()];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)}}(),Wo=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 Vo(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 Ko(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Vo(a,r,o,i,l,"next",e)}function l(e){Vo(a,r,o,i,l,"throw",e)}i(void 0)}))}}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])}}}var $o=function(){var e=Ko((function(e){var t,n,r,o,a,i,l,c,s;return Xo(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,Jo()];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(V(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(V(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)}}(),ea=function(){var e=Ko((function(e){var t;return Xo(this,(function(n){switch(n.label){case 0:return[4,$o(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ta(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 na(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ta(a,r,o,i,l,"next",e)}function l(e){ta(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ra(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 oa=function(){var e=na((function(e){var t,n,r,o,a,i,l,c,s;return ra(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,Jo()];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(V(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(V(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)}}(),aa=function(){var e=na((function(e){var t;return ra(this,(function(n){switch(n.label){case 0:return[4,oa(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ia(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 la(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ia(a,r,o,i,l,"next",e)}function l(e){ia(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ca(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 sa=function(){var e=la((function(e){var t,n,r,o,a,i,l,c;return ca(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,Jo()];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(V(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)}}(),ua=function(){var e=la((function(e){var t;return ca(this,(function(n){switch(n.label){case 0:return[4,sa(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function da(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 ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=((0,r.useConfig)().config,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){da(a,r,o,i,l,"next",e)}function l(e){da(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&&(L(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(F(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,qo(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,ea(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,aa(c)];case 4:return u.sent(),[3,7];case 5:return[4,ua(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){ma(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function Aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ga=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(ut.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){Aa(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const va=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(he.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){fa(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function _a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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){_a(e,t,n[t])}))}return e}const ha=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=ba({},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(){Fa(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(ut.ei,ba({size:16},e))}},s("issueStock","Issue Stock "))};var ya=n(2496),ka={};ka.styleTagTransform=b(),ka.setAttributes=g(),ka.insert=p().bind(null,"head"),ka.domAPI=d(),ka.insertStyleElement=v(),s()(ya.Z,ka);const Ca=ya.Z&&ya.Z.locals?ya.Z.locals:void 0;function Ea(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 wa(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 Sa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){wa(a,r,o,i,l,"next",e)}function l(e){wa(a,r,o,i,l,"throw",e)}i(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 Da(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 xa(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 Na(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 Ea(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)?Ea(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 Ia(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 Ta=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,b,h,y,k,C,w,S,O,D,x,N,I,T,B,P,U,j,F,z,L,R,M,G,H,Z,Y,J,W,V,K,X,$,ee,te,ne,re,oe,ae,ie,le,ce,se,ue,de,me,pe,Ae,ge,fe,ve,_e,be,he,ye,ke,Ce,Ee,we,Se,Oe,De=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=xo((0,i.useState)(!0),2),n=t[0],r=t[1],o=xo((0,i.useState)(!1),2),a=o[0],l=o[1],c=xo((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return Oo.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=Na((0,i.useState)(null==e?void 0:e.isEditing),2),Fe=je[0],ze=je[1],Le=Na((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Na((0,i.useState)(0),2),Ge=qe[0],He=qe[1];if(Be)return l().createElement(a.MHR,null);if(Pe)return Q(),void(0,r.showSnackbar)({kind:"error",title:De("error","Error"),subtitle:De("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(Lr,xa(Da({},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:Sa((function(){return Ia(this,(function(e){return ze(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:De("stockItems","Stock Items"),component:l().createElement(fo,xa(Da({},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:Sa((function(){return Ia(this,(function(e){return Me(!0),He(2),[2]}))}))})),disabled:!(xe||Fe)},{name:(null==Ue?void 0:Ue.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(Co,xa(Da({},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=Sa((function(t){return Ia(this,(function(n){switch(n.label){case 0:return[4,ja(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:Sa((function(){return Ia(this,(function(t){switch(t.label){case 0:return[4,za("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Sa((function(){return Ia(this,(function(t){switch(t.label){case 0:return[4,za("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Sa((function(){return Ia(this,(function(t){switch(t.label){case 0:return[4,za("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:Ca.textHeading},De("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(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:Ca.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("started","Started"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(_=e.model)||void 0===_?void 0:_.creatorFamilyName," ",null==e||null===(b=e.model)||void 0===b?void 0:b.creatorGivenName))),(null==e||null===(h=e.model)||void 0===h?void 0:h.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("submitted","Submitted"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.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:Ca.textHeading},De("dispatched","Dispatched"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByFamilyName," ",null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("returned","Returned"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.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:Ca.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:Ca.textHeading},De("completed","Completed"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(j=e.model)||void 0===j?void 0:j.completedByFamilyName," ",null==e||null===(F=e.model)||void 0===F?void 0:F.completedByGivenName))),"CANCELLED"===(null==e||null===(z=e.model)||void 0===z?void 0:z.status)&&l().createElement("div",null,l().createElement("span",{className:Ca.textHeading},De("cancelled","Cancelled"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByFamilyName," ",null==e||null===(M=e.model)||void 0===M?void 0:M.cancelledByGivenName,l().createElement("span",{className:Ca.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:Ca.textHeading},De("rejected","Rejected"),":"),l().createElement("div",{className:Ca.statusDescriptions},l().createElement("span",{className:Ca.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:Ca.text},"By"),l().createElement("span",{className:Ca.text},null==e||null===(Y=e.model)||void 0===Y?void 0:Y.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)===Jn.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Jn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(To,{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)===Jn.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Jn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ga,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Po,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(zo,{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(va,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jo,{operation:null==e?void 0:e.model}))),(null==e||null===(be=e.model)||void 0===be||null===(_e=be.permission)||void 0===_e?void 0:_e.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(zo,{operation:null==e?void 0:e.model})),(null==e||null===(ye=e.model)||void 0===ye||null===(he=ye.permission)||void 0===he?void 0:he.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ha,{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)===Jn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Jn.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Jn.RECEIPT_OPERATION_TYPE||(null==e||null===(Oe=e.model)||void 0===Oe?void 0:Oe.operationType)===Jn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(pa,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Tr,null,l().createElement(Qn,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Ba(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 Pa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ba(a,r,o,i,l,"next",e)}function l(e){Ba(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Ua(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 ja=function(){var e=Pa((function(e,t,n,o,a){var i,l,c,s;return Ua(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===Jn.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?M:R)(i)];case 2:return(null==(l=o.sent())?void 0:l.data)&&(ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation")),(0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",description:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Q()),[3,4];case 3:return c=o.sent(),s=le(c),(0,r.showNotification)({description:s.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),Fa=function(e,t,n,r,o){Y("".concat(t?"Edit":"New: "," ").concat(t?null==e?void 0:e.operationTypeName:null==n?void 0:n.name),l().createElement(Ta,{model:e,onSave:function(e){return ja(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},za=function(){var e=Pa((function(e,t,n){var o;return Ua(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 La(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 Ra=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 La(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)?La(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&&L(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(){Fa(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};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}function qa(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)||Ga(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 Ga(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}}const Ha=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Nt(t),c=o.items,s=o.isLoading,u=qa((0,i.useState)(!1),2),d=u[0],m=u[1],p=qa((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(Rn.map((function(e){return{uuid:e,display:e}})));break;case te.SOURCES:var e;(null==c||null===(e=c.answers)||void 0===e?void 0:e.length)&&(g(function(e){if(Array.isArray(e))return Ma(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Ga(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 te.OPERATION:Dt().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:jn.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 Za(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 Ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qa(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}function Ja(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 Wa(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 Za(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)?Za(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 Va=function(){var e,t=(0,E.useTranslation)().t,n=function(){ce("".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=Bn({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,_=Wa((0,i.useState)(s),2),b=_[0],h=_[1],y=Wa((0,i.useState)(null),2),k=y[0],C=y[1],w=Wa((0,i.useState)(null),2),S=w[0],O=w[1],D=Wa((0,i.useState)([]),2),x=D[0],N=D[1],I=Wa((0,i.useState)([]),2),T=I[0],B=I[1],P=Wa((0,i.useState)([]),2),j=P[0],F=P[1],z=(0,r.useConfig)(),L=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}});ce("".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===te.SOURCES?N(e):t===te.OPERATION?F(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}))),h(e)},q=(0,i.useMemo)((function(){return null==b?void 0:b.map((function(n,r){var i,c,s,u,d,m,p,A,g,f,v,_,h,y,k,C,E,w,S;return Ja(Qa({},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(Ra,{model:b[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(he.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:V(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"},V(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)!==Fn&&(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"},V(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"},V(null==n?void 0:n.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(_=n.completedByFamilyName)&&void 0!==_?_:""," ",null!==(h=n.completedByGivenName)&&void 0!==h?h:""))),(null==n?void 0:n.status)===zn&&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"},V(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)===Ln&&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"},V(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)===Fn&&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"},V(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(){Fa(b[r],!0,o,e,!1)}}))})}))}),[L,b,o,e,s]);return v?l().createElement(a.gqd,{className:jn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:jn.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:jn.toolbarContent},l().createElement(a.Ys1,{className:jn.patientListSearch,expanded:!0,onChange:p,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:jn.filterContainer},l().createElement(a.Mtg,{className:jn.dateAlign,datePickerType:"range",dateFormat:X,value:[k,S],onChange:function(e){var t=Wa(e,2);!function(e){var t=Wa(e,2),n=t[0],r=t[1];n&&(C(n),S&&n&&S<n&&O(n)),r&&(O(r),k&&r&&k>r&&C(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:K}),l().createElement(a.aj6,{placeholder:K})),l().createElement(Ha,{conceptUuid:z.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:R}),l().createElement(Ha,{filterName:te.STATUS,onFilterChange:R}),l().createElement(Ha,{filterName:te.OPERATION,onFilterChange:R})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Gn,{onOperationTypeSelected:function(t){Fa(hr(),!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,Ja(Qa({},u({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jn.desktopHeader:jn.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,_,h,y,k,C,E,w,S,O,D,x,N,I,T,B,P,U,j,F,z,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Qa({className:r.isDesktop?jn.desktopRow:jn.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=b[n])||void 0===o?void 0:o.dateCreated)?V(null===(i=b[n])||void 0===i?void 0:i.dateCreated):""," ",(null===(u=b[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(d=b[n])||void 0===d?void 0:d.dateCreated)?null===(p=b[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=b[n])||void 0===A?void 0:A.completedDate)?V(null===(g=b[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=b[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=b[n])||void 0===v?void 0:v.completedDate)?null===(_=b[n])||void 0===_?void 0:_.creatorFamilyName:""),l().createElement(a.agF,null,(null===(h=b[n])||void 0===h?void 0:h.stockOperationItems)?null===(y=b[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=b[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=b[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=b[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(w=b[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=b[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(O=b[n])||void 0===O?void 0:O.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(D=b[n])||void 0===D?void 0:D.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=b[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(N=b[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=b[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=b[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=b[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=b[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=b[n])||void 0===j?void 0:j.stockOperationItems)?null===(F=b[n].stockOperationItems)||void 0===F?void 0:F.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(z=b[n])||void 0===z?void 0:z.stockOperationItems)?null===(L=b[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===i.length?l().createElement("div",{className:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("div",{className:jn.tileContent},l().createElement("p",{className:jn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:jn.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:jn.paginationOverride}))},Ka=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Va,null))};var Xa={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 $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 ei(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.")}()}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){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const ri=function(e){var t,n,o=function(e){var t=ei((0,i.useState)(e||{v:U.Default,startIndex:0}),2),n=t[0],o=(t[1],function(e){var t="".concat(r.restBaseUrl,"/drug").concat(F(e)),n=(0,j.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)),a=o.items.results,l=o.isLoading,c=ei((0,i.useState)(""),2),s=c[0],u=c[1],d=ei((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=ei((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){}),[s,m,g]),{drugList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(),c=o.isLoading,s=o.drugList,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 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}}(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()?s:s.filter((function(e){return e.name.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,s]);return l().createElement("div",null,l().createElement(lr.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:p||[],initialSelectedItem:null!==(n=null==s?void 0:s.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:ni,onChange:function(t){var n;null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),o(t.selectedItem.uuid)},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),c&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};var oi=sr.z.string().max(255).nullish(),ai=sr.z.object({isDrug:sr.z.boolean(),drugUuid:sr.z.string().nullish(),drugName:sr.z.string().nullish(),commonName:oi,acronym:oi,hasExpiration:sr.z.boolean(),expiryNotice:sr.z.coerce.number().nullish(),uuid:sr.z.string().nullish(),conceptUuid:sr.z.string().nullish(),conceptName:sr.z.string().nullish(),preferredVendorUuid:sr.z.string().nullish(),preferredVendorName:sr.z.string().nullish(),purchasePrice:sr.z.number().nullish(),purchasePriceUoMUuid:sr.z.string().nullish(),purchasePriceUoMName:sr.z.string().nullish(),categoryUuid:sr.z.string().nullish(),categoryName:sr.z.string().nullish(),dispensingUnitUuid:sr.z.string().nullish(),dispensingUnitName:sr.z.string().nullish(),dispensingUnitPackagingUoMUuid:sr.z.string().nullish(),dispensingUnitPackagingUoMName:sr.z.string().nullish(),defaultStockOperationsUoMUuid:sr.z.string().nullish(),defaultStockOperationsUoMName:sr.z.string().nullish(),reorderLevel:sr.z.number().nullish(),reorderLevelUoMUuid:sr.z.string().nullish(),reorderLevelUoMName:sr.z.string().nullish(),dateCreated:sr.z.coerce.date().nullish(),creatorGivenName:sr.z.string().nullish(),creatorFamilyName:sr.z.string().nullish(),voided:sr.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 ii(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const li=function(e){return l().createElement(lr.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){ii(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})})))}})},ci=function(e){return l().createElement(lr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o,i,c=t.field,s=c.onChange,u=c.value,d=c.ref;return l().createElement(a.Y2U,{label:e.label,id:"".concat(e.name,"-").concat(null===(n=e.row)||void 0===n?void 0:n.id,"-").concat(null===(r=e.row)||void 0===r?void 0:r.uuid),value:null!==(i=null===(o=e.row)||void 0===o?void 0:o.factor)&&void 0!==i?i:u,min:e.min,hideSteppers:e.hideSteppers||!1,ref:d,onChange:function(t,n){s(t,n),e.onChange&&e.onChange(t,n)}})}})},si=function(e){var t=Nt((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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})}})},ui=function(e){var t=tn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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})}})},di=function(e){var t=(0,E.useTranslation)().t,n=Nt((0,r.useConfig)().stockItemCategoryUUID),o=n.items.answers;return n.isLoading?l().createElement(a.znL,null):l().createElement(lr.Qr,{name:e.controllerName,control:e.control,render:function(n){var r,i,c=n.field,s=c.onChange,u=c.value,d=c.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:o||[],onChange:function(t){var n,r;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),s(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===u})))||void 0===r?void 0:r.display))&&void 0!==i?i:"",placeholder:e.placeholder,ref:d,invalid:e.invalid,invalidText:e.invalidText})}})},mi=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(lr.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)},pi=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=We(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(mi,{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(mi,{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(ci,{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(mi,{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(ci,{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(mi,{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 Ai(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 gi=function(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/concept").concat(F({})),n=(0,j.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 Ai(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)?Ai(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(lr.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 fi=[{label:"Pharmaceuticals",value:!0},{label:"Non Pharmaceuticals",value:!1}],vi=[{label:"Yes",value:!0},{label:"No",value:!1}];function _i(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 bi(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 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 _i(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)?_i(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 yi=(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,b=e.handleTabChange,h=(0,E.useTranslation)().t,y=(0,lr.cI)({defaultValues:f,mode:"all",resolver:(0,cr.F)(ai)}),k=y.handleSubmit,C=y.control,w=y.formState,S=w.errors,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){bi(a,r,o,i,l,"next",e)}function l(e){bi(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]),N(!0),e.uuid=f.uuid,[4,v(e)];case 1:return t.sent(),b(1),ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),[3,4];case 2:return t.sent(),[3,4];case 3:return N(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),D=hi((0,i.useState)(!1),2),x=D[0],N=D[1],T=hi((0,i.useState)(!1),2),B=T[0],P=T[1],U=hi((0,i.useState)(!1),2),j=U[0],F=U[1];return(0,i.useEffect)((function(){var e,t;P(null!==(e=f.isDrug)&&void 0!==e&&e),F(null!==(t=f.hasExpiration)&&void 0!==t&&t)}),[f.hasExpiration,f.isDrug]),l().createElement("form",{className:"".concat(I.formContainer," ").concat(I.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:h("itemType","Item Type"),title:h("itemType","Item Type")},l().createElement(li,{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){P(e)},options:fi})),B&&l().createElement(ri,{name:"drugUuid",controllerName:"drugUuid",control:C,title:h("pleaseSpecify","Please specify:"),invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(n=S.drugUuid)||void 0===n?void 0:n.message)}),null!=B&&!B&&l().createElement(gi,{name:"conceptUuid",controllerName:"conceptUuid",control:C,title:h("pleaseSpecify","Please specify:"),placeholder:h("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(wr,{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:h("commonName","Common name:"),invalid:!!S.commonName,invalidText:S.commonName&&(null==S||null===(c=S.commonName)||void 0===c?void 0:c.message)}),l().createElement(wr,{id:"acronym",maxLength:255,name:"acronym",control:C,controllerName:"acronym",size:"md",labelText:h("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:h("hasExpiration","Does the item expire?"),title:h("hasExpiration","Does the item expire?")},l().createElement(li,{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){F(e)},options:vi})),j&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:h("expirationNotice","Expiration Notice (days)"),title:h("expirationNotice","Expiration Notice (days)")},l().createElement(ci,{id:"expiryNotice",name:"expiryNotice",control:C,controllerName:"expiryNotice",min:0,size:"md",allowEmpty:!0,label:h("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(ui,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:C,title:h("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:h("chooseVendor","Choose vendor"),invalid:!!S.preferredVendorUuid,invalidText:S.preferredVendorUuid&&(null==S||null===(m=S.preferredVendorUuid)||void 0===m?void 0:m.message)}),l().createElement(di,{name:"categoryUuid",controllerName:"categoryUuid",control:C,title:h("category:","Category:"),placeholder:h("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(si,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:C,title:h("dispensingUnit","Dispensing Unit:"),placeholder:h("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(pi,{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(O),kind:"primary",renderIcon:vo.vc},x?l().createElement(a.lSo,null):h("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},h("cancel","Cancel"))))}));const ki=yi;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){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(F(e)),n=(0,j.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 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}}(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 wi=n(4563),Si={};Si.styleTagTransform=b(),Si.setAttributes=g(),Si.insert=p().bind(null,"head"),Si.domAPI=d(),Si.insertStyleElement=v(),s()(wi.Z,Si);const Oi=wi.Z&&wi.Z.locals?wi.Z.locals:void 0;function Di(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(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){Di(e,t,n[t])}))}return e}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}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 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}}(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 Ui=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t,u=Pi((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=Je(d).items,A=wt().stockLocations,g=St({v:U.Default}),f=g.items,v=(g.isError,g.isLoading,Pi((0,i.useState)(Ti({enabled:!0},o)),2)),_=v[0],b=v[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){o.dateCreated,o.creatorGivenName,o.creatorFamilyName;var e=Ti({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(o,["dateCreated","creatorGivenName","creatorFamilyName"]));b(e)}}),[o]);var h=(0,i.useCallback)((function(e){e.preventDefault(),o&&(_.uuid=o.uuid),c&&(_.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:xi({},e)})}(_).then((function(){(0,r.showToast)({critical:!0,title:s("addedRule","Add Rule"),kind:"success",description:s("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[_,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:Oi.section},l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==_?void 0:_.locationUuid)?_.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.id===e.target.value}));b(Bi(Ti({},_),{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:Oi.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),b(Bi(Ti({},_),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==_?void 0:_.stockItemPackagingUOMUuid)?_.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));b(Bi(Ti({},_),{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:Oi.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)),b(Bi(Ti({},_),{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:Oi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==_?void 0:_.alertRole)?_.alertRole:"",onChange:function(e){var t=null==f?void 0:f.results.find((function(t){return t.display===e.target.value}));b(Bi(Ti({},_),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==f||null===(t=f.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:Oi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==_?void 0:_.mailRole)?_.mailRole:"",onChange:function(e){var t=null==f?void 0:f.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),b(Bi(Ti({},_),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==f||null===(n=f.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:Oi.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)),b(Bi(Ti({},_),{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)),b(Bi(Ti({},_),{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:Oi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enabled);b(Bi(Ti({},_),{enabled:n}))},checked:null==_?void 0:_.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:Oi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enableDescendants);b(Bi(Ti({},_),{enableDescendants:n}))},name:"appliesToChildren",checked:null==_?void 0:_.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:Q},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},ji=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Ui,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var Fi=n(4907),zi={};zi.styleTagTransform=b(),zi.setAttributes=g(),zi.insert=p().bind(null,"head"),zi.domAPI=d(),zi.insertStyleElement=v(),s()(Fi.Z,zi);const Li=Fi.Z&&Fi.Z.locals?Fi.Z.locals:void 0;function Ri(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 Mi=function(e){var t,n=e.stockItemUuid,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(F(e)),n=(0,j.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:Li.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Ri(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 Ri(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)?Ri(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 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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hi=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 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}}(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.showToast)({critical:!0,title:c("deletingRule","Delete Rule"),kind:"success",description:c("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingRule', 'error deleting a rule"),kind:"error",critical:!0,description: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(Ht.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){Gi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};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 Yi=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Ui,{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(mt.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){Zi(e,t,n[t])}))}return e}({size:16},e))}})};function Qi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ji(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){Qi(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}const Vi=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t),o=Ei({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 Wi(Ji({},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:V(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:V(null==e?void 0:e.lastActionDate),nextActionDate:V(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Yi,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Hi,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:jn.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:jn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Mi,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(ji,{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,Wi(Ji({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jn.desktopHeader:jn.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,Ji({className:r.isDesktop?jn.desktopRow:jn.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:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("div",{className:jn.tileContent},l().createElement("p",{className:jn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:jn.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:jn.paginationOverride}))};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 Xi(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.")}()}function $i(e){var t=Xi((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Xi((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=Je(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}}function el(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 tl(e){return function(e){if(Array.isArray(e))return el(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 el(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)?el(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 nl=function(e){var t=Nt((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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)?tl(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(tl(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 rl=sr.z.object({id:sr.z.string().nullish(),uuid:sr.z.string().nullish(),stockItemUuid:sr.z.string().nullish(),packagingUomName:sr.z.string().nullish(),packagingUomUuid:sr.z.string().nullish(),factor:sr.z.coerce.number().nullish(),isDefaultStockOperationsUoM:sr.z.boolean().nullish(),isDispensingUnit:sr.z.boolean().nullish()});const ol=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:Ht.ZN,onClick:n}))};var al=n(4158),il={};il.styleTagTransform=b(),il.setAttributes=g(),il.insert=p().bind(null,"head"),il.domAPI=d(),il.insertStyleElement=v(),s()(al.Z,il);const ll=al.Z&&al.Z.locals?al.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 sl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ul(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){sl(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}const ml=function(e){var t=e.stockItemUuid,n=e.handleTabChange,o=$i(),c=o.items,s=o.isLoading,u=o.setStockItemUuid,d=o.mutate;(0,i.useEffect)((function(){u(t)}),[t,u]);var m,p=(0,E.useTranslation)().t,A=(0,i.useMemo)((function(){return[{key:"packaging",header:p("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:p("packSize","Pack Size"),styles:{width:"50%"}},{key:"action",header:p("action","Actions"),styles:{width:"50%"}}]}),[p]),g=(0,lr.cI)({defaultValues:{},mode:"all",resolver:(0,cr.F)(rl)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(lr.RV,g,l().createElement(a.wQF,{rows:(m=c,function(e){if(Array.isArray(e))return cl(e)}(m)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(m)||function(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}}(m)||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.")}()).concat([{}]),headers:A,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:ll.packagingTableContainer},l().createElement(a.iA_,dl(ul({},r()),{className:ll.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,dl(ul({},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:ll.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(pl,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(pl,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=g.getValues,o=g.setValue,a=e();(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})})({factor:a.factor,packagingUomUuid:a.packagingUomUuid,stockItemUuid:t}).then((function(){d(),(0,r.showSnackbar)({title:p("savePackingUnitTitle","Package Unit"),subtitle:p("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"}),o("factor",0)}),(function(){(0,r.showSnackbar)({title:p("savePackagingUnitErrorTitle","Package Unit"),subtitle:p("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})),n(0)},kind:"primary",renderIcon:vo.vc},p("save","Save")))};var pl=function(e){var t=e.isEditing,n=e.row,r=e.key,o=(0,lr.Gc)(),i=o.control,c=o.formState.errors;return l().createElement(l().Fragment,null,l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(nl,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",placeholder:"Filter",control:i,invalid:!!c.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement("div",{className:ll.packingTableCell},l().createElement(ci,{row:n,controllerName:"factor",name:"factor",min:0,control:i,id:"".concat(n.uuid,"-").concat(r),invalid:!!c.factor,hideSteppers:!0}),l().createElement(ol,{closeModal:function(){return!0},row:n})))))};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 gl(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.")}()}var fl=n(3162),vl=n(4655),_l={};_l.styleTagTransform=b(),_l.setAttributes=g(),_l.insert=p().bind(null,"head"),_l.domAPI=d(),_l.insertStyleElement=v(),s()(vl.Z,_l);const bl=vl.Z&&vl.Z.locals?vl.Z.locals:void 0;function hl(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 yl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kl(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)||Cl(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 Cl(e,t){if(e){if("string"==typeof e)return hl(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)?hl(e,t):void 0}}const El=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=kl((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=kl((0,i.useState)(n),1)[0],b=[10,20,30,40,50],h=kl((0,i.useState)(10),2),y=h[0],k=h[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,O=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){yl(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 D=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,fl.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,fl.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 hl(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||Cl(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:bl.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:bl.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:mt.rT,iconDescription:"Download As",focusTrap:!1},l().createElement(a.laM,{itemText:"Download As CSV",onClick:D}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:D}),l().createElement(a.laM,{itemText:"Download As Json",onClick:D})),l().createElement(a.Ys1,{className:bl.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:bl.tileContainer},l().createElement(a.n9L,{className:bl.tile},l().createElement("div",{className:bl.tileContent},l().createElement("p",{className:bl.content},m("No data","No data to display")),l().createElement("p",{className:bl.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:O,pageSize:y,pageSizes:b,totalItems:c||(null==_?void 0:_.length),className:bl.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==O){if(s)return void s(n);w(n)}}})))})))},wl=function(e){var t=(0,E.useTranslation)().t,n=wt().stockLocations;return l().createElement(lr.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 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 Ol(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){Ol(e,t,n[t])}))}return e}function xl(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 Nl(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 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.")}()}const Il=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=Nl((0,i.useState)(),2),c=o[0],s=o[1],u=function(e){var t=gl((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=gl((0,i.useState)(10),2),l=a[0],c=a[1],s=gl((0,i.useState)(null),2),u=s[0],d=s[1],m=gl((0,i.useState)(1),2),p=m[0],A=m[1],g=gl((0,i.useState)(null==e?void 0:e.stockItemUuid),2),f=g[0],v=g[1],_=gl((0,i.useState)(null==e?void 0:e.partyUuid),2),b=_[0],h=_[1],y=gl((0,i.useState)(null==e?void 0:e.locationUuid),2),k=y[0],C=y[1],E=gl((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:b,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,b,k,w]);var O=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemtransaction").concat(F(e)),n=(0,j.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),D=O.items,x=O.isLoading,N=O.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:D.results,totalCount:D.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:h,setStockBatchUuid:S}}(c),d=u.isLoading,m=u.items,p=u.tableHeaders,A=u.totalCount,g=u.setCurrentPage,f=u.setStockItemUuid,v=u.setLocationUuid,_=Nl((0,i.useState)(null),2),b=(_[0],_[1],Nl((0,i.useState)(null),2));b[0],b[1],(0,i.useEffect)((function(){f(t)}),[t,f]);var h,y=(0,lr.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 xl(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),date:V(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(he.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(he.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(V(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(Ra,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:h}):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,h]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(El,{children:function(){return l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement(wl,{onLocationIdChange:function(e){v(e),s(xl(Dl({},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})},Tl=function(e){var t=(0,E.useTranslation)().t,n=wt().stockLocations;return l().createElement(lr.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 Bl(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 Pl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ul(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}function jl(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 Fl=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 Bl(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)?Bl(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=to(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,lr.cI)({}).control;(0,i.useEffect)((function(){g(r)}),[r,g]);var b=(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]),h=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n,r,o,a,i;return jl(Ul({},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:V(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(El,{children:function(){return l().createElement(l().Fragment,null,l().createElement(Tl,{control:_,onLocationIdChange:function(e){f(e),s(jl(Ul({},c),{locationUuid:e}))},placeholder:v("filterByLocation","Filter by Location"),name:"BatchLocationUuid",controllerName:"BatchLocationUuid"}))},columns:b,data:h,totalItems:p,goToPage:A,hasToolbar:!0})};function zl(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 zl(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)?zl(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 Rl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ml=function(e){var t=e.stockItemUuid,n=function(e){var t=Ll((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Ll((0,i.useState)(10),2),a=o[0],l=o[1],c=Ll((0,i.useState)(null),2),s=c[0],u=c[1],d=Ll((0,i.useState)(1),2),m=d[0],p=d[1],A=Ll((0,i.useState)(),2),g=A[0],f=A[1],v=Ll((0,i.useState)(),2),_=v[0],b=v[1],h=Ll((0,i.useState)(),2),y=h[0],k=h[1],C=Ll((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,O=Ye(n),D=O.items,x=O.isLoading,N=O.isError;return{items:null!==(S=D.results)&&void 0!==S?S:[],totalCount:D.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:b,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){Rl(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:V(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(El,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1})};var ql=n(501),Gl={};Gl.styleTagTransform=b(),Gl.setAttributes=g(),Gl.insert=p().bind(null,"head"),Gl.domAPI=d(),Gl.insertStyleElement=v(),s()(ql.Z,Gl);const Hl=ql.Z&&ql.Z.locals?ql.Z.locals:void 0,Zl=function(e){var t=tn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(lr.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 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){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 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}}(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 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){e.isEditing;var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=function(e){var t=Ql((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=Ql((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(F(e)),n=(0,j.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,lr.cI)({defaultValues:{},mode:"all",resolver:(0,cr.F)(ai)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(lr.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:Hl.referencesTableContainer},l().createElement(a.iA_,Vl(Wl({},r()),{className:Hl.referencesTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,Vl(Wl({},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:Hl.referencesTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(Xl,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(Xl,{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(){ce("".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){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"));var t=le(e);(0,r.showSnackbar)({title:n("saveStockItemReferenceErrorTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceErrorMessage","Error saving stock item reference"+t.join(",")),kind:"error"})}))},kind:"primary",renderIcon:vo.vc},n("save","Save")))};var Xl=function(e){var t,n=e.isEditing,o=e.row,i=e.key,c=(0,E.useTranslation)().t,s=(0,lr.Gc)(),u=s.control,d=(s.formState.errors,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=le(e);(0,r.showSnackbar)({title:c("deleteStockItemReferenceTitle","Error Deleting a stockitem reference"),kind:"error",subtitle:t.join(",")})}))});return l().createElement(a.SCH,null,l().createElement(a.pj1,null,n?l().createElement(Zl,{row:o,name:"references",controllerName:"references",control:u,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:Hl.referencesTableCell},l().createElement(wr,{id:"".concat(o.uuid,"-").concat(i),name:"code",control:u,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:Ht.ZN,onClick:function(e){return d(e)}}))))};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}const ec=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 $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=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(ki,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(ml,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(Il,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Fl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(Ml,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Rules"),component:l().createElement(Vi,{stockItemUuid:o.uuid}),disabled:!r},{name:c("references","References"),component:l().createElement(Kl,{stockItemUuid:o.uuid,isEditing:r}),disabled:!r}];return l().createElement(Qn,{onChange:m,tabs:p,selectedIndex:u})};function tc(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 nc=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){tc(a,r,o,i,l,"next",e)}function l(e){tc(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?Ke:Ve)(e)];case 2:return(null==(n=s.sent())?void 0:n.data)&&((0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Item"),kind:"success",description:"Stock Item ".concat(t?"Edited":"Added"," Successfully")}),t||(Q(),(o=n.data).isDrug=!!o.drugUuid,rc(o,!0))),[3,4];case 3:return a=s.sent(),(0,r.showNotification)({title:"Error ".concat(t?"edit":"add","ing a stock item"),kind:"error",critical:!0,description: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)}}(),rc=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Y("".concat(t?"Edit":"Add"," ").concat((null==e?void 0:e.drugName)||""),l().createElement(ec,{model:e,onSave:function(e){return nc(e,t)},isEditing:t}))};const oc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){rc(Xa,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var ac=n(1048),ic={};ic.styleTagTransform=b(),ic.setAttributes=g(),ic.insert=p().bind(null,"head"),ic.domAPI=d(),ic.insertStyleElement=v(),s()(ac.Z,ic);const lc=ac.Z&&ac.Z.locals?ac.Z.locals:void 0,cc=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:lc.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 sc(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 uc(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 sc(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)?sc(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 dc=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"))},mc=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,rc(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};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}function Ac(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gc(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){Ac(e,t,n[t])}))}return e}function fc(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 vc=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 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}}(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(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem"))},d=function(e){(0,E.useTranslation)().t;var t=uc((0,i.useState)(1),2),n=t[0],o=t[1],a=uc((0,i.useState)(10),2),l=a[0],c=a[1],s=uc((0,i.useState)(null),2),u=s[0],d=s[1],m=uc((0,i.useState)(""),2),p=m[0],A=m[1],g=uc((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:l,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=Ze(f),b=_.items,h=_.isLoading,y=_.isError,k=(0,r.usePagination)(b.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:b.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:h,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,b=d.setCurrentPage,h=d.isDrug,y=d.setDrug,k=d.setSearchString,C=br((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 fc(gc({},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(mc,{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,rc(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(mt.I8,gc({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(cc,{filterType:h,changeFilterType:y}),l().createElement(dc,null),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(oc,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,fc(gc({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jn.desktopHeader:jn.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,fc(gc({className:r.isDesktop?jn.desktopRow:jn.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:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("div",{className:jn.tileContent},l().createElement("p",{className:jn.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:jn.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;b(t),f(n)},className:jn.paginationOverride}))},_c=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(vc,null))},bc=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function hc(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 yc(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 kc(){return kc=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){yc(a,r,o,i,l,"next",e)}function l(e){yc(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=le(n),(0,r.showToast)({description:o.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))})),kc.apply(this,arguments)}var Cc=n(2761),Ec={};Ec.styleTagTransform=b(),Ec.setAttributes=g(),Ec.insert=p().bind(null,"head"),Ec.domAPI=d(),Ec.insertStyleElement=v(),s()(Cc.Z,Ec);const wc=Cc.Z&&Cc.Z.locals?Cc.Z.locals:void 0;function Sc(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 Oc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dc(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){Oc(e,t,n[t])}))}return e}function xc(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 Sc(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)?Sc(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 Nc=sr.z.object({name:sr.z.string().max(255)});const Ic=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,_=xc((0,i.useState)(!1),2),b=_[0],h=_[1],y=xc((0,i.useState)(""),2),k=y[0],C=y[1],w=(o="".concat(r.restBaseUrl,"/locationtag/"),s=(c=(0,j.ZP)(o,r.openmrsFetch)).data,c.error,u=c.isLoading,c.isValidating,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,lr.cI)({mode:"all",resolver:(0,cr.F)(Nc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),O=S.handleSubmit,D=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:O((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};Nc.safeParse(e).success&&(h(!1),A(i))}),(function(e){C(Object.entries(e)[0][1].message),h(!0)}))},l().createElement(a.fef,{hasScrollingContent:!0},l().createElement(a.Kqy,{gap:3},l().createElement(a.cwH,{legendText:""},l().createElement(lr.Qr,{name:"name",control:D,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,Dc({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:wc.loaderContainer},l().createElement(lr.Qr,{name:"tags",control:D,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=Dc({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))}}))),b&&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 h(!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"))))))},Tc=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 kc.apply(this,arguments)})({locationPayload:{name:t,tags:i}}).then((function(){(0,r.showToast)({title:a("formCreated","Add Location"),kind:"success",critical:!0,description:a("Location ".concat(t," was created successfully."))}),o(),n(!1)})).catch((function(e){(0,r.showNotification)({title:a("errorCreatingForm","Error creating location"),kind:"error",critical:!0,description:null==e?void 0:e.message}),n(!1)})),n(!1)}),[n,o,a]);return l().createElement(l().Fragment,null,l().createElement(Ic,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};function Bc(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}const Uc=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 Bc(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)?Bc(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=wt(),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 hc(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)?hc(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(){ce("".concat(r.restBaseUrl,"/Location?_summary=data"))};return A?l().createElement(a.gqd,{role:"progressbar"}):(null==p?void 0:p.length)?l().createElement(El,{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(Tc,{onModalChange:s,showModal:c,mutate:j.JG}):null,l().createElement(a.zxk,{kind:"ghost",renderIcon:function(e){return l().createElement(he.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){Pc(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:jn.tileContainer},l().createElement(a.n9L,{className:jn.tile},l().createElement("p",{className:jn.content},"No stock items to display")))},jc=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Uc,null))};var Fc=n(557),zc={};zc.styleTagTransform=b(),zc.setAttributes=g(),zc.insert=p().bind(null,"head"),zc.domAPI=d(),zc.insertStyleElement=v(),s()(Fc.Z,zc);const Lc=Fc.Z&&Fc.Z.locals?Fc.Z.locals:void 0;function Rc(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 Mc,qc=sr.z.object({startDate:sr.z.coerce.date().optional(),endDate:sr.z.coerce.date().optional(),location:sr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:sr.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:sr.z.string().optional(),mostLeastMoving:sr.z.string().optional(),mostLeastMovingName:sr.z.string().optional(),stockItemUuid:sr.z.string().optional(),stockItemName:sr.z.string().optional(),patientUuid:sr.z.string().optional(),patientName:sr.z.string().optional(),locationUuid:sr.z.string().optional(),childLocations:sr.z.boolean().optional(),stockSourceUuid:sr.z.string().optional(),stockSource:sr.z.string().optional(),stockSourceDestinationUuid:sr.z.string().optional(),stockSourceDestination:sr.z.string().optional(),inventoryGroupBy:sr.z.string().optional(),stockItemCategory:sr.z.string().optional(),inventoryGroupByName:sr.z.string().optional(),stockItemCategoryConceptUuid:sr.z.string().optional(),reportSystemName:sr.z.string().optional(),maxReorderLevelRatio:sr.z.number().optional(),fullFillment:sr.z.string().array().optional(),limit:sr.z.string().optional(),date:sr.z.coerce.date().optional()}).superRefine((function(e,t){"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName&&(e.startDate||t.addIssue({code:sr.z.ZodIssueCode.custom,message:"Start Date is required ",path:["startDate"]}),e.endDate||t.addIssue({code:sr.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:sr.z.ZodIssueCode.custom,message:"Date is required ",path:["date"]}),e.inventoryGroupBy||t.addIssue({code:sr.z.ZodIssueCode.custom,message:"Inventory by is required ",path:["inventoryGroupBy"]}))}));function Gc(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"}(Mc||(Mc={}));var Hc=function(e){return Zc(e)?4:e?20:null},Zc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Yc="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 Jc(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 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)||Kc(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 Vc(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)||Kc(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 Kc(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 Xc=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,j.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=wt().stockLocations,v=Nt(m),_=v.items,b=(v.isLoading,Wc((0,i.useState)(!1),2)),h=b[0],y=b[1],k=Wc((0,i.useState)(!1),2),C=k[0],w=k[1],S=Wc((0,i.useState)(!1),2),O=S[0],D=S[1],x=Wc((0,i.useState)(!1),2),N=x[0],I=x[1],T=Wc((0,i.useState)(!1),2),B=T[0],P=T[1],U=Wc((0,i.useState)(!1),2),F=U[0],z=U[1],L=Wc((0,i.useState)(!1),2),R=L[0],M=L[1],q=Wc((0,i.useState)(!1),2),G=q[0],H=q[1],Z=Wc((0,i.useState)(!1),2),Y=Z[0],J=Z[1],W=Wc((0,i.useState)(!1),2),te=W[0],ne=W[1],re=Wc((0,i.useState)(!1),2),oe=re[0],ae=re[1],ie=Wc((0,i.useState)(!1),2),le=ie[0],ce=ie[1],se=Wc((0,i.useState)(!1),2),ue=se[0],de=se[1],me=Wc((0,i.useState)(!1),2),pe=me[0],Ae=me[1],ge=Wc((0,i.useState)(!1),2),fe=ge[0],ve=ge[1],_e=Wc((0,i.useState)(""),2),be=_e[0],he=_e[1];(0,i.useEffect)((function(){var e=!1;if(be){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===be}));v&&(y(null===(t=v.parameters)||void 0===t?void 0:t.some((function(e){return e===Mc.Date}))),w(null===(n=v.parameters)||void 0===n?void 0:n.some((function(e){return e===Mc.StartDate}))),D(null===(r=v.parameters)||void 0===r?void 0:r.some((function(e){return e===Mc.EndDate}))),I(null===(o=v.parameters)||void 0===o?void 0:o.some((function(e){return e===Mc.StockItemCategory}))),P(null===(a=v.parameters)||void 0===a?void 0:a.some((function(e){return e===Mc.Location}))),z(null===(i=v.parameters)||void 0===i?void 0:i.some((function(e){return e===Mc.ChildLocations}))),M(null===(l=v.parameters)||void 0===l?void 0:l.some((function(e){return e===Mc.StockSource}))),H(null===(c=v.parameters)||void 0===c?void 0:c.some((function(e){return e===Mc.StockSourceDestination}))),J(null===(s=v.parameters)||void 0===s?void 0:s.some((function(e){return e===Mc.InventoryGroupBy}))),ne(null===(u=v.parameters)||void 0===u?void 0:u.some((function(e){return e===Mc.MaxReorderLevelRatio}))),ce(null===(d=v.parameters)||void 0===d?void 0:d.some((function(e){return e===Mc.StockItem}))),ae(null===(m=v.parameters)||void 0===m?void 0:m.some((function(e){return e===Mc.Patient}))),de(null===(p=v.parameters)||void 0===p?void 0:p.some((function(e){return e===Mc.Limit}))),Ae(null===(g=v.parameters)||void 0===g?void 0:g.some((function(e){return e===Mc.MostLeastMoving}))),ve(null===(f=v.parameters)||void 0===f?void 0:f.some((function(e){return e===Mc.Fullfillment}))),e=!0)}e||(y(!1),w(!1),D(!1),I(!1),P(!1),z(!1),M(!1),H(!1),J(!1),ne(!1),ce(!1),ae(!1),de(!1),Ae(!1),ve(!1))}),[be,A]);var ye=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Vc(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,lr.cI)({mode:"all",resolver:(0,cr.F)(qc)}),Ce=ke.handleSubmit,Ee=ke.control,we=ke.formState,Se=we.errors,Oe=(we.defaultValues,we.isDirty,ke.setValue);if(g)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var De=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){Jc(a,r,o,i,l,"next",e)}function l(e){Jc(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,_,b,y,k,E,w,S,D,x,I,T,P,U,j,z,L,M,q,H,Z,J,W,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(Mc.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(Mc.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(Mc.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(Mc.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)),Y&&(a+=xe(Mc.InventoryGroupBy,null!==(y=e.inventoryGroupBy)&&void 0!==y?y:"LocationStockItemBatchNo",null!==(k=null===(b=e.inventoryGroupByName)||void 0===b?void 0:b.trim())&&void 0!==k?k:"Stock Item Batch Number",d("stockmanagement.report.edit.inventorygroupby"),o)),B&&(a+=xe(Mc.Location,e.location,null!==(w=null===(E=e.location)||void 0===E?void 0:E.trim())&&void 0!==w?w:"",d("Location"),o),F&&(a+=xe(Mc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",d("Include Child Locations"),o))),te&&(a+=xe(Mc.MaxReorderLevelRatio,(null!==(S=e.maxReorderLevelRatio)&&void 0!==S?S:0).toString(),(null!==(D=e.maxReorderLevelRatio)&&void 0!==D?D:0).toString()+"%",d("stockmanagement.report.edit.maxreorderlevelratio"),o)),R&&(a+=xe(Mc.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(Mc.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(Mc.MostLeastMoving,null!==(L=e.mostLeastMoving)&&void 0!==L?L:"MostMoving",null!==(M=null===(z=e.mostLeastMovingName)||void 0===z?void 0:z.trim())&&void 0!==M?M:"Most Moving",d("stockmanagement.report.edit.mostleastmoving"),o)),ue&&(a+=xe(Mc.Limit,(null!==(H=null!==(q=e.limit)&&void 0!==q?q:Hc(e.reportSystemName))&&void 0!==H?H:20).toString(),(null!==(J=null!==(Z=e.limit)&&void 0!==Z?Z:Hc(e.reportSystemName))&&void 0!==J?J:20).toString(),d(function(e){return Zc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),o)),h&&(a+=xe(Mc.Date,e.date?JSON.stringify(e.date).replaceAll('"',""):"",null!==(W=V(e.date))&&void 0!==W?W:"",d("stockmanagement.report.edit.date"),o)),C&&(a+=xe(Mc.StartDate,e.startDate?JSON.stringify(e.startDate).replaceAll('"',""):"",null!==(K=V(e.startDate))&&void 0!==K?K:"",d(function(e){return Zc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),o)),O&&(a+=xe(Mc.EndDate,e.endDate?JSON.stringify(e.endDate).replaceAll('"',""):"",null!==(X=V(e.endDate))&&void 0!==X?X:"",d(function(e){return Zc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),o)),[4,Gc({batchJobType:"Report",description:e.reportName,parameters:a}).then((function(e){Q(),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(De,(function(e){console.error(e)}))},l().createElement("div",{className:Lc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,d("reportName","Report")),l().createElement(lr.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,he(n)}})}})),N&&l().createElement(l().Fragment,null,l().createElement("span",null,d("stockItemCategory","Stock Item Category")),l().createElement(lr.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(lr.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:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:K,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}))}}),O&&l().createElement(lr.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:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:K,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}))}}),Y&&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 Oe("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 Oe("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})}))),F&&l().createElement(lr.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(lr.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(lr.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(lr.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?Vc(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?Vc(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?Vc(r.filter((function(e){return"All"!==e}))).concat(["None"]):r.filter((function(e){return"None"!==e})))},labelText:d("noneFulfillment","Non Fulfillment")}))}})),h&&l().createElement(lr.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:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"date",name:"date",placeholder:K,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:Lc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Q},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},d("continue","Continue"))))},$c=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("New Report",l().createElement(Xc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var es=n(5861),ts={};ts.styleTagTransform=b(),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=n(6811),os=n(3570);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}const cs=function(){var e=(0,E.useTranslation)().t,t=function(){ce("".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,j.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 Rc(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)?Rc(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,b=v.results,h=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:b,totalItems:null==d||null===(o=d.data)||void 0===o||null===(n=o.results)||void 0===n?void 0:n.length,currentPage:h,currentPageSize:g,paginatedItems:b,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,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"}]}),[]),f=(0,i.useCallback)((function(e,t){e&&window.open(function(e,t){return"".concat(ae,"ws/rest/v1/stockmanagement/batchjobartifact?id=").concat(e).concat("&download=1")}(e),"_blank")}),[]),v=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o;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:(o=e.dateCreated,o?W()(o).format("DD-MMM-YYYY HH:mm"):""),parameters:"",report:e.description,requestedBy:null==e||null===(n=e.owners)||void 0===n?void 0:n.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(lt.Od,{className:"report-failed",title:e.status}),"Cancelled"===e.status&&l().createElement(rs.mg,{className:"report-cancelled",title:e.status}),e.status===Yc&&l().createElement(No.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(os.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:Ht.G7}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Copy",kind:"ghost",renderIcon:be.CK}),(null==e?void 0:e.status)===Yc&&(null!==(r=e.outputArtifactSize)&&void 0!==r?r:0)>0&&l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Download",kind:"ghost",renderIcon:mt.UW,onClick:function(){return f(e.uuid,e.outputArtifactFileExt)}}))})}))}),[o,f]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:ns.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:v,headers:g,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:ns.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:t},"Refresh")),l().createElement($c,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?ns.desktopHeader:ns.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?ns.desktopRow:ns.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:ns.tileContainer},l().createElement(a.n9L,{className:ns.tile},l().createElement("div",{className:ns.tileContent},l().createElement("p",{className:ns.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:ns.helper},e("checkFilters","Check the filters above"))))):null)}}),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:ns.paginationOverride}))};function ss(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 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(he.ol,{size:16}))))}),ds),As=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),ds),gs=(0,r.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Pe.BrowserRouter,{basename:e},l().createElement("div",{className:Oe.container},l().createElement(Be,null),l().createElement("div",null,l().createElement(_e,null),l().createElement(Pe.Routes,null,l().createElement(Pe.Route,{path:"overview",element:l().createElement(gt,null)}),l().createElement(Pe.Route,{path:"",element:l().createElement(gt,null)}),l().createElement(Pe.Route,{path:"stock-items",element:l().createElement(_c,null)}),l().createElement(Pe.Route,{path:"stock-operations",element:l().createElement(Ka,null)}),l().createElement(Pe.Route,{path:"stock-user-scopes",element:l().createElement(Xt,null)}),l().createElement(Pe.Route,{path:"stock-sources",element:l().createElement(In,null)}),l().createElement(Pe.Route,{path:"stock-locations",element:l().createElement(jc,null)}),l().createElement(Pe.Route,{path:"stock-reports",element:l().createElement(cs,null)}),l().createElement(Pe.Route,{path:"stock-settings",element:l().createElement(bc,null)}))),l().createElement(Ee,null)))}),ds),fs=(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=de((0,i.useState)(""),2),A=p[0],g=p[1],f=de((0,i.useState)(!1),2),v=f[0],_=f[1],b=(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(),Q(),ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))}),(function(e){_(!1);var t=le(e);(0,r.showSnackbar)({title:m("errorDescriptionTitle","Error on saving form"),subtitle:m("errorDescription",t.join(", ")),kind:"error"}),u(),Q()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){ue(a,r,o,i,l,"next",e)}function l(e){ue(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:b},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:P.modalBody},l().createElement("section",{className:P.section},l().createElement("h5",{className:P.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:P.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),vs=(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:I.productiveHeading03},o("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.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}),_s=(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:I.productiveHeading03},o("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.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:us}),bs=(0,r.getSyncLifecycle)((function(e){var t=e.row,n=e.closeModal,o=(0,E.useTranslation)().t,c=$i(),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 ss(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)?ss(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:ll.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.showToast)({critical:!0,title:o("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:o("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showNotification)({title:o("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))},disabled:A.length<1},o("yes","Yes"))))}),{featureName:"delete-packaging-unit-modal",moduleName:us}),hs=(0,r.getSyncLifecycle)(ol,{featureName:"delete-packging-unit-button",moduleName:us}),ys=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=D((0,i.useState)(),2),c=o[0],s=o[1],u=D((0,i.useState)(!0),2),d=u[0],m=(u[1],D((0,i.useState)(!0),2)),p=(m[0],m[1]);return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:t,title:n("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?(s(r),p(!1)):e.preventDefault()},onDelete:function(){p(!0)}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:t},n("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(c){var e=new FormData;c&&(e.append("file",c,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,r.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,r.showNotification)({title:n("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}}},n("uploadStockItems","Upload StockItems")))))}),ds),ks=(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 Cs(){(0,r.defineConfigSchema)(us,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}}]);
|