@openmrs/esm-stock-management-app 1.0.1-pre.380 → 1.0.1-pre.383
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/56.js +1 -1
- package/dist/56.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/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +2 -2
package/dist/56.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[56],{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__patientListSearch___eGIzx{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__patientListSearch___eGIzx 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__patientListDownload___J2Ob4{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,yDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,+DACE,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,2DACE,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_",patientListSearch:"-esm-stock-management__table__patientListSearch___eGIzx",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",patientListDownload:"-esm-stock-management__table__patientListDownload___J2Ob4",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,CHpBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,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,kFAME,eAAA,CALA,iLACE,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}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACI,gBAAA,CACA,aAAA,CAGJ,kEACI,YAAA,CACA,kBAAA,CAEJ,oEACI,gBCyDS,CDtDb,yEACI,gBAAA,CACA,aAAA",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"};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:8px;height:100%}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL{padding-bottom:8px}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL .cds--list-box__menu{min-width:15rem;z-index:1}',"",{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,CGrGJ,sEACI,qBHGY,CGFZ,YDyBS,CCxBT,gBAAA,CAGF,iEACE,qBHNI,CGOJ,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEF,2DFw0BE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CEt0BA,aJvBM,CIwBN,mBAAA,CAGF,0DFk0BE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CEh0BA,aJ7BM,CIgCR,6DF6zBE,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CE3zBA,aJlCM,CImCN,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBJzCI,CI0CJ,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,CAEF,6DACE,eAAA,CACA,WAAA,CAEF,gEACE,kBAAA,CAEA,qFACE,eAAA,CACA,SAAA",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},5464:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deleteStockModal:()=>Kc,deleteUserScopeModal:()=>Vc,importBulkStockItemsDialog:()=>Xc,importTranslation:()=>Zc,startupApp:()=>es,stockManagement:()=>Qc,stockManagementAdminCardLink:()=>Yc,stockManagementAppMenuItem:()=>$c,stockManagementDashboard:()=>Jc,stockOperationDialog:()=>Wc});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(2034),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 D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(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 D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}(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),K=function(e,t){return e?W()(e).format(null!=t?t:"DD-MMM-YYYY"):""},V=("".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 K(e,V)},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 De=we.Z&&we.Z.locals?we.Z.locals:void 0;var Oe=n(1940),xe={};xe.styleTagTransform=b(),xe.setAttributes=g(),xe.insert=p().bind(null,"head"),xe.domAPI=d(),xe.insertStyleElement=v(),s()(Oe.Z,xe);const Ne=Oe.Z&&Oe.Z.locals?Oe.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","Stock Items"),link:"stock-items"},{name:n("stockManagementOperations","Stock Operations"),link:"stock-operations"},{name:n("stockManagementStockUserScopes","Stock User Role Scopes"),link:"stock-user-scopes"},{name:n("stockManagementStockSources","Stock Sources"),link:"stock-sources"},{name:n("stockManagementLocations","Stock Locations"),link:"stock-locations"},{name:n("stockManagementReports","Stock Reports"),link:"stock-reports"},{name:n("stockManagementSettings","Stock 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,u=e.label,d=e.value,m=e.headerLabel,p=e.children,A=e.view,g=e.count,f=e.outofstockCount,v=e.disposedCount,_=(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},m),p),A&&l().createElement(r.ConfigurableLink,{className:Re.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},_("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},u),l().createElement("p",{className:Re.totalsValue},d)),!(0,Me.Z)(g)&&l().createElement("div",{className:Re.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},_("in7days","In 7 days")),l().createElement("span",{style:{color:" #FABA5F"}},_("in30days","In 30 days")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=g.expiry7days)||void 0===t?void 0:t.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(n=g.expiry30days)||void 0===n?void 0:n.length)),!(0,Me.Z)(f)&&l().createElement("div",{className:Re.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},_("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},_("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(o=f.itemsbelowmin)||void 0===o?void 0:o.length),l().createElement("p",{style:{color:"#319227"}},null===(i=f.itemsabovemax)||void 0===i?void 0:i.length)),!(0,Me.Z)(v)&&l().createElement("div",{className:Re.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},_("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},_("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(c=v.expired)||void 0===c?void 0:c.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(s=v.poorquality)||void 0===s?void 0:s.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;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 Ke(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 Ve(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"),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-m)/864e5);return r<=t||r<0})),g=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 f=o.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=7})),v=o.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=30})),_=g&&g.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),b=g&&g.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:{expiry7days:f,expiry30days:v}}),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:f,itemsabovemax:v}}),l().createElement(He,{label:t("disposedstock","Disposed Stock"),value:(null==g?void 0:g.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:_,poorquality:b}})))};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,$e()),i=o.items;if(o.isLoading)return l().createElement(l().Fragment,null);if(0===(null==i?void 0:i.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:it.content},e("inventoryAlertNull","No inventory alerts to display")));var c=new Date,s=n.map((function(e){var t=null==i?void 0:i.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)}));s=s.filter((function(e){return e.hasExpiration}));var u=s.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),r=Math.ceil((n-c)/864e5);return r<=t||r<0}));return l().createElement(l().Fragment,null,u.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(4857);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 Dt(){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 Ot(){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}}var It=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function Tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bt(e,t,n,r,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 Pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(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){Pt(e,t,n[t])}))}return e}function jt(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 Ft(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)||Lt(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 Tt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Lt(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 Lt(e,t){if(e){if("string"==typeof e)return Tt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tt(e,t):void 0}}var Rt=ee();const Mt=function(e){var t,n,o,c,s,u,d,m=e.model,p=(0,E.useTranslation)().t,A=Ft((0,i.useState)(Ut({},m)),2),g=A[0],f=A[1],v=Ft((0,i.useState)([]),2),_=v[0],b=v[1],h=Ft((0,i.useState)(!1),2),y=(h[0],h[1]),k=Dt(),C=k.types.results,w=k.isLoading,S=xt({v:U.Default}),D=S.items,O=S.isLoading,x=Ft((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=Ft((0,i.useState)(""),2),R=(L[0],L[1]),M=Ft((0,i.useState)([]),2),q=M[0],G=M[1],H=null!==(o=null==D?void 0:D.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){It("ws/rest/v1/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){Bt(o,n,r,a,i,"next",e)}function i(e){Bt(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e){return s.apply(this,arguments)});return w||F||O?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==D||null===(t=D.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(jt(Ut({},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(jt(Ut({},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(jt(Ut({},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(jt(Ut({},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:$(Rt),locale:"en",dateFormat:X,onChange:function(e){f(jt(Ut({},g),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,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:V,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(jt(Ut({},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(jt(Ut({},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==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=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(jt(Ut({},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=zt(null!==(l=null==g?void 0:g.locations)&&void 0!==l?l:[]).concat([s]);f(jt(Ut({},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")))))},qt=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Mt,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function Gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ht=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Mt,{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){Gt(e,t,n[t])}))}return e}({size:16},e))}})};var Zt=n(1657);function Yt(e,t){(null==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 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 Jt=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 Yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yt(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(){It("ws/rest/v1/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(Zt.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){Qt(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kt(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){Wt(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 Xt=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=ht({v:U.Default,totalCount:!0}),o=n.items,c=n.totalItems,s=n.currentPage,u=n.pageSizes,d=n.goTo,m=n.currentPageSize,p=n.setPageSize,A=n.isLoading,g=(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"}]}),[]),f=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(n,r){var i,c,s,u,d,m;return Vt(Kt({},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===(i=n.locations)||void 0===i?void 0:i.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===(c=s.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===c?void 0:c.join(", "),permanent:(null==n?void 0:n.permanent)?e("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),activeFrom:null!==(u=K(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=K(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(Ht,{data:o[r]}),l().createElement(Jt,{uuid:o[r].uuid}))})}))}),[t.user.uuid,o,e]);return A?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!=f?f:[],headers:g,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,o=t.headers,i=t.getHeaderProps,c=t.getTableProps,s=t.getRowProps,u=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:u}),l().createElement(qt,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,Vt(Kt({},i({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,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Kt({className:r.isDesktop?_t.desktopRow:_t.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===n.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:s,pageSize:m,pageSizes:u,totalItems:c,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&p(t),n!==s&&d(n)},className:_t.paginationOverride}))},$t=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Xt,null))};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}function tn(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}function nn(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 rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var on=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})},an=n(8098),ln={};ln.styleTagTransform=b(),ln.setAttributes=g(),ln.insert=p().bind(null,"head"),ln.domAPI=d(),ln.insertStyleElement=v(),s()(an.Z,ln);const cn=an.Z&&an.Z.locals?an.Z.locals:void 0;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 un(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){un(e,t,n[t])}))}return e}function mn(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 pn=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)(dn({},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 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}}(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=tn({},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")}),on("ws/rest/v1/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:cn.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(mn(dn({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:cn.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(mn(dn({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:cn.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(mn(dn({},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")))))},An=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(pn,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var gn=n(5551),fn={};fn.styleTagTransform=b(),fn.setAttributes=g(),fn.insert=p().bind(null,"head"),fn.domAPI=d(),fn.insertStyleElement=v(),s()(gn.Z,fn);const vn=gn.Z&&gn.Z.locals?gn.Z.locals:void 0;function _n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const bn=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:vn.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return _n(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 _n(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_n(e,t):void 0}}(t)||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 hn=n(6940),yn={};yn.styleTagTransform=b(),yn.setAttributes=g(),yn.insert=p().bind(null,"head"),yn.domAPI=d(),yn.insertStyleElement=v(),s()(hn.Z,yn);const kn=hn.Z&&hn.Z.locals?hn.Z.locals:void 0;function Cn(e,t){(null==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 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,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 Cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cn(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),on("ws/rest/v1/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(Zt.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){En(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dn=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(pn,{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){Sn(e,t,n[t])}))}return e}({size:16},e))}})};function On(e,t){(null==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 xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){xn(e,t,n[t])}))}return e}function In(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 Tn=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 On(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?On(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=nn(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 rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((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}),d=u.items,m=u.totalItems,p=u.tableHeaders,A=u.currentPage,g=u.pageSizes,f=u.goTo,v=u.currentPageSize,_=u.setPageSize,b=u.isLoading,h=(0,i.useMemo)((function(){return null==d?void 0:d.map((function(e,t){var n;return In(Nn({},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(Dn,{data:d[t]}),l().createElement(wn,{uuid:d[t].uuid}))})}))}),[d]),y=function(e){s(e)},k=(0,i.useMemo)((function(){return c?h.filter((function(e){return e.sourceType===c})):h}),[h,c]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:kn.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:k,headers:p,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,c=e.getTableProps,s=e.getRowProps,u=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:kn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(bn,{onFilterChange:y})),l().createElement(An,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,In(Nn({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?kn.desktopHeader:kn.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,Nn({className:r.isDesktop?kn.desktopRow:kn.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:kn.tileContainer},l().createElement(a.n9L,{className:kn.tile},l().createElement("div",{className:kn.tileContent},l().createElement("p",{className:kn.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:kn.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:A,pageSize:v,pageSizes:g,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==v&&_(t),n!==A&&f(n)},className:kn.paginationOverride}))},Bn=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Tn,null))};function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Un(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 Pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(e,t):void 0}}(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 jn=n(1535),Fn={};Fn.styleTagTransform=b(),Fn.setAttributes=g(),Fn.insert=p().bind(null,"head"),Fn.domAPI=d(),Fn.insertStyleElement=v(),s()(jn.Z,Fn);const zn=jn.Z&&jn.Z.locals?jn.Z.locals:void 0;var Ln="RETURNED",Rn="CANCELLED",Mn="REJECTED",qn=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Ln,Rn,Mn],Gn=n(6817);function Hn(e,t){(null==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 Zn=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Dt(),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 Hn(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 Hn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hn(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(Gn.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 Yn=n(5260),Qn={};Qn.styleTagTransform=b(),Qn.setAttributes=g(),Qn.insert=p().bind(null,"head"),Qn.domAPI=d(),Qn.insertStyleElement=v(),s()(Yn.Z,Qn);const Jn=Yn.Z&&Yn.Z.locals?Yn.Z.locals:void 0,Wn=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?Jn.tabContainer:"","\n ").concat(Jn.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Jn.heading},n),l().createElement("div",{className:Jn.tab},l().createElement(a.mQc,{className:"".concat(Jn.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 Kn,Vn;function Xn(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}(Vn=Kn||(Kn={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Vn.DISPOSED_OPERATION_TYPE="disposed",Vn.STOCK_ISSUE_OPERATION_TYPE="stockissue",Vn.STOCK_TAKE_OPERATION_TYPE="stocktake",Vn.REQUISITION_OPERATION_TYPE="requisition",Vn.OPENING_STOCK_OPERATION_TYPE="initial",Vn.RECEIPT_OPERATION_TYPE="receipt",Vn.RETURN_OPERATION_TYPE="return",Vn.ADJUSTMENT_OPERATION_TYPE="adjustment";var $n=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},er=function(e){return!tr(e)&&"requisition"!==e},tr=function(e){return"receipt"===e||"initial"===e},nr=function(e){return"requisition"===e},rr=function(e){return"receipt"===e||"initial"===e},or=function(e){return"stockissue"===e||"return"===e},ar=function(e){return"stockissue"===e||ir(e)||lr(e)||cr(e)},ir=function(e){return"requisition"===e},lr=function(e){return"receipt"===e},cr=function(e){return"transferout"===e},sr=n(7536),ur=n(6312),dr=n(1604),mr=dr.z.object({id:dr.z.string().nullish(),uuid:dr.z.string().nullish(),stockItemUuid:dr.z.string().nullish(),packagingUomName:dr.z.string().nullish(),packagingUomUuid:dr.z.string().nullish(),factor:dr.z.number().nullish(),isDefaultStockOperationsUoM:dr.z.boolean().nullish(),isDispensingUnit:dr.z.boolean().nullish()}),pr=dr.z.object({canView:dr.z.boolean(),canEdit:dr.z.boolean(),canApprove:dr.z.boolean().nullish(),canReceiveItems:dr.z.boolean().nullish(),canDisplayReceivedItems:dr.z.boolean().nullish(),isRequisitionAndCanIssueStock:dr.z.boolean().nullish(),canUpdateBatchInformation:dr.z.boolean().nullish()}),Ar=dr.z.object({itemIndex:dr.z.number().nullish(),id:dr.z.string().nullish(),uuid:dr.z.string().nullish(),stockItemUuid:dr.z.string().nullish(),stockItemName:dr.z.string().nullish(),stockItemPackagingUOMUuid:dr.z.string().nullish(),stockItemPackagingUOMName:dr.z.string().nullish(),stockBatchUuid:dr.z.string().nullish(),batchNo:dr.z.string().nullish(),expiration:dr.z.coerce.date().nullish(),quantity:dr.z.number().nullish(),purchasePrice:dr.z.number().nullish(),permission:pr.nullish(),edit:dr.z.boolean().nullish(),hasExpiration:dr.z.boolean().nullish(),packagingUnits:mr.array(),quantityReceived:dr.z.number().nullish(),quantityReceivedPackagingUOMName:dr.z.string().nullish(),quantityReceivedPackagingUOMUuid:dr.z.string().nullish(),quantityRequested:dr.z.number().nullish(),quantityRequestedPackagingUOMUuid:dr.z.string().nullish(),quantityRequestedPackagingUOMName:dr.z.string().nullish(),commonName:dr.z.string().nullish(),acronym:dr.z.string().nullish()}),gr=(dr.z.object({uuid:dr.z.string().nullish(),cancelReason:dr.z.string().nullish(),cancelledBy:dr.z.coerce.number(),cancelledByGivenName:dr.z.string().nullish(),cancelledByFamilyName:dr.z.string().nullish(),cancelledDate:dr.z.coerce.date(),completedBy:dr.z.coerce.number(),completedByGivenName:dr.z.string().nullish(),completedByFamilyName:dr.z.string().nullish(),completedDate:dr.z.coerce.date(),destinationUuid:dr.z.string().nullish(),destinationName:dr.z.string().nullish(),externalReference:dr.z.string().nullish(),atLocationUuid:dr.z.string().nullish(),atLocationName:dr.z.string().nullish(),operationDate:dr.z.coerce.date(),submitted:dr.z.boolean(),submittedBy:dr.z.string().nullish(),submittedByGivenName:dr.z.string().nullish(),submittedByFamilyName:dr.z.string().nullish(),locked:dr.z.boolean(),operationNumber:dr.z.string().nullish(),operationOrder:dr.z.coerce.number(),remarks:dr.z.string().nullish(),sourceUuid:dr.z.string().nullish(),sourceName:dr.z.string().nullish(),status:dr.z.enum(qn),returnReason:dr.z.string().nullish(),rejectionReason:dr.z.string().nullish(),operationTypeUuid:dr.z.string().nullish(),operationType:dr.z.string().nullish(),operationTypeName:dr.z.string().nullish(),responsiblePerson:dr.z.coerce.number(),responsiblePersonUuid:dr.z.string().nullish(),responsiblePersonGivenName:dr.z.string().nullish(),responsiblePersonFamilyName:dr.z.string().nullish(),responsiblePersonOther:dr.z.string().nullish(),creator:dr.z.coerce.number(),dateCreated:dr.z.coerce.date(),creatorGivenName:dr.z.string().nullish(),creatorFamilyName:dr.z.string().nullish(),permission:pr.nullish(),reasonUuid:dr.z.string().nullish(),reasonName:dr.z.string().nullish(),approvalRequired:dr.z.boolean().nullish(),stockOperationItems:Ar.array(),submittedDate:dr.z.coerce.date(),returnedByGivenName:dr.z.string().nullish(),returnedByFamilyName:dr.z.string().nullish(),returnedDate:dr.z.coerce.date(),rejectedByGivenName:dr.z.string().nullish(),rejectedByFamilyName:dr.z.string().nullish(),rejectedDate:dr.z.coerce.date(),dispatchedByGivenName:dr.z.string().nullish(),dispatchedByFamilyName:dr.z.string().nullish(),dispatchedDate:dr.z.coerce.date(),requisitionStockOperationUuid:dr.z.string()}),dr.z.object({operationDate:dr.z.coerce.date(),sourceUuid:dr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:dr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:dr.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:dr.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:dr.z.string().nullish(),remarks:dr.z.string().nullish()})),fr=function(e){switch(e){case Kn.OPENING_STOCK_OPERATION_TYPE:return gr.omit({destinationUuid:!0,reasonUuid:!0});case Kn.STOCK_TAKE_OPERATION_TYPE:case Kn.ADJUSTMENT_OPERATION_TYPE:case Kn.DISPOSED_OPERATION_TYPE:return gr.omit({destinationUuid:!0});case Kn.TRANSFER_OUT_OPERATION_TYPE:case Kn.STOCK_ISSUE_OPERATION_TYPE:return gr.omit({reasonUuid:!0}).merge(dr.z.object({destinationUuid:dr.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Kn.RETURN_OPERATION_TYPE:case Kn.REQUISITION_OPERATION_TYPE:case Kn.RECEIPT_OPERATION_TYPE:return gr.omit({reasonUuid:!0}).merge(dr.z.object({sourceUuid:dr.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const vr=function(e){return l().createElement(sr.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 _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,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 hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yr(e){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 hr(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 hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hr(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 kr=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:""}},Cr={uuid:"Other",display:"Other",person:{display:"Other"}};function Er(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const wr=function(e){var t=function(e){var t=br((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=br((0,i.useState)(null),2),s=c[0],u=c[1],d=br((0,i.useState)(10),2),m=d[0],p=d[1],A=br((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=yr((function(e){o(e)}),1e3);return r&&r.push(Cr),l().createElement("div",null,l().createElement(sr.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:Er,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 Sr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dr=function(e){return l().createElement(sr.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){Sr(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))}})},Or=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(sr.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 xr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nr=function(e){return l().createElement(sr.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){xr(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 Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Tr=(0,i.createContext)(null),Br=function(){return(0,i.useContext)(Tr)},Pr=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 Ir(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(e,t):void 0}}(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(Tr.Provider,{value:a},r)},Ur=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.RECEIPT_OPERATION_TYPE,Kn.STOCK_ISSUE_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.RETURN_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE,Kn.TRANSFER_OUT_OPERATION_TYPE],jr=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE];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 zr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Lr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rr(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.")}()}const Mr=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,D=k.sourcePartyList,O=k.destinationPartyList,x=(0,E.useTranslation)().t,N=(Br().setFormContext,Un({v:U.Full,totalCount:!0})),T=N.isLoading,B=(N.items,Xn(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){Lr(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,sr.cI)({defaultValues:"stockissue"===B?P:v,mode:"all",resolver:(0,ur.F)(fr(B))}),F=j.handleSubmit,z=j.control,L=j.formState.errors,R=j.setValue,M=Rr((0,i.useState)(),2),q=M[0],G=M[1],H=Rr((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,K,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 Ur.includes(e)}(n)&&delete r.destinationName,function(e){return jr.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){zr(a,r,o,i,l,"next",e)}function l(e){zr(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(sr.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:n},l().createElement(a.aj6,{invalid:!!L.operationDate,invalidText:null==L||null===(t=L.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:x("operationDate","Operation Date"),value:$(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(vr,{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:D||[]}),(!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(vr,{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:O||[]}),(!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(wr,{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)===Cr.uuid&&G(!0)}}),q&&l().createElement(Dr,{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!==(K=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==Cr.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==K?K:"",readOnly:!0,labelText:"Responsible Person"}),C&&h&&l().createElement(Or,{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(Nr,{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 qr={stockItemUuid:dr.z.string().min(1,{message:"Required"}),stockItemName:dr.z.string().min(1).nullish(),stockItemPackagingUOMUuid:dr.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:dr.z.string().min(1).nullish(),batchNo:dr.z.string().min(1,{message:"Required"}),stockBatchUuid:dr.z.string().optional(),expiration:dr.z.coerce.date({required_error:"Required"}),quantity:dr.z.coerce.number().min(1,{message:"Required"}),purchasePrice:dr.z.coerce.number().nullish(),hasExpiration:dr.z.boolean().nullish()},Gr=dr.z.object(qr),Hr=(Gr.omit({expiration:!0}),dr.z.object({stockItems:dr.z.array(Gr)})),Zr=n(6781),Yr={};Yr.styleTagTransform=b(),Yr.setAttributes=g(),Yr.insert=p().bind(null,"head"),Yr.domAPI=d(),Yr.insertStyleElement=v(),s()(Zr.Z,Yr);const Qr=Zr.Z&&Zr.Z.locals?Zr.Z.locals:void 0;function Jr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jr(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 Kr(e){return e.drugName||e.conceptName}const Vr=function(e){var t=function(e){var t=Wr((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=Wr((0,i.useState)(null),2),s=c[0],u=c[1],d=Wr((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Wr((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=yr((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(sr.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: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..."}))},Xr=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(sr.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 $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,t){(null==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 no(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 to(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?to(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 ro(e){var t=no((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=no((0,i.useState)(10),2),a=o[0],l=o[1],c=no((0,i.useState)(null),2),s=c[0],u=c[1],d=no((0,i.useState)(1),2),m=d[0],p=d[1],A=no((0,i.useState)(),2),g=A[0],f=A[1],v=no((0,i.useState)(),2),_=v[0],b=v[1],h=no((0,i.useState)(),2),y=h[0],k=h[1],C=no((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,includeBatchNo:!0})}),[s,m,a,g,_,y,E]);var S,D=Ye(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:b,setStockBatchUuid:w}}function oo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ao=function(e){var t=function(e){var t=eo((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=eo((0,i.useState)(null),2),s=c[0],u=c[1],d=eo((0,i.useState)(10),2),m=d[0],p=d[1],A=eo((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=ro(U.Default),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){oo(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(sr.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 io(e,t){(null==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 lo(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 io(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?io(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 co=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=lo((0,i.useState)(),2),_=(v[0],v[1]),b=lo((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,D,O,x,N,I,T,B,P,U,j,F,z,L,R,M,q,G,H,Z,Y,Q,J,W,K,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Qr.desktopRow:Qr.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(Vr,{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(ao,{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===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=lo(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:V,defaultValue:$(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!==(K=null===(F=d[null==e?void 0:e.stockBatchUuid])||void 0===F?void 0:F.quantityUoM)&&void 0!==K?K:""):"",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(Xr,{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:Zt.ZN,onClick:function(){return g(i)}})))})))};var so=n(6360),uo={};uo.styleTagTransform=b(),uo.setAttributes=g(),uo.insert=p().bind(null,"head"),uo.domAPI=d(),uo.insertStyleElement=v(),s()(so.Z,uo);const mo=so.Z&&so.Z.locals?so.Z.locals:void 0;function po(e,t){(null==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,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 go(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fo(e){return function(e){if(Array.isArray(e))return po(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vo(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 vo(e,t){if(e){if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?po(e,t):void 0}}const _o=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,D=Br().formContext,O=function(e){if("requisition"===e){var t=Gr.omit({batchNo:!0,expiration:!0});return dr.z.object({stockItems:dr.z.array(t)})}return Hr}(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){Ao(a,r,o,i,l,"next",e)}function l(e){Ao(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,sr.cI)({resolver:(0,ur.F)(O),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,B=N.setValue,P=N.formState.errors,U=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||vo(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,sr.Dq)({name:"stockItems",control:T}),F=j.fields,z=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==D?void 0:D.stockItems){var e=null==D?void 0:D.stockItems;null==e||e.forEach((function(e){return z(e)}))}}),[z,null==D?void 0:D.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(fo(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),fo(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),fo(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),fo(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")}],fo(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:mo.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){go(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?mo.desktopHeader:mo.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(co,{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 bo=n(8808);function ho(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yo(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){yo(a,r,o,i,l,"next",e)}function l(e){yo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Co(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ho(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ho(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Eo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const wo=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=Co((0,i.useState)(!1),2),d=u[0],m=u[1],p=Co((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:ko((function(){return Eo(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),[4,c.onComplete(r)];case 1:return e.sent(),m(!1),[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:c.onDispatch,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:bo.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:ko((function(){return Eo(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:bo.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:Zt.WP},s("goBack","Go Back"))))};var So="Location",Do="Other";function Oo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function xo(){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,D,O,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(kr()),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,Kn.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 D=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)===So&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===Do})),(null==e?void 0:e.hasSource)&&A&&k&&(null==D?void 0:D.length)>0&&(T=D[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(O=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)===So&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===Do})),A&&w&&(null==O?void 0:O.length)>0&&(U=O[0],p.destinationUuid=U.uuid,p.destinationName=U.name)),[3,4];case 2:return[4,Ot()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return F=Xn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=F,"adjustment"===Y),requiresBatchUuid:er(F),requiresActualBatchInfo:tr(F),isQuantityOptional:nr(F),canCaptureQuantityPrice:rr(F),requiresStockAdjustmentReason:$n(F),requiresDispatchAcknowledgement:or(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||ar(F),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===So&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===Do},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===So&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===Do},location:S,sourcePartyList:D,destinationPartyList:O,stockOperationTypes:v,hasQtyRequested:f}]}var Y,Q}))},xo=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Oo(a,r,o,i,l,"next",e)}function l(e){Oo(a,r,o,i,l,"throw",e)}i(void 0)}))},xo.apply(this,arguments)}function No(e,t){(null==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 Io(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 No(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?No(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 To=n(3133);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:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(To.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){Bo(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};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:"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){Uo(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};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:"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){Fo(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};function Lo(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=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){Lo(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};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)}var qo,Go,Ho=(qo=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={},Kn.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):Kn.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]}))},Go=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=qo.apply(e,t);function a(e){Mo(o,n,r,a,i,"next",e)}function i(e){Mo(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Go.apply(this,arguments)});function Zo(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 Yo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Zo(a,r,o,i,l,"next",e)}function l(e){Zo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Qo(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 Jo=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>")},Wo=function(){var e=Yo((function(){var e,t;return Qo(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)}}(),Ko=function(){var e=Yo((function(){var e;return Qo(this,(function(t){switch(t.label){case 0:return[4,Wo()];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)}}(),Vo=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 Xo(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 $o(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Xo(a,r,o,i,l,"next",e)}function l(e){Xo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ea(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 ta=function(){var e=$o((function(e){var t,n,r,o,a,i,l,c,s;return ea(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,Ko()];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(K(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(K(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)}}(),na=function(){var e=$o((function(e){var t;return ea(this,(function(n){switch(n.label){case 0:return[4,ta(e)];case 1:return t=n.sent(),Vo(Jo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ra(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 oa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ra(a,r,o,i,l,"next",e)}function l(e){ra(a,r,o,i,l,"throw",e)}i(void 0)}))}}function aa(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 ia=function(){var e=oa((function(e){var t,n,r,o,a,i,l,c,s;return aa(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,Ko()];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(K(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(K(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)}}(),la=function(){var e=oa((function(e){var t;return aa(this,(function(n){switch(n.label){case 0:return[4,ia(e)];case 1:return t=n.sent(),Vo(Jo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ca(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){ca(a,r,o,i,l,"next",e)}function l(e){ca(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 da=function(){var e=sa((function(e){var t,n,r,o,a,i,l,c;return ua(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,Ko()];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(K(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)}}(),ma=function(){var e=sa((function(e){var t;return ua(this,(function(n){switch(n.label){case 0:return[4,da(e)];case 1:return t=n.sent(),Vo(Jo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function pa(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 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,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){pa(a,r,o,i,l,"next",e)}function l(e){pa(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,Ho(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,na(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,la(c)];case 4:return u.sent(),[3,7];case 5:return[4,ma(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){Aa(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};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:"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){fa(e,t,n[t])}))}return e}({size:16},e))}},n("approve","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}const ba=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){_a(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ya(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ha(e,t,n[t])}))}return e}const ka=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=ya({},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(){La(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(ut.ei,ya({size:16},e))}},s("issueStock","Issue Stock "))};var Ca=n(2496),Ea={};Ea.styleTagTransform=b(),Ea.setAttributes=g(),Ea.insert=p().bind(null,"head"),Ea.domAPI=d(),Ea.insertStyleElement=v(),s()(Ca.Z,Ea);const wa=Ca.Z&&Ca.Z.locals?Ca.Z.locals:void 0;function Sa(e,t){(null==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 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 Oa(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 xa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Na(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){xa(e,t,n[t])}))}return e}function Ia(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 Ta(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 Sa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sa(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 Ba(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 Pa=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,b,h,y,k,C,w,S,D,O,x,N,I,T,B,P,U,j,F,z,L,R,M,G,H,Z,Y,J,W,K,V,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,De,Oe=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=Io((0,i.useState)(!0),2),n=t[0],r=t[1],o=Io((0,i.useState)(!1),2),a=o[0],l=o[1],c=Io((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return xo.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=Ta((0,i.useState)(null==e?void 0:e.isEditing),2),Fe=je[0],ze=je[1],Le=Ta((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Ta((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:Oe("error","Error"),subtitle:Oe("errorLoadingStockOperation","Error loading stock item"),timeoutInMs:5e3,isLowContrast:!0});var Ze=[{name:"".concat(xe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(Mr,Ia(Na({},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:Oa((function(){return Ba(this,(function(e){return ze(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(_o,Ia(Na({},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:Oa((function(){return Ba(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(wo,Ia(Na({},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=Oa((function(t){return Ba(this,(function(n){switch(n.label){case 0:return[4,za(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:Oa((function(){return Ba(this,(function(t){switch(t.label){case 0:return[4,Ra("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Oa((function(){return Ba(this,(function(t){switch(t.label){case 0:return[4,Ra("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Oa((function(){return Ba(this,(function(t){switch(t.label){case 0:return[4,Ra("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:wa.textHeading},Oe("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:wa.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:wa.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.text},null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByFamilyName," ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:wa.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.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:wa.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.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:wa.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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===(V=e.model)||void 0===V||null===(K=V.permission)||void 0===K?void 0:K.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)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Po,{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)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&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})),l().createElement("div",{style:{margin:"2px"}},l().createElement(zo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ro,{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(ba,{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===(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(Ro,{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(ka,{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)===Kn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Kn.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Kn.RECEIPT_OPERATION_TYPE||(null==e||null===(De=e.model)||void 0===De?void 0:De.operationType)===Kn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ga,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Pr,null,l().createElement(Wn,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Ua(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 ja(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ua(a,r,o,i,l,"next",e)}function l(e){Ua(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Fa(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 za=function(){var e=ja((function(e,t,n,o,a){var i,l,c,s;return Fa(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===Kn.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)}}(),La=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(Pa,{model:e,onSave:function(e){return za(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},Ra=function(){var e=ja((function(e,t,n){var o;return Fa(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 Ma(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const qa=function(e){var t,n,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 Ma(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ma(e,t):void 0}}(t,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(){La(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Ga(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ha(e,t){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)||Za(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 Za(e,t){if(e){if("string"==typeof e)return Ga(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ga(e,t):void 0}}const Ya=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Nt(t),c=o.items,s=o.isLoading,u=Ha((0,i.useState)(!1),2),d=u[0],m=u[1],p=Ha((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(qn.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 Ga(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Za(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:Ot().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:zn.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 Qa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ja(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ja(e,t,n[t])}))}return e}function Ka(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 Va(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 Qa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(e,t):void 0}}(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 Xa=function(){var e,t=(0,E.useTranslation)().t,n=(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}}),[]),o=Un({v:U.Full,totalCount:!0}),c=o.items,s=o.tableHeaders,u=o.currentPage,d=o.pageSizes,m=o.totalItems,p=o.goTo,A=o.currentPageSize,g=o.setPageSize,f=o.isLoading,v=Va((0,i.useState)(c),2),_=v[0],b=v[1],h=Va((0,i.useState)(null),2),y=h[0],k=h[1],C=Va((0,i.useState)(null),2),w=C[0],S=C[1],D=Va((0,i.useState)([]),2),O=D[0],x=D[1],N=Va((0,i.useState)([]),2),I=N[0],T=N[1],B=Va((0,i.useState)([]),2),P=B[0],j=B[1],F=(0,r.useConfig)(),z=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}})};(0,i.useEffect)((function(){R()}),[y,w,O,I,P,u,A,c]);var L=(0,i.useCallback)((function(e,t){t===te.SOURCES?x(e):t===te.OPERATION?j(e):T(e)}),[]),R=function(){var e=c;O.length>0&&(e=e.filter((function(e){return O.includes(e.sourceName)}))),P.length>0&&(e=e.filter((function(e){return P.includes(e.operationTypeName)}))),I.length>0&&(e=e.filter((function(e){return I.includes(e.status)}))),y&&w?e=e.filter((function(e){var t=new Date(e.operationDate);return t>=y&&t<=w})):y?e=e.filter((function(e){return new Date(e.operationDate)>=y})):w&&(e=e.filter((function(e){return new Date(e.operationDate)<=w}))),b(e)},M=(0,i.useMemo)((function(){return null==_?void 0:_.map((function(r,o){var i,c,s,u,d,m,p,A,g,f,v,b,h,y,k,C,E,w,S;return Ka(Wa({},r),{id:null==r?void 0:r.uuid,key:"key-".concat(null==r?void 0:r.uuid),operationTypeName:"".concat(null==r?void 0:r.operationTypeName),operationNumber:l().createElement(qa,{model:_[o],operations:e}),status:"".concat(null==r?void 0:r.status),source:"".concat(null!==(i=null==r?void 0:r.sourceName)&&void 0!==i?i:""),destination:"".concat(null!==(c=null==r?void 0:r.destinationName)&&void 0!==c?c:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==r?void 0:r.sourceName)&&void 0!==s?s:""," ",(null==r?void 0:r.sourceName)&&(null==r?void 0:r.destinationName)?l().createElement(he.ol,{size:16}):""," ",null!==(u=null==r?void 0:r.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==r?void 0:r.responsiblePersonFamilyName)&&void 0!==d?d:null==r?void 0:r.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==r?void 0:r.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:K(null==r?void 0:r.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"},K(null==r?void 0:r.dateCreated))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(A=r.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=r.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==r?void 0:r.status)&&(null==r?void 0:r.status)!==Ln&&(null==r?void 0:r.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"},K(null==r?void 0:r.submittedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(f=r.submittedByFamilyName)&&void 0!==f?f:""," ",null!==(v=r.submittedByGivenName)&&void 0!==v?v:""))),(null==r?void 0:r.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"},K(null==r?void 0:r.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(b=r.completedByFamilyName)&&void 0!==b?b:""," ",null!==(h=r.completedByGivenName)&&void 0!==h?h:""))),(null==r?void 0:r.status)===Rn&&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"},K(null==r?void 0:r.cancelledDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(y=r.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=r.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,r.cancelReason))),(null==r?void 0:r.status)===Mn&&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"},K(null==r?void 0:r.rejectedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(C=r.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=r.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,r.rejectionReason))),(null==r?void 0:r.status)===Ln&&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"},K(null==r?void 0:r.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=r.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=r.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,r.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:z}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){La(_[o],!0,n,e,!1)}}))})}))}),[z,_,n,e,c]);return f?l().createElement(a.gqd,{className:zn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:zn.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:M,headers:s,isSortable:!0,useZebraStyles:!0,render:function(n){var o=n.rows,i=n.headers,s=n.getHeaderProps,u=n.getTableProps,d=n.getRowProps,m=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:zn.toolbarContent},l().createElement(a.Ys1,{className:zn.patientListSearch,expanded:!0,onChange:m,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:zn.filterContainer},l().createElement(a.Mtg,{className:zn.dateAlign,datePickerType:"range",dateFormat:X,value:[y,w],onChange:function(e){var t=Va(e,2);!function(e){var t=Va(e,2),n=t[0],r=t[1];n&&(k(n),w&&n&&w<n&&S(n)),r&&(S(r),y&&r&&y>r&&k(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:V}),l().createElement(a.aj6,{placeholder:V})),l().createElement(Ya,{conceptUuid:F.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:L}),l().createElement(Ya,{filterName:te.STATUS,onFilterChange:L}),l().createElement(Ya,{filterName:te.OPERATION,onFilterChange:L})),l().createElement(Zn,{onOperationTypeSelected:function(t){La(kr(),!1,t,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,u(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ka(Wa({},s({header:e,isSortable:e.isSortable})),{className:r.isDesktop?zn.desktopHeader:zn.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,n){var o,s,u,m,p,A,g,f,v,b,h,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,F,z,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Wa({className:r.isDesktop?zn.desktopRow:zn.tabletRow},d({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:i.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=_[n])||void 0===o?void 0:o.dateCreated)?K(null===(s=_[n])||void 0===s?void 0:s.dateCreated):""," ",(null===(u=_[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(m=_[n])||void 0===m?void 0:m.dateCreated)?null===(p=_[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=_[n])||void 0===A?void 0:A.completedDate)?K(null===(g=_[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=_[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=_[n])||void 0===v?void 0:v.completedDate)?null===(b=_[n])||void 0===b?void 0:b.creatorFamilyName:""),l().createElement(a.agF,null,(null===(h=_[n])||void 0===h?void 0:h.stockOperationItems)?null===(y=_[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=_[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=_[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=_[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?K(null===(w=_[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=_[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(D=_[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=_[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=_[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?K(null===(N=_[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=_[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=_[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=_[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=_[n])||void 0===P?void 0:P.completedDate)?null===(U=c[n])||void 0===U?void 0:U.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=_[n])||void 0===j?void 0:j.stockOperationItems)?null===(F=_[n].stockOperationItems)||void 0===F?void 0:F.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(z=_[n])||void 0===z?void 0:z.stockOperationItems)?null===(L=_[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===o.length?l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("div",{className:zn.tileContent},l().createElement("p",{className:zn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:zn.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:A,pageSizes:d,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==A&&g(t),n!==u&&p(n)},className:zn.paginationOverride}))},$a=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Xa,null))};var ei={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 ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ni(e,t){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 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}}(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 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}function oi(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const ai=function(e){var t,n,o=function(e){var t=ni((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=ni((0,i.useState)(""),2),s=c[0],u=c[1],d=ni((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=ni((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 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,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(sr.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:oi,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 ii=dr.z.string().max(255).nullish(),li=dr.z.object({isDrug:dr.z.boolean(),drugUuid:dr.z.string().nullish(),drugName:dr.z.string().nullish(),commonName:ii,acronym:ii,hasExpiration:dr.z.boolean(),expiryNotice:dr.z.coerce.number().nullish(),uuid:dr.z.string().nullish(),conceptUuid:dr.z.string().nullish(),conceptName:dr.z.string().nullish(),preferredVendorUuid:dr.z.string().nullish(),preferredVendorName:dr.z.string().nullish(),purchasePrice:dr.z.number().nullish(),purchasePriceUoMUuid:dr.z.string().nullish(),purchasePriceUoMName:dr.z.string().nullish(),categoryUuid:dr.z.string().nullish(),categoryName:dr.z.string().nullish(),dispensingUnitUuid:dr.z.string().nullish(),dispensingUnitName:dr.z.string().nullish(),dispensingUnitPackagingUoMUuid:dr.z.string().nullish(),dispensingUnitPackagingUoMName:dr.z.string().nullish(),defaultStockOperationsUoMUuid:dr.z.string().nullish(),defaultStockOperationsUoMName:dr.z.string().nullish(),reorderLevel:dr.z.number().nullish(),reorderLevelUoMUuid:dr.z.string().nullish(),reorderLevelUoMName:dr.z.string().nullish(),dateCreated:dr.z.coerce.date().nullish(),creatorGivenName:dr.z.string().nullish(),creatorFamilyName:dr.z.string().nullish(),voided:dr.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 ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const si=function(e){return l().createElement(sr.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){ci(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})})))}})},ui=function(e){return l().createElement(sr.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,ref:d,onChange:function(t,n){s(t,n),e.onChange&&e.onChange(t,n)}})}})},di=function(e){var t=Nt((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.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})}})},mi=function(e){var t=nn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.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})}})},pi=function(e){var t=Nt((0,r.useConfig)().stockItemCategoryUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.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.onCategoryUuidChange)||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.categoryUuid})))||{},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})}})},Ai=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits[0]: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(sr.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=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){var t;return null!==(t=e.packagingUomName)&&void 0!==t?t:""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}})):l().createElement(l().Fragment,null)},gi=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(Ai,{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(Ai,{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(ui,{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(Ai,{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(ui,{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(Ai,{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 fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const vi=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 fi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fi(e,t):void 0}}(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(sr.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 _i=[{label:"Drug",value:!0},{label:"Other",value:!1}],bi=[{label:"Yes",value:!0},{label:"No",value:!1}];function hi(e,t){(null==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 yi(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 ki(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 hi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hi(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 Ci=(0,i.forwardRef)((function(e){var t,n,r,o,c,s,u,d,m,p,A,g=e.model,f=e.onSave,v=e.isEditing,_=e.handleTabChange,b=(0,E.useTranslation)().t,h=(0,sr.cI)({defaultValues:g,mode:"all",resolver:(0,ur.F)(li)}),y=h.handleSubmit,k=h.control,C=h.formState,w=C.errors,S=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){yi(a,r,o,i,l,"next",e)}function l(e){yi(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]),x(!0),e.uuid=g.uuid,[4,f(e)];case 1:return t.sent(),_(1),ce("ws/rest/v1/stockmanagement/stockitem"),[3,4];case 2:return t.sent(),[3,4];case 3:return x(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),D=ki((0,i.useState)(!1),2),O=D[0],x=D[1],N=ki((0,i.useState)(!1),2),T=N[0],B=N[1],P=ki((0,i.useState)(!1),2),U=P[0],j=P[1];return(0,i.useEffect)((function(){var e,t;B(null!==(e=g.isDrug)&&void 0!==e&&e),j(null!==(t=g.hasExpiration)&&void 0!==t&&t)}),[g.hasExpiration,g.isDrug]),l().createElement("form",{className:"".concat(I.formContainer," ").concat(I.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(si,{control:k,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!w.isDrug,invalidText:w.isDrug&&(null==w||null===(t=w.isDrug)||void 0===t?void 0:t.message),onChange:function(e){B(e)},options:_i})),T&&l().createElement(ai,{name:"drugUuid",controllerName:"drugUuid",control:k,title:b("pleaseSpecify","Please specify:"),invalid:!!w.drugUuid,invalidText:w.drugUuid&&(null==w||null===(n=w.drugUuid)||void 0===n?void 0:n.message)}),null!=T&&!T&&l().createElement(vi,{name:"conceptUuid",controllerName:"conceptUuid",control:k,title:b("pleaseSpecify","Please specify:"),placeholder:b("chooseAnItem","Choose an item"),invalid:!!w.drugUuid,invalidText:w.drugUuid&&(null==w||null===(r=w.drugUuid)||void 0===r?void 0:r.message)}),l().createElement(Dr,{id:"commonName",name:"commonName",control:k,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(A=null==g?void 0:g.commonName)&&void 0!==A?A:""),labelText:b("commonName","Common name:"),invalid:!!w.commonName,invalidText:w.commonName&&(null==w||null===(o=w.commonName)||void 0===o?void 0:o.message)}),l().createElement(Dr,{id:"acronym",maxLength:255,name:"acronym",control:k,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation:"),invalid:!!w.acronym,invalidText:w.acronym&&(null==w||null===(c=w.acronym)||void 0===c?void 0:c.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(si,{name:"hasExpiration",controllerName:"hasExpiration",control:k,legendText:"",invalid:!!w.hasExpiration,invalidText:w.hasExpiration&&(null==w||null===(s=w.hasExpiration)||void 0===s?void 0:s.message),onChange:function(e){j(e)},options:bi})),U&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(ui,{id:"expiryNotice",name:"expiryNotice",control:k,controllerName:"expiryNotice",size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!w.expiryNotice,invalidText:w.expiryNotice&&(null==w||null===(u=w.expiryNotice)||void 0===u?void 0:u.message)}))),l().createElement(mi,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:k,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!w.preferredVendorUuid,invalidText:w.preferredVendorUuid&&(null==w||null===(d=w.preferredVendorUuid)||void 0===d?void 0:d.message)}),l().createElement(pi,{name:"categoryUuid",controllerName:"categoryUuid",control:k,title:b("category:","Category:"),placeholder:b("chooseACategory","Choose a category"),invalid:!!w.categoryUuid,invalidText:w.categoryUuid&&(null==w||null===(m=w.categoryUuid)||void 0===m?void 0:m.message)}),T&&l().createElement(di,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:k,title:b("dispensingUnit","Dispensing Unit:"),placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!w.dispensingUnitUuid,invalidText:w.dispensingUnitUuid&&(null==w||null===(p=w.dispensingUnitUuid)||void 0===p?void 0:p.message)}),T&&v&&l().createElement(gi,{control:k,formState:C,stockItemUuid:g.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:y(S),kind:"primary",renderIcon:bo.vc},O?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},b("cancel","Cancel"))))}));const Ei=Ci;function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Si(e){var t,n,o=function(e){console.warn("Rules filter: "+JSON.stringify(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 wi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=(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 Di=n(4563),Oi={};Oi.styleTagTransform=b(),Oi.setAttributes=g(),Oi.insert=p().bind(null,"head"),Oi.domAPI=d(),Oi.insertStyleElement=v(),s()(Di.Z,Oi);const xi=Di.Z&&Di.Z.locals?Di.Z.locals:void 0;function Ni(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ii(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ni(e,t,n[t])}))}return e}function Ti(e,t){(null==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){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pi(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){Bi(e,t,n[t])}))}return e}function Ui(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 ji(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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}}(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 Fi=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t;console.warn("Got stock id: ",c);var u=ji((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,A,g,f,v,_,b=Je(d).items,h=(p={v:U.Default},A="".concat(r.restBaseUrl,"/location").concat(F(p,!1)),g=(0,j.ZP)(A,r.openmrsFetch),f=g.data,v=g.error,_=g.isLoading,{locations:(null==f?void 0:f.data)||{},isErrorLocation:v,isLoadingLocations:_}).locations.results,y=St({v:U.Default}),k=y.items,C=(y.isError,y.isLoading,ji((0,i.useState)(),2)),w=C[0],S=C[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){o.dateCreated,o.creatorGivenName,o.creatorFamilyName;var e=Pi({},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"]));S(e)}}),[o]);var D=(0,i.useCallback)((function(e){e.preventDefault(),o&&(w.uuid=o.uuid),c&&(w.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:Ii({},e)})}(w).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()}),[w,o,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:D},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:xi.section},l().createElement("section",{className:xi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==w?void 0:w.locationUuid)?w.locationUuid:"",onChange:function(e){var t=h.find((function(t){return t.uuid===e.target.value}));S(Ui(Pi({},w),{locationUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==h?void 0:h.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))),l().createElement("section",{className:xi.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),S(Ui(Pi({},w),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:xi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==w?void 0:w.stockItemPackagingUOMUuid)?w.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==b?void 0:b.results.find((function(t){return t.uuid===e.target.value}));S(Ui(Pi({},w),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==b?void 0:b.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:xi.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)),S(Ui(Pi({},w),{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:xi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==w?void 0:w.alertRole)?w.alertRole:"",onChange:function(e){var t=null==k?void 0:k.results.find((function(t){return t.display===e.target.value}));S(Ui(Pi({},w),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==k||null===(t=k.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:xi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==w?void 0:w.mailRole)?w.mailRole:"",onChange:function(e){var t=null==k?void 0:k.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),S(Ui(Pi({},w),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==k||null===(n=k.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:xi.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)),S(Ui(Pi({},w),{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)),S(Ui(Pi({},w),{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:xi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==w?void 0:w.enabled);S(Ui(Pi({},w),{enabled:n}))},checked:null==w?void 0:w.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:xi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==w?void 0:w.enableDescendants);S(Ui(Pi({},w),{enableDescendants:n}))},name:"appliesToChildren",checked:null==w?void 0:w.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")))))},zi=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Fi,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var Li=n(4907),Ri={};Ri.styleTagTransform=b(),Ri.setAttributes=g(),Ri.insert=p().bind(null,"head"),Ri.domAPI=d(),Ri.insertStyleElement=v(),s()(Li.Z,Ri);const Mi=Li.Z&&Li.Z.locals?Li.Z.locals:void 0;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}const Gi=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:Mi.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return qi(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 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)||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 Hi(e,t){(null==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 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,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 Hi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hi(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(Zt.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){Zi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};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}const Ji=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Fi,{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){Qi(e,t,n[t])}))}return e}({size:16},e))}})};function Wi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ki(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){Wi(e,t,n[t])}))}return e}function Vi(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 Xi=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t);console.warn("Found stock uuid: "+t);var o=Si({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 Vi(Ki({},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:K(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),actionFrequency:"".concat(null==e?void 0:e.actionFrequency),lastActionDate:K(null==e?void 0:e.lastActionDate),nextActionDate:K(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Ji,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Yi,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:zn.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:zn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Gi,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(zi,{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,Vi(Ki({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?zn.desktopHeader:zn.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,Ki({className:r.isDesktop?zn.desktopRow:zn.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:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("div",{className:zn.tileContent},l().createElement("p",{className:zn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:zn.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:zn.paginationOverride}))};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,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.")}()}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 nl(e){return function(e){if(Array.isArray(e))return tl(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 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}}(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 rl=function(e){var t=Nt((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i,c,s,u,d,m,p,A=t.field,g=A.onChange;return A.value,A.ref,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)?nl(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(nl(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),g((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 ol=dr.z.object({id:dr.z.string().nullish(),uuid:dr.z.string().nullish(),stockItemUuid:dr.z.string().nullish(),packagingUomName:dr.z.string().nullish(),packagingUomUuid:dr.z.string().nullish(),factor:dr.z.coerce.number().nullish(),isDefaultStockOperationsUoM:dr.z.boolean().nullish(),isDispensingUnit:dr.z.boolean().nullish()}),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){e.isEditing;var t=e.stockItemUuid,n=e.handleTabChange,o=function(e){var t=el((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=el((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("quantity","Quantity"),styles:{width:"50%"}},{key:"action",header:m("action","Actions"),styles:{width:"50%"}}]}),[]),A=(0,sr.cI)({defaultValues:{},mode:"all",resolver:(0,ur.F)(ol)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(sr.RV,A,l().createElement(a.wQF,{rows:(d=c,function(e){if(Array.isArray(e))return cl(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 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}}(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: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=(0,A.getValues)();(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:e.factor,packagingUomUuid:e.packagingUomUuid,stockItemUuid:t}).then((function(){return(0,r.showSnackbar)({title:m("savePackingUnitTitle","Package Unit"),subtitle:m("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"})}),(function(){(0,r.showSnackbar)({title:m("savePackagingUnitErrorTitle","Package Unit"),subtitle:m("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})),n(0)},kind:"primary",renderIcon:bo.vc},m("save","Save")))};var pl=function(e){var t=e.isEditing,n=e.row,o=e.key,i=(0,E.useTranslation)().t,c=(0,sr.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(rl,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",control:s,invalid:!!u.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(ui,{row:n,controllerName:"factor",name:"factor",control:s,id:"".concat(n.uuid,"-").concat(o),invalid:!!u.factor}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:Zt.ZN,onClick:function(e){return function(e){var t,o,a;e.preventDefault(),(t=n.uuid,o="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),a=new AbortController,(0,r.openmrsFetch)(o,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showToast)({critical:!0,title:i("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:i("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showNotification)({title:i("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}(e)}}))))};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,D=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){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 O=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,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:O}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:O}),l().createElement(a.laM,{itemText:"Download As Json",onClick:O})),l().createElement(a.Ys1,{className:bl.patientListSearch,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:D,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!==D){if(s)return void s(n);w(n)}}})))})))};function wl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sl=function(e){var t,n=e.stockItemUuid,o=function(e){var t=gl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,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)(),2),f=g[0],v=g[1],_=gl((0,i.useState)(),2),b=_[0],h=_[1],y=gl((0,i.useState)(),2),k=y[0],C=y[1],E=gl((0,i.useState)(),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 D=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),O=D.items,x=D.isLoading,N=D.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:h,setStockBatchUuid:S}}(U.Default),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.totalCount,m=o.setCurrentPage,p=o.setStockItemUuid;(0,i.useEffect)((function(){p(n)}),[n,p]);var A=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e){var n,r,o,a,i,c,s,u,d;return u=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){wl(e,t,n[t])}))}return e}({},e),d=null!=(d={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:K(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===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(a=null==e?void 0:e.packagingUomName)&&void 0!==a?a:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(K(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(qa,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:t}):l().createElement(l().Fragment,null),status:null!==(i=null==e?void 0:e.stockOperationStatus)&&void 0!==i?i:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(r=e.quantity)||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(o=-1*(null==e?void 0:e.quantity))||void 0===o?void 0:o.toLocaleString()," ").concat(null!==(s=null==e?void 0:e.packagingUomName)&&void 0!==s?s:""):""})?d:{},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(d)).forEach((function(e){Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(d,e))})),u}))}),[s,t]);return c?l().createElement(a.gqd,{role:"progressbar"}):null!=(null==s?void 0:s.length)?l().createElement(El,{columns:u,data:A,totalItems:d,goToPage:m,hasToolbar:!1}):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},"No transactions to display")))};function Dl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ol=function(e){var t=e.stockItemUuid,n=ro(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:"batch",header:d("batchNumber","Batch Number")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")},{key:"expires",header:d("expires","Expires")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l;return 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){Dl(e,t,n[t])}))}return e}({},e),l=null!=(l={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:K(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:null!==(a=e.quantityUoM)&&void 0!==a?a:""})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):(null==o?void 0:o.length)>0?l().createElement(El,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1}):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},d("batchInfoToDisplay","No batch information to display"))))};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}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 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}}(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 Il(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tl=function(e){var t=e.stockItemUuid,n=function(e){var t=Nl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Nl((0,i.useState)(10),2),a=o[0],l=o[1],c=Nl((0,i.useState)(null),2),s=c[0],u=c[1],d=Nl((0,i.useState)(1),2),m=d[0],p=d[1],A=Nl((0,i.useState)(),2),g=A[0],f=A[1],v=Nl((0,i.useState)(),2),_=v[0],b=v[1],h=Nl((0,i.useState)(),2),y=h[0],k=h[1],C=Nl((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,D=Ye(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid: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;return 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){Il(e,t,n[t])}))}return e}({},e),l=null!=(l={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:K(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:null!==(a=e.quantityUoM)&&void 0!==a?a:""})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):(null==o?void 0:o.length)>0?l().createElement(El,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1}):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},d("quantityToDisplay","No quantity to display"))))};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}const Pl=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 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.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(Ei,{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(Sl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Ol,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(Tl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Stock Rules"),component:l().createElement(Xi,{stockItemUuid:o.uuid}),disabled:!r}];return l().createElement(Wn,{onChange:m,tabs:p,selectedIndex:u})};function Ul(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 jl=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){Ul(a,r,o,i,l,"next",e)}function l(e){Ul(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?Ve:Ke)(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,Fl(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)}}(),Fl=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(Pl,{model:e,onSave:function(e){return jl(e,t)},isEditing:t}))};const zl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Fl(ei,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var Ll=n(1048),Rl={};Rl.styleTagTransform=b(),Rl.setAttributes=g(),Rl.insert=p().bind(null,"head"),Rl.domAPI=d(),Rl.insertStyleElement=v(),s()(Ll.Z,Rl);const Ml=Ll.Z&&Ll.Z.locals?Ll.Z.locals:void 0,ql=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:Ml.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Drugs",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Other",value:"false",id:"is-drug-other"}))};function Gl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Hl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Zl=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"))},Yl=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,Fl(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function Ql(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Jl(e,t,n[t])}))}return e}function Kl(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(){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 Ql(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ql(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=function(e){(0,E.useTranslation)().t;var t=Hl((0,i.useState)(1),2),n=t[0],o=t[1],a=Hl((0,i.useState)(10),2),l=a[0],c=a[1],s=Hl((0,i.useState)(null),2),u=s[0],d=s[1],m=Hl((0,i.useState)(""),2),p=m[0],A=m[1],g=Hl((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:10,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),d=u.isLoading,m=u.items,p=u.totalCount,A=u.currentPageSize,g=u.pageSizes,f=u.currentPage,v=u.setCurrentPage,_=u.isDrug,b=u.setDrug,h=u.setSearchString,y=yr((function(e){h(e)}),1e3);(0,i.useEffect)((function(){y(c)}),[c,y]);var k=(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]),C=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var r;return Kl(Wl({},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(Yl,{data:m[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,Fl(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(mt.I8,Wl({size:16},e))}}))})}))}),[m,n]);return d?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:C,headers:k,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,u=e.getTableProps,d=e.getRowProps,m=e.getBatchActionProps;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,m()),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(ql,{filterType:_,changeFilterType:b}),l().createElement(Zl,null),l().createElement(zl,null))),l().createElement(a.iA_,u(),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,Kl(Wl({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?zn.desktopHeader:zn.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,Kl(Wl({className:r.isDesktop?zn.desktopRow:zn.tabletRow},d({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:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("div",{className:zn.tileContent},l().createElement("p",{className:zn.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:zn.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:f,pageSize:A,pageSizes:g,totalItems:p,onChange:function(e){var t=e.page;return v(t)},className:zn.paginationOverride}))},Xl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Vl,null))},$l=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function ec(e,t){(null==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 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)}function nc(){return nc=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;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]}}))})),nc.apply(this,arguments)}var rc=n(2761),oc={};oc.styleTagTransform=b(),oc.setAttributes=g(),oc.insert=p().bind(null,"head"),oc.domAPI=d(),oc.insertStyleElement=v(),s()(rc.Z,oc);const ac=rc.Z&&rc.Z.locals?rc.Z.locals:void 0;function ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){lc(e,t,n[t])}))}return e}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 ic(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ic(e,t):void 0}}(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 uc=dr.z.object({name:dr.z.string().max(255)});const dc=function(e){var t,n,o,c,s,u,d,m=e.showModal,p=e.onModalChange,A=e.handleCreateQuestion,g=e.headerTitle,f=e.initialData,v=(0,E.useTranslation)().t,_=sc((0,i.useState)(!1),2),b=_[0],h=_[1],y=sc((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,sr.cI)({mode:"all",resolver:(0,ur.F)(uc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),D=S.handleSubmit,O=S.control,x=S.getValues,N=S.formState.isDirty;return l().createElement(a.lpG,{open:m,onClose:function(){return p(!1)},preventCloseOnClickOutside:!0,size:"md"},l().createElement(a.xBx,{title:g}),l().createElement("form",{onSubmit:D((function(e){var t,n,r,o=x(),a=null!==(r=null==o||null===(n=o.tags)||void 0===n||null===(t=n.selectedItems)||void 0===t?void 0:t.map((function(e){return e.uuid})))&&void 0!==r?r:[],i={name:o.name,tags:a};uc.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(sr.Qr,{name:"name",control:O,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,cc({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:ac.loaderContainer},l().createElement(sr.Qr,{name:"tags",control:O,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=cc({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"))))))},mc=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 nc.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(dc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};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}const gc=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 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(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 ec(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ec(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(){};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(mc,{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){Ac(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},"No stock items to display")))},fc=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(gc,null))};var vc=n(557),_c={};_c.styleTagTransform=b(),_c.setAttributes=g(),_c.insert=p().bind(null,"head"),_c.domAPI=d(),_c.insertStyleElement=v(),s()(vc.Z,_c);const bc=vc.Z&&vc.Z.locals?vc.Z.locals:void 0;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}var yc,kc=dr.z.object({startDate:dr.z.coerce.date().refine((function(e){return void 0!==e}),{message:"Start Date is required"}),endDate:dr.z.coerce.date().refine((function(e){return void 0!==e}),{message:"End Date is required"}),location:dr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:dr.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:dr.z.string().optional(),mostLeastMoving:dr.z.string().optional(),mostLeastMovingName:dr.z.string().optional(),stockItemUuid:dr.z.string().optional(),stockItemName:dr.z.string().optional(),patientUuid:dr.z.string().optional(),patientName:dr.z.string().optional(),locationUuid:dr.z.string().optional(),childLocations:dr.z.boolean().optional(),stockSourceUuid:dr.z.string().optional(),stockSource:dr.z.string().optional(),stockSourceDestinationUuid:dr.z.string().optional(),stockSourceDestination:dr.z.string().optional(),inventoryGroupBy:dr.z.string().optional(),inventoryGroupByName:dr.z.string().optional(),stockItemCategoryConceptUuid:dr.z.string().optional(),reportSystemName:dr.z.string().optional(),stockItemCategory:dr.z.string().optional(),maxReorderLevelRatio:dr.z.number().optional(),fullFillment:dr.z.string().array().optional(),limit:dr.z.string().optional(),date:dr.z.date().optional()});function Cc(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"}(yc||(yc={}));var Ec=function(e){return wc(e)?4:e?20:null},wc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Sc="Completed";function Dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Oc(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 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)||Ic(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 Nc(e){return function(e){if(Array.isArray(e))return Dc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ic(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 Ic(e,t){if(e){if("string"==typeof e)return Dc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dc(e,t):void 0}}const Tc=function(e){e.model;var t,n=(0,E.useTranslation)().t,o=(0,r.useConfig)().stockItemCategoryUUID,c=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}}(),s=c.reportTypes,u=c.isLoading,d=wt().stockLocations,m=Nt(o),p=m.items,A=(m.isLoading,xc((0,i.useState)(!1),2)),g=A[0],f=A[1],v=xc((0,i.useState)(!1),2),_=v[0],b=v[1],h=xc((0,i.useState)(!1),2),y=h[0],k=h[1],C=xc((0,i.useState)(!1),2),w=C[0],S=C[1],D=xc((0,i.useState)(!1),2),O=D[0],x=D[1],N=xc((0,i.useState)(!1),2),I=N[0],T=N[1],B=xc((0,i.useState)(!1),2),P=B[0],U=B[1],F=xc((0,i.useState)(!1),2),z=F[0],L=F[1],R=xc((0,i.useState)(!1),2),M=R[0],q=R[1],G=xc((0,i.useState)(!1),2),H=G[0],Z=G[1],Y=xc((0,i.useState)(!1),2),J=Y[0],W=Y[1],te=xc((0,i.useState)(!1),2),ne=te[0],re=te[1],oe=xc((0,i.useState)(!1),2),ae=oe[0],ie=oe[1],le=xc((0,i.useState)(!1),2),ce=le[0],se=le[1],ue=xc((0,i.useState)(!1),2),de=ue[0],me=ue[1],pe=xc((0,i.useState)(""),2),Ae=pe[0],ge=pe[1];(0,i.useEffect)((function(){var e=!1;if(Ae){var t,n,r,o,a,i,l,c,u,d,m,p,A,g,v,_=null==s?void 0:s.find((function(e){return e.name===Ae}));_&&(f(null===(t=_.parameters)||void 0===t?void 0:t.some((function(e){return e===yc.Date}))),b(null===(n=_.parameters)||void 0===n?void 0:n.some((function(e){return e===yc.StartDate}))),k(null===(r=_.parameters)||void 0===r?void 0:r.some((function(e){return e===yc.EndDate}))),S(null===(o=_.parameters)||void 0===o?void 0:o.some((function(e){return e===yc.StockItemCategory}))),x(null===(a=_.parameters)||void 0===a?void 0:a.some((function(e){return e===yc.Location}))),T(null===(i=_.parameters)||void 0===i?void 0:i.some((function(e){return e===yc.ChildLocations}))),U(null===(l=_.parameters)||void 0===l?void 0:l.some((function(e){return e===yc.StockSource}))),L(null===(c=_.parameters)||void 0===c?void 0:c.some((function(e){return e===yc.StockSourceDestination}))),q(null===(u=_.parameters)||void 0===u?void 0:u.some((function(e){return e===yc.InventoryGroupBy}))),Z(null===(d=_.parameters)||void 0===d?void 0:d.some((function(e){return e===yc.MaxReorderLevelRatio}))),re(null===(m=_.parameters)||void 0===m?void 0:m.some((function(e){return e===yc.StockItem}))),W(null===(p=_.parameters)||void 0===p?void 0:p.some((function(e){return e===yc.Patient}))),ie(null===(A=_.parameters)||void 0===A?void 0:A.some((function(e){return e===yc.Limit}))),se(null===(g=_.parameters)||void 0===g?void 0:g.some((function(e){return e===yc.MostLeastMoving}))),me(null===(v=_.parameters)||void 0===v?void 0:v.some((function(e){return e===yc.Fullfillment}))),e=!0)}e||(f(!1),b(!1),k(!1),S(!1),x(!1),T(!1),U(!1),L(!1),q(!1),Z(!1),re(!1),W(!1),ie(!1),se(!1),me(!1))}),[Ae,s]);var fe=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Nc(null!==(t=p&&(null==p||null===(e=p.answers)||void 0===e?void 0:e.length)>0?null==p?void 0:p.answers:null==p?void 0:p.setMembers)&&void 0!==t?t:[]))}),[p]),ve=(0,sr.cI)({mode:"all",resolver:(0,ur.F)(kc)}),_e=ve.handleSubmit,be=ve.control,he=ve.formState,ye=he.errors,ke=(he.defaultValues,he.isDirty,ve.setValue);if(u)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Ce=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){Oc(a,r,o,i,l,"next",e)}function l(e){Oc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,o,a,i,l,c,u,d,m,p,A,f,v,b,h,k,C,E,S,D,x,N,T,B,U,j,F,L,R,q,G,Z,Y,W,V,X,$,ee;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(te){switch(te.label){case 0:o=null===(t=s.find((function(t){return t.name===e.reportName})))||void 0===t?void 0:t.systemName,te.label=1;case 1:return te.trys.push([1,,3,4]),a="\r\n",i="param.report=".concat(o).concat(a),de&&(i+=Ee(yc.Fullfillment,(null!==(l=e.fullFillment)&&void 0!==l?l:["All"]).join(","),(null!==(c=e.fullFillment)&&void 0!==c?c:["All"]).join(", "),n("stockmanagement.report.edit.fullfillment"),a)),J&&(i+=Ee(yc.Patient,null!==(d=e.patientUuid)&&void 0!==d?d:"",null!==(m=null===(u=e.patientName)||void 0===u?void 0:u.trim())&&void 0!==m?m:"All Patients",n("Patients"),a)),ne&&(i+=Ee(yc.StockItem,null!==(A=e.stockItemUuid)&&void 0!==A?A:"",null!==(f=null===(p=e.stockItemName)||void 0===p?void 0:p.trim())&&void 0!==f?f:"All Stock Items",n("Stock Item"),a)),w&&(i+=Ee(yc.StockItemCategory,null!==(b=e.stockItemCategoryConceptUuid)&&void 0!==b?b:"",null!==(h=null===(v=e.stockItemCategory)||void 0===v?void 0:v.trim())&&void 0!==h?h:"All Categories",n("Stock Item Category"),a)),M&&(i+=Ee(yc.InventoryGroupBy,null!==(C=e.inventoryGroupBy)&&void 0!==C?C:"LocationStockItemBatchNo",null!==(E=null===(k=e.inventoryGroupByName)||void 0===k?void 0:k.trim())&&void 0!==E?E:"Stock Item Batch Number",n("stockmanagement.report.edit.inventorygroupby"),a)),O&&(i+=Ee(yc.Location,e.location,null!==(D=null===(S=e.location)||void 0===S?void 0:S.trim())&&void 0!==D?D:"",n("Location"),a),I&&(i+=Ee(yc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",n("Include Child Locations"),a))),H&&(i+=Ee(yc.MaxReorderLevelRatio,(null!==(x=e.maxReorderLevelRatio)&&void 0!==x?x:0).toString(),(null!==(N=e.maxReorderLevelRatio)&&void 0!==N?N:0).toString()+"%",n("stockmanagement.report.edit.maxreorderlevelratio"),a)),P&&(i+=Ee(yc.StockSource,null!==(B=e.stockSourceUuid)&&void 0!==B?B:"",null!==(U=null===(T=e.stockSource)||void 0===T?void 0:T.trim())&&void 0!==U?U:"All Sources",n("stockmanagement.report.edit.stocksource"),a)),z&&(i+=Ee(yc.StockSourceDestination,null!==(F=e.stockSourceDestinationUuid)&&void 0!==F?F:"",null!==(L=null===(j=e.stockSourceDestination)||void 0===j?void 0:j.trim())&&void 0!==L?L:"All Destinations",n("stockmanagement.report.edit.stocksourcedestination"),a)),ce&&(i+=Ee(yc.MostLeastMoving,null!==(q=e.mostLeastMoving)&&void 0!==q?q:"MostMoving",null!==(G=null===(R=e.mostLeastMovingName)||void 0===R?void 0:R.trim())&&void 0!==G?G:"Most Moving",n("stockmanagement.report.edit.mostleastmoving"),a)),ae&&(i+=Ee(yc.Limit,(null!==(Y=null!==(Z=e.limit)&&void 0!==Z?Z:Ec(e.reportSystemName))&&void 0!==Y?Y:20).toString(),(null!==(V=null!==(W=e.limit)&&void 0!==W?W:Ec(e.reportSystemName))&&void 0!==V?V:20).toString(),n(function(e){return wc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),a)),g&&(i+=Ee(yc.Date,JSON.stringify(e.date).replaceAll('"',""),null!==(X=K(e.date))&&void 0!==X?X:"",n("stockmanagement.report.edit.date"),a)),_&&(i+=Ee(yc.StartDate,JSON.stringify(e.startDate).replaceAll('"',""),null!==($=K(e.startDate))&&void 0!==$?$:"",n(function(e){return wc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),a)),y&&(i+=Ee(yc.EndDate,JSON.stringify(e.endDate).replaceAll('"',""),null!==(ee=K(e.endDate))&&void 0!==ee?ee:"",n(function(e){return wc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),a)),[4,Cc({batchJobType:"Report",description:e.reportName,parameters:i}).then((function(e){Q(),201===e.status?(0,r.showSnackbar)({title:n("batchJob","Batch Job"),subtitle:n("BatchJobSuccess","Batch job created successfully"),kind:"success"}):(0,r.showSnackbar)({title:n("BatchJobErrorTitle","Batch job"),subtitle:n("batchJobErrorMessage","Error creating batch job"),kind:"error"})})).catch((function(e){(0,r.showSnackbar)({title:n("BatchJobErrorTitle","Batch job"),subtitle:n("batchJobErrorMessage","Error creating batch job"),kind:"error"})}))];case 2:return te.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),Ee=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:_e(Ce,(function(e){console.error(e)}))},l().createElement("div",{className:bc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,n("reportName","Report")),l().createElement(sr.Qr,{control:be,name:"reportName",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"report",size:"md",labelText:n("reportName","Report"),items:s,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,ge(n)}})}})),w&&l().createElement(l().Fragment,null,l().createElement("span",null,n("stockItemCategory","Stock Item Category")),l().createElement(sr.Qr,{control:be,name:"stockReportItemCategory",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"stockReportItem",size:"md",labelText:n("stockItemCategory","Stock Item Category"),items:fe,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..."})}})),_&&l().createElement(sr.Qr,{control:be,name:"startDate",render:function(e){var t,r,o=e.field,i=o.onChange,c=o.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:i,value:c},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:V,labelText:n("startDate","Start Date"),defaultValue:"",invalid:null==ye||null===(t=ye.startDate)||void 0===t?void 0:t.message,invalidText:null==ye||null===(r=ye.startDate)||void 0===r?void 0:r.message}))}}),y&&l().createElement(sr.Qr,{control:be,name:"endDate",render:function(e){var t,r,o=e.field,i=o.onChange,c=o.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:i,value:c},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:V,labelText:n("endDate","End Date"),defaultValue:"",invalid:null==ye||null===(t=ye.endDate)||void 0===t?void 0:t.message,invalidText:null==ye||null===(r=ye.endDate)||void 0===r?void 0:r.message}))}}),O&&l().createElement(a.PhF,{name:"location",className:"select-field",labelText:n("location","Location"),id:"location",onChange:function(e){return ke("location",e.target.value)},defaultValue:""},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:n("Choose a location")}),null===(t=null!=d?d:[])||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})}))),I&&l().createElement(sr.Qr,{control:be,name:"childLocations",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(a.XZJ,{id:"childLocations",onChange:r,value:o,labelText:n("IncludeChildLocations","Include Child Locations")})}}),ce&&l().createElement(sr.Qr,{control:be,name:"mostLeastMoving",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(a.SYO,{name:"mostLeastMoving",legendText:n("rank","Rank"),onChange:r,value:o},l().createElement(a.EUY,{value:"MostMoving",id:"mostLeastMovingMost",labelText:n("mostMoving","Most Moving")}),l().createElement(a.EUY,{value:"LeastMoving",id:"mostLeastMovingLeast",labelText:n("LeastMoving","Least Moving")}))}}),ae&&l().createElement(sr.Qr,{control:be,name:"limit",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(a.Y2U,{id:"limitTop",allowEmpty:!0,value:o,onchange:r,label:n("limit","Limit"),defaultValue:20})}}),de&&l().createElement("div",{style:{display:"flex",flexDirection:"row",gap:"0 1rem"}},l().createElement(sr.Qr,{control:be,name:"fullFillment",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(l().Fragment,null,l().createElement(a.XZJ,{id:"allFulfillment",checked:null==o?void 0:o.includes("All"),onChange:function(e){var t=e.target.checked;r(t?["All"]:o.filter((function(e){return"All"!==e})))},labelText:n("all","All")}),l().createElement(a.XZJ,{id:"fullFulfillment",checked:null==o?void 0:o.includes("Full"),onChange:function(e){var t=e.target.checked;r(t?Nc(o.filter((function(e){return"All"!==e}))).concat(["Full"]):o.filter((function(e){return"Full"!==e})))},labelText:n("fullFulfillment","Full Fulfillment")}),l().createElement(a.XZJ,{id:"partialFulfillment",checked:null==o?void 0:o.includes("Partial"),onChange:function(e){var t=e.target.checked;r(t?Nc(o.filter((function(e){return"All"!==e}))).concat(["Partial"]):o.filter((function(e){return"Partial"!==e})))},labelText:n("partialFulfillment","Partial Fulfillment")}),l().createElement(a.XZJ,{id:"noneFulfillment",checked:null==o?void 0:o.includes("None"),onChange:function(e){var t=e.target.checked;r(t?Nc(o.filter((function(e){return"All"!==e}))).concat(["None"]):o.filter((function(e){return"None"!==e})))},labelText:n("noneFulfillment","Non Fulfillment")}))}}))),l().createElement("div",{className:bc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Q},n("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},n("continue","Continue"))))},Bc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("New Report",l().createElement(Tc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var Pc=n(5861),Uc={};Uc.styleTagTransform=b(),Uc.setAttributes=g(),Uc.insert=p().bind(null,"head"),Uc.domAPI=d(),Uc.insertStyleElement=v(),s()(Pc.Z,Uc);const jc=Pc.Z&&Pc.Z.locals?Pc.Z.locals:void 0;var Fc=n(6811),zc=n(3570);function Lc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Lc(e,t,n[t])}))}return e}function Mc(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 qc=function(){var e=(0,E.useTranslation)().t,t=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 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}}(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}}(),n=t.reports,o=t.isLoading,c=t.currentPage,s=t.pageSizes,u=t.totalItems,d=t.goTo,m=t.currentPageSize,p=t.setPageSize,A=(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"}]}),[]),g=(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")}),[]),f=(0,i.useMemo)((function(){return null==n?void 0:n.map((function(e,t){var n,r,o;return Mc(Rc({},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(Fc.mg,{className:"report-cancelled",title:e.status}),e.status===Sc&&l().createElement(To.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(zc.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:Zt.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)===Sc&&(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 g(e.uuid,e.outputArtifactFileExt)}}))})}))}),[n,g]);return o?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:jc.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:f,headers:A,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,o=t.headers,i=t.getHeaderProps,c=t.getTableProps,s=t.getRowProps,u=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:jc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement(Bc,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,Mc(Rc({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jc.desktopHeader:jc.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,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Rc({className:r.isDesktop?jc.desktopRow:jc.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===n.length?l().createElement("div",{className:jc.tileContainer},l().createElement(a.n9L,{className:jc.tile},l().createElement("div",{className:jc.tileContent},l().createElement("p",{className:jc.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:jc.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:c,pageSize:m,pageSizes:s,totalItems:u,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&p(t),n!==c&&d(n)},className:jc.paginationOverride}))};var Gc="@openmrs/esm-stock-management-app",Hc={featureName:"stock-management",moduleName:Gc},Zc=n(3979),Yc=(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}))))}),Hc),Qc=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),Hc),Jc=(0,r.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Pe.BrowserRouter,{basename:e},l().createElement("div",{className:De.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(Xl,null)}),l().createElement(Pe.Route,{path:"stock-operations",element:l().createElement($a,null)}),l().createElement(Pe.Route,{path:"stock-user-scopes",element:l().createElement($t,null)}),l().createElement(Pe.Route,{path:"stock-sources",element:l().createElement(Bn,null)}),l().createElement(Pe.Route,{path:"stock-locations",element:l().createElement(fc,null)}),l().createElement(Pe.Route,{path:"stock-reports",element:l().createElement(qc,null)}),l().createElement(Pe.Route,{path:"stock-settings",element:l().createElement($l,null)}))),l().createElement(Ee,null)))}),Hc),Wc=(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")))))}),Hc),Kc=(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:Gc}),Vc=(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:Gc}),Xc=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=O((0,i.useState)(),2),c=o[0],s=o[1],u=O((0,i.useState)(!0),2),d=u[0],m=(u[1],O((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")))))}),Hc),$c=(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"))}),Hc);function es(){(0,r.defineConfigSchema)(Gc,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([[56],{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__patientListSearch___eGIzx{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__patientListSearch___eGIzx 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__patientListDownload___J2Ob4{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,yDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,+DACE,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,2DACE,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_",patientListSearch:"-esm-stock-management__table__patientListSearch___eGIzx",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",patientListDownload:"-esm-stock-management__table__patientListDownload___J2Ob4",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,CHpBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDrBM,CCsBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,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,kFAME,eAAA,CALA,iLACE,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}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACI,gBAAA,CACA,aAAA,CAGJ,kEACI,YAAA,CACA,kBAAA,CAEJ,oEACI,gBCyDS,CDtDb,yEACI,gBAAA,CACA,aAAA",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"};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:8px;height:100%}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL{padding-bottom:8px}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL .cds--list-box__menu{min-width:15rem;z-index:1}',"",{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,CGrGJ,sEACI,qBHGY,CGFZ,YDyBS,CCxBT,gBAAA,CAGF,iEACE,qBHNI,CGOJ,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEF,2DFw0BE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CEt0BA,aJvBM,CIwBN,mBAAA,CAGF,0DFk0BE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CEh0BA,aJ7BM,CIgCR,6DF6zBE,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CE3zBA,aJlCM,CImCN,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBJzCI,CI0CJ,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,CAEF,6DACE,eAAA,CACA,WAAA,CAEF,gEACE,kBAAA,CAEA,qFACE,eAAA,CACA,SAAA",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},5464:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deleteStockModal:()=>Kc,deleteUserScopeModal:()=>Vc,importBulkStockItemsDialog:()=>Xc,importTranslation:()=>Zc,startupApp:()=>es,stockManagement:()=>Qc,stockManagementAdminCardLink:()=>Yc,stockManagementAppMenuItem:()=>$c,stockManagementDashboard:()=>Jc,stockOperationDialog:()=>Wc});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(2034),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 D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(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 D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}(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),K=function(e,t){return e?W()(e).format(null!=t?t:"DD-MMM-YYYY"):""},V=("".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 K(e,V)},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 De=we.Z&&we.Z.locals?we.Z.locals:void 0;var Oe=n(1940),xe={};xe.styleTagTransform=b(),xe.setAttributes=g(),xe.insert=p().bind(null,"head"),xe.domAPI=d(),xe.insertStyleElement=v(),s()(Oe.Z,xe);const Ne=Oe.Z&&Oe.Z.locals?Oe.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","Stock Items"),link:"stock-items"},{name:n("stockManagementOperations","Stock Operations"),link:"stock-operations"},{name:n("stockManagementStockUserScopes","Stock User Role Scopes"),link:"stock-user-scopes"},{name:n("stockManagementStockSources","Stock Sources"),link:"stock-sources"},{name:n("stockManagementLocations","Stock Locations"),link:"stock-locations"},{name:n("stockManagementReports","Stock Reports"),link:"stock-reports"},{name:n("stockManagementSettings","Stock 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,u=e.label,d=e.value,m=e.headerLabel,p=e.children,A=e.view,g=e.count,f=e.outofstockCount,v=e.disposedCount,_=(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},m),p),A&&l().createElement(r.ConfigurableLink,{className:Re.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},_("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},u),l().createElement("p",{className:Re.totalsValue},d)),!(0,Me.Z)(g)&&l().createElement("div",{className:Re.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},_("in7days","In 7 days")),l().createElement("span",{style:{color:" #FABA5F"}},_("in30days","In 30 days")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=g.expiry7days)||void 0===t?void 0:t.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(n=g.expiry30days)||void 0===n?void 0:n.length)),!(0,Me.Z)(f)&&l().createElement("div",{className:Re.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},_("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},_("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(o=f.itemsbelowmin)||void 0===o?void 0:o.length),l().createElement("p",{style:{color:"#319227"}},null===(i=f.itemsabovemax)||void 0===i?void 0:i.length)),!(0,Me.Z)(v)&&l().createElement("div",{className:Re.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},_("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},_("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(c=v.expired)||void 0===c?void 0:c.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(s=v.poorquality)||void 0===s?void 0:s.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;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 Ke(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 Ve(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"),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-m)/864e5);return r<=t||r<0})),g=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 f=o.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=7})),v=o.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=30})),_=g&&g.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),b=g&&g.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:{expiry7days:f,expiry30days:v}}),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:f,itemsabovemax:v}}),l().createElement(He,{label:t("disposedstock","Disposed Stock"),value:(null==g?void 0:g.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:_,poorquality:b}})))};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,$e()),i=o.items;if(o.isLoading)return l().createElement(l().Fragment,null);if(0===(null==i?void 0:i.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:it.content},e("inventoryAlertNull","No inventory alerts to display")));var c=new Date,s=n.map((function(e){var t=null==i?void 0:i.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)}));s=s.filter((function(e){return e.hasExpiration}));var u=s.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),r=Math.ceil((n-c)/864e5);return r<=t||r<0}));return l().createElement(l().Fragment,null,u.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(4857);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 Dt(){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 Ot(){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}}var It=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function Tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Bt(e,t,n,r,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 Pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ut(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){Pt(e,t,n[t])}))}return e}function jt(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 Ft(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)||Lt(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 Tt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Lt(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 Lt(e,t){if(e){if("string"==typeof e)return Tt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tt(e,t):void 0}}var Rt=ee();const Mt=function(e){var t,n,o,c,s,u,d,m=e.model,p=(0,E.useTranslation)().t,A=Ft((0,i.useState)(Ut({},m)),2),g=A[0],f=A[1],v=Ft((0,i.useState)([]),2),_=v[0],b=v[1],h=Ft((0,i.useState)(!1),2),y=(h[0],h[1]),k=Dt(),C=k.types.results,w=k.isLoading,S=xt({v:U.Default}),D=S.items,O=S.isLoading,x=Ft((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=Ft((0,i.useState)(""),2),R=(L[0],L[1]),M=Ft((0,i.useState)([]),2),q=M[0],G=M[1],H=null!==(o=null==D?void 0:D.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){It("ws/rest/v1/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){Bt(o,n,r,a,i,"next",e)}function i(e){Bt(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e){return s.apply(this,arguments)});return w||F||O?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==D||null===(t=D.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(jt(Ut({},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(jt(Ut({},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(jt(Ut({},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(jt(Ut({},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:$(Rt),locale:"en",dateFormat:X,onChange:function(e){f(jt(Ut({},g),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,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:V,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(jt(Ut({},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(jt(Ut({},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==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=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(jt(Ut({},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=zt(null!==(l=null==g?void 0:g.locations)&&void 0!==l?l:[]).concat([s]);f(jt(Ut({},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")))))},qt=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Mt,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function Gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ht=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Mt,{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){Gt(e,t,n[t])}))}return e}({size:16},e))}})};var Zt=n(1657);function Yt(e,t){(null==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 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 Jt=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 Yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yt(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(){It("ws/rest/v1/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(Zt.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){Qt(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kt(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){Wt(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 Xt=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=ht({v:U.Default,totalCount:!0}),o=n.items,c=n.totalItems,s=n.currentPage,u=n.pageSizes,d=n.goTo,m=n.currentPageSize,p=n.setPageSize,A=n.isLoading,g=(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"}]}),[]),f=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(n,r){var i,c,s,u,d,m;return Vt(Kt({},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===(i=n.locations)||void 0===i?void 0:i.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===(c=s.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===c?void 0:c.join(", "),permanent:(null==n?void 0:n.permanent)?e("stockmanagement.yes","Yes"):e("stockmanagement.no","No"),activeFrom:null!==(u=K(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=K(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(Ht,{data:o[r]}),l().createElement(Jt,{uuid:o[r].uuid}))})}))}),[t.user.uuid,o,e]);return A?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!=f?f:[],headers:g,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,o=t.headers,i=t.getHeaderProps,c=t.getTableProps,s=t.getRowProps,u=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:u}),l().createElement(qt,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,Vt(Kt({},i({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,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Kt({className:r.isDesktop?_t.desktopRow:_t.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===n.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:s,pageSize:m,pageSizes:u,totalItems:c,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&p(t),n!==s&&d(n)},className:_t.paginationOverride}))},$t=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Xt,null))};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}function tn(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}function nn(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 rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var on=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})},an=n(8098),ln={};ln.styleTagTransform=b(),ln.setAttributes=g(),ln.insert=p().bind(null,"head"),ln.domAPI=d(),ln.insertStyleElement=v(),s()(an.Z,ln);const cn=an.Z&&an.Z.locals?an.Z.locals:void 0;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 un(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){un(e,t,n[t])}))}return e}function mn(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 pn=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)(dn({},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 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}}(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=tn({},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")}),on("ws/rest/v1/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:cn.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(mn(dn({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:cn.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(mn(dn({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:cn.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(mn(dn({},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")))))},An=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(pn,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var gn=n(5551),fn={};fn.styleTagTransform=b(),fn.setAttributes=g(),fn.insert=p().bind(null,"head"),fn.domAPI=d(),fn.insertStyleElement=v(),s()(gn.Z,fn);const vn=gn.Z&&gn.Z.locals?gn.Z.locals:void 0;function _n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const bn=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:vn.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return _n(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 _n(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_n(e,t):void 0}}(t)||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 hn=n(6940),yn={};yn.styleTagTransform=b(),yn.setAttributes=g(),yn.insert=p().bind(null,"head"),yn.domAPI=d(),yn.insertStyleElement=v(),s()(hn.Z,yn);const kn=hn.Z&&hn.Z.locals?hn.Z.locals:void 0;function Cn(e,t){(null==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 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,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 Cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cn(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),on("ws/rest/v1/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(Zt.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){En(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dn=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(pn,{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){Sn(e,t,n[t])}))}return e}({size:16},e))}})};function On(e,t){(null==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 xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){xn(e,t,n[t])}))}return e}function In(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 Tn=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 On(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?On(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=nn(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 rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((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}),d=u.items,m=u.totalItems,p=u.tableHeaders,A=u.currentPage,g=u.pageSizes,f=u.goTo,v=u.currentPageSize,_=u.setPageSize,b=u.isLoading,h=(0,i.useMemo)((function(){return null==d?void 0:d.map((function(e,t){var n;return In(Nn({},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(Dn,{data:d[t]}),l().createElement(wn,{uuid:d[t].uuid}))})}))}),[d]),y=function(e){s(e)},k=(0,i.useMemo)((function(){return c?h.filter((function(e){return e.sourceType===c})):h}),[h,c]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:kn.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:k,headers:p,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,c=e.getTableProps,s=e.getRowProps,u=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:kn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(bn,{onFilterChange:y})),l().createElement(An,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,In(Nn({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?kn.desktopHeader:kn.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,Nn({className:r.isDesktop?kn.desktopRow:kn.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:kn.tileContainer},l().createElement(a.n9L,{className:kn.tile},l().createElement("div",{className:kn.tileContent},l().createElement("p",{className:kn.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:kn.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:A,pageSize:v,pageSizes:g,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==v&&_(t),n!==A&&f(n)},className:kn.paginationOverride}))},Bn=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Tn,null))};function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Un(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 Pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(e,t):void 0}}(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 jn=n(1535),Fn={};Fn.styleTagTransform=b(),Fn.setAttributes=g(),Fn.insert=p().bind(null,"head"),Fn.domAPI=d(),Fn.insertStyleElement=v(),s()(jn.Z,Fn);const zn=jn.Z&&jn.Z.locals?jn.Z.locals:void 0;var Ln="RETURNED",Rn="CANCELLED",Mn="REJECTED",qn=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Ln,Rn,Mn],Gn=n(6817);function Hn(e,t){(null==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 Zn=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Dt(),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 Hn(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 Hn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hn(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(Gn.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 Yn=n(5260),Qn={};Qn.styleTagTransform=b(),Qn.setAttributes=g(),Qn.insert=p().bind(null,"head"),Qn.domAPI=d(),Qn.insertStyleElement=v(),s()(Yn.Z,Qn);const Jn=Yn.Z&&Yn.Z.locals?Yn.Z.locals:void 0,Wn=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?Jn.tabContainer:"","\n ").concat(Jn.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Jn.heading},n),l().createElement("div",{className:Jn.tab},l().createElement(a.mQc,{className:"".concat(Jn.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 Kn,Vn;function Xn(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}(Vn=Kn||(Kn={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Vn.DISPOSED_OPERATION_TYPE="disposed",Vn.STOCK_ISSUE_OPERATION_TYPE="stockissue",Vn.STOCK_TAKE_OPERATION_TYPE="stocktake",Vn.REQUISITION_OPERATION_TYPE="requisition",Vn.OPENING_STOCK_OPERATION_TYPE="initial",Vn.RECEIPT_OPERATION_TYPE="receipt",Vn.RETURN_OPERATION_TYPE="return",Vn.ADJUSTMENT_OPERATION_TYPE="adjustment";var $n=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},er=function(e){return!tr(e)&&"requisition"!==e},tr=function(e){return"receipt"===e||"initial"===e},nr=function(e){return"requisition"===e},rr=function(e){return"receipt"===e||"initial"===e},or=function(e){return"stockissue"===e||"return"===e},ar=function(e){return"stockissue"===e||ir(e)||lr(e)||cr(e)},ir=function(e){return"requisition"===e},lr=function(e){return"receipt"===e},cr=function(e){return"transferout"===e},sr=n(7536),ur=n(6312),dr=n(1604),mr=dr.z.object({id:dr.z.string().nullish(),uuid:dr.z.string().nullish(),stockItemUuid:dr.z.string().nullish(),packagingUomName:dr.z.string().nullish(),packagingUomUuid:dr.z.string().nullish(),factor:dr.z.number().nullish(),isDefaultStockOperationsUoM:dr.z.boolean().nullish(),isDispensingUnit:dr.z.boolean().nullish()}),pr=dr.z.object({canView:dr.z.boolean(),canEdit:dr.z.boolean(),canApprove:dr.z.boolean().nullish(),canReceiveItems:dr.z.boolean().nullish(),canDisplayReceivedItems:dr.z.boolean().nullish(),isRequisitionAndCanIssueStock:dr.z.boolean().nullish(),canUpdateBatchInformation:dr.z.boolean().nullish()}),Ar=dr.z.object({itemIndex:dr.z.number().nullish(),id:dr.z.string().nullish(),uuid:dr.z.string().nullish(),stockItemUuid:dr.z.string().nullish(),stockItemName:dr.z.string().nullish(),stockItemPackagingUOMUuid:dr.z.string().nullish(),stockItemPackagingUOMName:dr.z.string().nullish(),stockBatchUuid:dr.z.string().nullish(),batchNo:dr.z.string().nullish(),expiration:dr.z.coerce.date().nullish(),quantity:dr.z.number().nullish(),purchasePrice:dr.z.number().nullish(),permission:pr.nullish(),edit:dr.z.boolean().nullish(),hasExpiration:dr.z.boolean().nullish(),packagingUnits:mr.array(),quantityReceived:dr.z.number().nullish(),quantityReceivedPackagingUOMName:dr.z.string().nullish(),quantityReceivedPackagingUOMUuid:dr.z.string().nullish(),quantityRequested:dr.z.number().nullish(),quantityRequestedPackagingUOMUuid:dr.z.string().nullish(),quantityRequestedPackagingUOMName:dr.z.string().nullish(),commonName:dr.z.string().nullish(),acronym:dr.z.string().nullish()}),gr=(dr.z.object({uuid:dr.z.string().nullish(),cancelReason:dr.z.string().nullish(),cancelledBy:dr.z.coerce.number(),cancelledByGivenName:dr.z.string().nullish(),cancelledByFamilyName:dr.z.string().nullish(),cancelledDate:dr.z.coerce.date(),completedBy:dr.z.coerce.number(),completedByGivenName:dr.z.string().nullish(),completedByFamilyName:dr.z.string().nullish(),completedDate:dr.z.coerce.date(),destinationUuid:dr.z.string().nullish(),destinationName:dr.z.string().nullish(),externalReference:dr.z.string().nullish(),atLocationUuid:dr.z.string().nullish(),atLocationName:dr.z.string().nullish(),operationDate:dr.z.coerce.date(),submitted:dr.z.boolean(),submittedBy:dr.z.string().nullish(),submittedByGivenName:dr.z.string().nullish(),submittedByFamilyName:dr.z.string().nullish(),locked:dr.z.boolean(),operationNumber:dr.z.string().nullish(),operationOrder:dr.z.coerce.number(),remarks:dr.z.string().nullish(),sourceUuid:dr.z.string().nullish(),sourceName:dr.z.string().nullish(),status:dr.z.enum(qn),returnReason:dr.z.string().nullish(),rejectionReason:dr.z.string().nullish(),operationTypeUuid:dr.z.string().nullish(),operationType:dr.z.string().nullish(),operationTypeName:dr.z.string().nullish(),responsiblePerson:dr.z.coerce.number(),responsiblePersonUuid:dr.z.string().nullish(),responsiblePersonGivenName:dr.z.string().nullish(),responsiblePersonFamilyName:dr.z.string().nullish(),responsiblePersonOther:dr.z.string().nullish(),creator:dr.z.coerce.number(),dateCreated:dr.z.coerce.date(),creatorGivenName:dr.z.string().nullish(),creatorFamilyName:dr.z.string().nullish(),permission:pr.nullish(),reasonUuid:dr.z.string().nullish(),reasonName:dr.z.string().nullish(),approvalRequired:dr.z.boolean().nullish(),stockOperationItems:Ar.array(),submittedDate:dr.z.coerce.date(),returnedByGivenName:dr.z.string().nullish(),returnedByFamilyName:dr.z.string().nullish(),returnedDate:dr.z.coerce.date(),rejectedByGivenName:dr.z.string().nullish(),rejectedByFamilyName:dr.z.string().nullish(),rejectedDate:dr.z.coerce.date(),dispatchedByGivenName:dr.z.string().nullish(),dispatchedByFamilyName:dr.z.string().nullish(),dispatchedDate:dr.z.coerce.date(),requisitionStockOperationUuid:dr.z.string()}),dr.z.object({operationDate:dr.z.coerce.date(),sourceUuid:dr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:dr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:dr.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:dr.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:dr.z.string().nullish(),remarks:dr.z.string().nullish()})),fr=function(e){switch(e){case Kn.OPENING_STOCK_OPERATION_TYPE:return gr.omit({destinationUuid:!0,reasonUuid:!0});case Kn.STOCK_TAKE_OPERATION_TYPE:case Kn.ADJUSTMENT_OPERATION_TYPE:case Kn.DISPOSED_OPERATION_TYPE:return gr.omit({destinationUuid:!0});case Kn.TRANSFER_OUT_OPERATION_TYPE:case Kn.STOCK_ISSUE_OPERATION_TYPE:return gr.omit({reasonUuid:!0}).merge(dr.z.object({destinationUuid:dr.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Kn.RETURN_OPERATION_TYPE:case Kn.REQUISITION_OPERATION_TYPE:case Kn.RECEIPT_OPERATION_TYPE:return gr.omit({reasonUuid:!0}).merge(dr.z.object({sourceUuid:dr.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const vr=function(e){return l().createElement(sr.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 _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,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 hr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yr(e){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 hr(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 hr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hr(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 kr=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:""}},Cr={uuid:"Other",display:"Other",person:{display:"Other"}};function Er(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const wr=function(e){var t=function(e){var t=br((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=br((0,i.useState)(null),2),s=c[0],u=c[1],d=br((0,i.useState)(10),2),m=d[0],p=d[1],A=br((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=yr((function(e){o(e)}),1e3);return r&&r.push(Cr),l().createElement("div",null,l().createElement(sr.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:Er,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 Sr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dr=function(e){return l().createElement(sr.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){Sr(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))}})},Or=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(sr.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 xr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nr=function(e){return l().createElement(sr.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){xr(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 Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Tr=(0,i.createContext)(null),Br=function(){return(0,i.useContext)(Tr)},Pr=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 Ir(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(e,t):void 0}}(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(Tr.Provider,{value:a},r)},Ur=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.RECEIPT_OPERATION_TYPE,Kn.STOCK_ISSUE_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.RETURN_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE,Kn.TRANSFER_OUT_OPERATION_TYPE],jr=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE];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 zr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Lr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rr(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.")}()}const Mr=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,D=k.sourcePartyList,O=k.destinationPartyList,x=(0,E.useTranslation)().t,N=(Br().setFormContext,Un({v:U.Full,totalCount:!0})),T=N.isLoading,B=(N.items,Xn(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){Lr(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,sr.cI)({defaultValues:"stockissue"===B?P:v,mode:"all",resolver:(0,ur.F)(fr(B))}),F=j.handleSubmit,z=j.control,L=j.formState.errors,R=j.setValue,M=Rr((0,i.useState)(),2),q=M[0],G=M[1],H=Rr((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,K,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 Ur.includes(e)}(n)&&delete r.destinationName,function(e){return jr.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){zr(a,r,o,i,l,"next",e)}function l(e){zr(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(sr.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:n},l().createElement(a.aj6,{invalid:!!L.operationDate,invalidText:null==L||null===(t=L.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:x("operationDate","Operation Date"),value:$(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(vr,{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:D||[]}),(!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(vr,{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:O||[]}),(!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(wr,{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)===Cr.uuid&&G(!0)}}),q&&l().createElement(Dr,{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!==(K=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==Cr.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==K?K:"",readOnly:!0,labelText:"Responsible Person"}),C&&h&&l().createElement(Or,{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(Nr,{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 qr={stockItemUuid:dr.z.string().min(1,{message:"Required"}),stockItemName:dr.z.string().min(1).nullish(),stockItemPackagingUOMUuid:dr.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:dr.z.string().min(1).nullish(),batchNo:dr.z.string().min(1,{message:"Required"}),stockBatchUuid:dr.z.string().optional(),expiration:dr.z.coerce.date({required_error:"Required"}),quantity:dr.z.coerce.number().min(1,{message:"Required"}),purchasePrice:dr.z.coerce.number().nullish(),hasExpiration:dr.z.boolean().nullish()},Gr=dr.z.object(qr),Hr=(Gr.omit({expiration:!0}),dr.z.object({stockItems:dr.z.array(Gr)})),Zr=n(6781),Yr={};Yr.styleTagTransform=b(),Yr.setAttributes=g(),Yr.insert=p().bind(null,"head"),Yr.domAPI=d(),Yr.insertStyleElement=v(),s()(Zr.Z,Yr);const Qr=Zr.Z&&Zr.Z.locals?Zr.Z.locals:void 0;function Jr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jr(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 Kr(e){return e.drugName||e.conceptName}const Vr=function(e){var t=function(e){var t=Wr((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=Wr((0,i.useState)(null),2),s=c[0],u=c[1],d=Wr((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Wr((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=yr((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(sr.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: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..."}))},Xr=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(sr.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 $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,t){(null==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 no(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 to(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?to(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 ro(e){var t=no((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=no((0,i.useState)(10),2),a=o[0],l=o[1],c=no((0,i.useState)(null),2),s=c[0],u=c[1],d=no((0,i.useState)(1),2),m=d[0],p=d[1],A=no((0,i.useState)(),2),g=A[0],f=A[1],v=no((0,i.useState)(),2),_=v[0],b=v[1],h=no((0,i.useState)(),2),y=h[0],k=h[1],C=no((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,includeBatchNo:!0})}),[s,m,a,g,_,y,E]);var S,D=Ye(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:b,setStockBatchUuid:w}}function oo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ao=function(e){var t=function(e){var t=eo((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=eo((0,i.useState)(null),2),s=c[0],u=c[1],d=eo((0,i.useState)(10),2),m=d[0],p=d[1],A=eo((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=ro(U.Default),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){oo(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(sr.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 io(e,t){(null==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 lo(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 io(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?io(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 co=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=lo((0,i.useState)(),2),_=(v[0],v[1]),b=lo((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,D,O,x,N,I,T,B,P,U,j,F,z,L,R,M,q,G,H,Z,Y,Q,J,W,K,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Qr.desktopRow:Qr.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(Vr,{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(ao,{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===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=lo(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:V,defaultValue:$(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!==(K=null===(F=d[null==e?void 0:e.stockBatchUuid])||void 0===F?void 0:F.quantityUoM)&&void 0!==K?K:""):"",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(Xr,{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:Zt.ZN,onClick:function(){return g(i)}})))})))};var so=n(6360),uo={};uo.styleTagTransform=b(),uo.setAttributes=g(),uo.insert=p().bind(null,"head"),uo.domAPI=d(),uo.insertStyleElement=v(),s()(so.Z,uo);const mo=so.Z&&so.Z.locals?so.Z.locals:void 0;function po(e,t){(null==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,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 go(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fo(e){return function(e){if(Array.isArray(e))return po(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vo(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 vo(e,t){if(e){if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?po(e,t):void 0}}const _o=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,D=Br().formContext,O=function(e){if("requisition"===e){var t=Gr.omit({batchNo:!0,expiration:!0});return dr.z.object({stockItems:dr.z.array(t)})}return Hr}(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){Ao(a,r,o,i,l,"next",e)}function l(e){Ao(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,sr.cI)({resolver:(0,ur.F)(O),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,B=N.setValue,P=N.formState.errors,U=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||vo(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,sr.Dq)({name:"stockItems",control:T}),F=j.fields,z=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==D?void 0:D.stockItems){var e=null==D?void 0:D.stockItems;null==e||e.forEach((function(e){return z(e)}))}}),[z,null==D?void 0:D.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(fo(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),fo(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),fo(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),fo(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")}],fo(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:mo.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){go(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?mo.desktopHeader:mo.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(co,{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 bo=n(8808);function ho(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yo(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){yo(a,r,o,i,l,"next",e)}function l(e){yo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Co(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ho(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ho(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Eo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const wo=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=Co((0,i.useState)(!1),2),d=u[0],m=u[1],p=Co((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:ko((function(){return Eo(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),[4,c.onComplete(r)];case 1:return e.sent(),m(!1),[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:c.onDispatch,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:bo.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:ko((function(){return Eo(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:bo.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:Zt.WP},s("goBack","Go Back"))))};var So="Location",Do="Other";function Oo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function xo(){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,D,O,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(kr()),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,Kn.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 D=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)===So&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===Do})),(null==e?void 0:e.hasSource)&&A&&k&&(null==D?void 0:D.length)>0&&(T=D[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(O=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)===So&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===Do})),A&&w&&(null==O?void 0:O.length)>0&&(U=O[0],p.destinationUuid=U.uuid,p.destinationName=U.name)),[3,4];case 2:return[4,Ot()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return F=Xn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=F,"adjustment"===Y),requiresBatchUuid:er(F),requiresActualBatchInfo:tr(F),isQuantityOptional:nr(F),canCaptureQuantityPrice:rr(F),requiresStockAdjustmentReason:$n(F),requiresDispatchAcknowledgement:or(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||ar(F),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===So&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===Do},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===So&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===Do},location:S,sourcePartyList:D,destinationPartyList:O,stockOperationTypes:v,hasQtyRequested:f}]}var Y,Q}))},xo=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Oo(a,r,o,i,l,"next",e)}function l(e){Oo(a,r,o,i,l,"throw",e)}i(void 0)}))},xo.apply(this,arguments)}function No(e,t){(null==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 Io(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 No(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?No(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 To=n(3133);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:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(To.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){Bo(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};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:"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){Uo(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};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:"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){Fo(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};function Lo(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=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){Lo(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};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)}var qo,Go,Ho=(qo=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={},Kn.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):Kn.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]}))},Go=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=qo.apply(e,t);function a(e){Mo(o,n,r,a,i,"next",e)}function i(e){Mo(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Go.apply(this,arguments)});function Zo(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 Yo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Zo(a,r,o,i,l,"next",e)}function l(e){Zo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Qo(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 Jo=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>")},Wo=function(){var e=Yo((function(){var e,t;return Qo(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)}}(),Ko=function(){var e=Yo((function(){var e;return Qo(this,(function(t){switch(t.label){case 0:return[4,Wo()];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)}}(),Vo=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 Xo(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 $o(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Xo(a,r,o,i,l,"next",e)}function l(e){Xo(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ea(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 ta=function(){var e=$o((function(e){var t,n,r,o,a,i,l,c,s;return ea(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,Ko()];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(K(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(K(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)}}(),na=function(){var e=$o((function(e){var t;return ea(this,(function(n){switch(n.label){case 0:return[4,ta(e)];case 1:return t=n.sent(),Vo(Jo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ra(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 oa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ra(a,r,o,i,l,"next",e)}function l(e){ra(a,r,o,i,l,"throw",e)}i(void 0)}))}}function aa(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 ia=function(){var e=oa((function(e){var t,n,r,o,a,i,l,c,s;return aa(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,Ko()];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(K(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(K(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)}}(),la=function(){var e=oa((function(e){var t;return aa(this,(function(n){switch(n.label){case 0:return[4,ia(e)];case 1:return t=n.sent(),Vo(Jo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ca(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){ca(a,r,o,i,l,"next",e)}function l(e){ca(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 da=function(){var e=sa((function(e){var t,n,r,o,a,i,l,c;return ua(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,Ko()];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(K(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)}}(),ma=function(){var e=sa((function(e){var t;return ua(this,(function(n){switch(n.label){case 0:return[4,da(e)];case 1:return t=n.sent(),Vo(Jo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function pa(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 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,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){pa(a,r,o,i,l,"next",e)}function l(e){pa(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,Ho(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,na(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,la(c)];case 4:return u.sent(),[3,7];case 5:return[4,ma(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){Aa(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};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:"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){fa(e,t,n[t])}))}return e}({size:16},e))}},n("approve","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}const ba=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){_a(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ya(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ha(e,t,n[t])}))}return e}const ka=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=ya({},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(){La(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(ut.ei,ya({size:16},e))}},s("issueStock","Issue Stock "))};var Ca=n(2496),Ea={};Ea.styleTagTransform=b(),Ea.setAttributes=g(),Ea.insert=p().bind(null,"head"),Ea.domAPI=d(),Ea.insertStyleElement=v(),s()(Ca.Z,Ea);const wa=Ca.Z&&Ca.Z.locals?Ca.Z.locals:void 0;function Sa(e,t){(null==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 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 Oa(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 xa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Na(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){xa(e,t,n[t])}))}return e}function Ia(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 Ta(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 Sa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sa(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 Ba(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 Pa=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,b,h,y,k,C,w,S,D,O,x,N,I,T,B,P,U,j,F,z,L,R,M,G,H,Z,Y,J,W,K,V,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,De,Oe=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=Io((0,i.useState)(!0),2),n=t[0],r=t[1],o=Io((0,i.useState)(!1),2),a=o[0],l=o[1],c=Io((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return xo.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=Ta((0,i.useState)(null==e?void 0:e.isEditing),2),Fe=je[0],ze=je[1],Le=Ta((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Ta((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:Oe("error","Error"),subtitle:Oe("errorLoadingStockOperation","Error loading stock item"),timeoutInMs:5e3,isLowContrast:!0});var Ze=[{name:"".concat(xe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(Mr,Ia(Na({},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:Oa((function(){return Ba(this,(function(e){return ze(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(_o,Ia(Na({},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:Oa((function(){return Ba(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(wo,Ia(Na({},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=Oa((function(t){return Ba(this,(function(n){switch(n.label){case 0:return[4,za(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:Oa((function(){return Ba(this,(function(t){switch(t.label){case 0:return[4,Ra("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Oa((function(){return Ba(this,(function(t){switch(t.label){case 0:return[4,Ra("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Oa((function(){return Ba(this,(function(t){switch(t.label){case 0:return[4,Ra("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:wa.textHeading},Oe("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:wa.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:wa.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.text},null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByFamilyName," ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:wa.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.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:wa.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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:wa.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:wa.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:wa.statusDescriptions},l().createElement("span",{className:wa.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:wa.text},"By"),l().createElement("span",{className:wa.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===(V=e.model)||void 0===V||null===(K=V.permission)||void 0===K?void 0:K.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)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Po,{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)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&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})),l().createElement("div",{style:{margin:"2px"}},l().createElement(zo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ro,{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(ba,{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===(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(Ro,{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(ka,{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)===Kn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Kn.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Kn.RECEIPT_OPERATION_TYPE||(null==e||null===(De=e.model)||void 0===De?void 0:De.operationType)===Kn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ga,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Pr,null,l().createElement(Wn,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Ua(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 ja(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ua(a,r,o,i,l,"next",e)}function l(e){Ua(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Fa(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 za=function(){var e=ja((function(e,t,n,o,a){var i,l,c,s;return Fa(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===Kn.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)}}(),La=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(Pa,{model:e,onSave:function(e){return za(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},Ra=function(){var e=ja((function(e,t,n){var o;return Fa(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 Ma(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const qa=function(e){var t,n,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 Ma(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ma(e,t):void 0}}(t,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(){La(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Ga(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ha(e,t){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)||Za(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 Za(e,t){if(e){if("string"==typeof e)return Ga(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ga(e,t):void 0}}const Ya=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Nt(t),c=o.items,s=o.isLoading,u=Ha((0,i.useState)(!1),2),d=u[0],m=u[1],p=Ha((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(qn.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 Ga(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Za(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:Ot().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:zn.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 Qa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ja(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ja(e,t,n[t])}))}return e}function Ka(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 Va(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 Qa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(e,t):void 0}}(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 Xa=function(){var e,t=(0,E.useTranslation)().t,n=(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}}),[]),o=Un({v:U.Full,totalCount:!0}),c=o.items,s=o.tableHeaders,u=o.currentPage,d=o.pageSizes,m=o.totalItems,p=o.goTo,A=o.currentPageSize,g=o.setPageSize,f=o.isLoading,v=Va((0,i.useState)(c),2),_=v[0],b=v[1],h=Va((0,i.useState)(null),2),y=h[0],k=h[1],C=Va((0,i.useState)(null),2),w=C[0],S=C[1],D=Va((0,i.useState)([]),2),O=D[0],x=D[1],N=Va((0,i.useState)([]),2),I=N[0],T=N[1],B=Va((0,i.useState)([]),2),P=B[0],j=B[1],F=(0,r.useConfig)(),z=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}})};(0,i.useEffect)((function(){R()}),[y,w,O,I,P,u,A,c]);var L=(0,i.useCallback)((function(e,t){t===te.SOURCES?x(e):t===te.OPERATION?j(e):T(e)}),[]),R=function(){var e=c;O.length>0&&(e=e.filter((function(e){return O.includes(e.sourceName)}))),P.length>0&&(e=e.filter((function(e){return P.includes(e.operationTypeName)}))),I.length>0&&(e=e.filter((function(e){return I.includes(e.status)}))),y&&w?e=e.filter((function(e){var t=new Date(e.operationDate);return t>=y&&t<=w})):y?e=e.filter((function(e){return new Date(e.operationDate)>=y})):w&&(e=e.filter((function(e){return new Date(e.operationDate)<=w}))),b(e)},M=(0,i.useMemo)((function(){return null==_?void 0:_.map((function(r,o){var i,c,s,u,d,m,p,A,g,f,v,b,h,y,k,C,E,w,S;return Ka(Wa({},r),{id:null==r?void 0:r.uuid,key:"key-".concat(null==r?void 0:r.uuid),operationTypeName:"".concat(null==r?void 0:r.operationTypeName),operationNumber:l().createElement(qa,{model:_[o],operations:e}),status:"".concat(null==r?void 0:r.status),source:"".concat(null!==(i=null==r?void 0:r.sourceName)&&void 0!==i?i:""),destination:"".concat(null!==(c=null==r?void 0:r.destinationName)&&void 0!==c?c:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==r?void 0:r.sourceName)&&void 0!==s?s:""," ",(null==r?void 0:r.sourceName)&&(null==r?void 0:r.destinationName)?l().createElement(he.ol,{size:16}):""," ",null!==(u=null==r?void 0:r.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==r?void 0:r.responsiblePersonFamilyName)&&void 0!==d?d:null==r?void 0:r.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==r?void 0:r.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:K(null==r?void 0:r.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"},K(null==r?void 0:r.dateCreated))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(A=r.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=r.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==r?void 0:r.status)&&(null==r?void 0:r.status)!==Ln&&(null==r?void 0:r.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"},K(null==r?void 0:r.submittedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(f=r.submittedByFamilyName)&&void 0!==f?f:""," ",null!==(v=r.submittedByGivenName)&&void 0!==v?v:""))),(null==r?void 0:r.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"},K(null==r?void 0:r.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(b=r.completedByFamilyName)&&void 0!==b?b:""," ",null!==(h=r.completedByGivenName)&&void 0!==h?h:""))),(null==r?void 0:r.status)===Rn&&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"},K(null==r?void 0:r.cancelledDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(y=r.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=r.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,r.cancelReason))),(null==r?void 0:r.status)===Mn&&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"},K(null==r?void 0:r.rejectedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(C=r.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=r.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,r.rejectionReason))),(null==r?void 0:r.status)===Ln&&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"},K(null==r?void 0:r.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=r.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=r.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,r.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:z}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){La(_[o],!0,n,e,!1)}}))})}))}),[z,_,n,e,c]);return f?l().createElement(a.gqd,{className:zn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:zn.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:M,headers:s,isSortable:!0,useZebraStyles:!0,render:function(n){var o=n.rows,i=n.headers,s=n.getHeaderProps,u=n.getTableProps,d=n.getRowProps,m=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:zn.toolbarContent},l().createElement(a.Ys1,{className:zn.patientListSearch,expanded:!0,onChange:m,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:zn.filterContainer},l().createElement(a.Mtg,{className:zn.dateAlign,datePickerType:"range",dateFormat:X,value:[y,w],onChange:function(e){var t=Va(e,2);!function(e){var t=Va(e,2),n=t[0],r=t[1];n&&(k(n),w&&n&&w<n&&S(n)),r&&(S(r),y&&r&&y>r&&k(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:V}),l().createElement(a.aj6,{placeholder:V})),l().createElement(Ya,{conceptUuid:F.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:L}),l().createElement(Ya,{filterName:te.STATUS,onFilterChange:L}),l().createElement(Ya,{filterName:te.OPERATION,onFilterChange:L})),l().createElement(Zn,{onOperationTypeSelected:function(t){La(kr(),!1,t,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,u(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ka(Wa({},s({header:e,isSortable:e.isSortable})),{className:r.isDesktop?zn.desktopHeader:zn.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,n){var o,s,u,m,p,A,g,f,v,b,h,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,F,z,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Wa({className:r.isDesktop?zn.desktopRow:zn.tabletRow},d({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:i.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=_[n])||void 0===o?void 0:o.dateCreated)?K(null===(s=_[n])||void 0===s?void 0:s.dateCreated):""," ",(null===(u=_[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(m=_[n])||void 0===m?void 0:m.dateCreated)?null===(p=_[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=_[n])||void 0===A?void 0:A.completedDate)?K(null===(g=_[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=_[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=_[n])||void 0===v?void 0:v.completedDate)?null===(b=_[n])||void 0===b?void 0:b.creatorFamilyName:""),l().createElement(a.agF,null,(null===(h=_[n])||void 0===h?void 0:h.stockOperationItems)?null===(y=_[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=_[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=_[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=_[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?K(null===(w=_[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=_[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(D=_[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=_[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=_[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?K(null===(N=_[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=_[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=_[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=_[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=_[n])||void 0===P?void 0:P.completedDate)?null===(U=c[n])||void 0===U?void 0:U.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=_[n])||void 0===j?void 0:j.stockOperationItems)?null===(F=_[n].stockOperationItems)||void 0===F?void 0:F.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(z=_[n])||void 0===z?void 0:z.stockOperationItems)?null===(L=_[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===o.length?l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("div",{className:zn.tileContent},l().createElement("p",{className:zn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:zn.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:A,pageSizes:d,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==A&&g(t),n!==u&&p(n)},className:zn.paginationOverride}))},$a=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Xa,null))};var ei={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 ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ni(e,t){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 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}}(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 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}function oi(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const ai=function(e){var t,n,o=function(e){var t=ni((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=ni((0,i.useState)(""),2),s=c[0],u=c[1],d=ni((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=ni((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 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,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(sr.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:oi,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 ii=dr.z.string().max(255).nullish(),li=dr.z.object({isDrug:dr.z.boolean(),drugUuid:dr.z.string().nullish(),drugName:dr.z.string().nullish(),commonName:ii,acronym:ii,hasExpiration:dr.z.boolean(),expiryNotice:dr.z.coerce.number().nullish(),uuid:dr.z.string().nullish(),conceptUuid:dr.z.string().nullish(),conceptName:dr.z.string().nullish(),preferredVendorUuid:dr.z.string().nullish(),preferredVendorName:dr.z.string().nullish(),purchasePrice:dr.z.number().nullish(),purchasePriceUoMUuid:dr.z.string().nullish(),purchasePriceUoMName:dr.z.string().nullish(),categoryUuid:dr.z.string().nullish(),categoryName:dr.z.string().nullish(),dispensingUnitUuid:dr.z.string().nullish(),dispensingUnitName:dr.z.string().nullish(),dispensingUnitPackagingUoMUuid:dr.z.string().nullish(),dispensingUnitPackagingUoMName:dr.z.string().nullish(),defaultStockOperationsUoMUuid:dr.z.string().nullish(),defaultStockOperationsUoMName:dr.z.string().nullish(),reorderLevel:dr.z.number().nullish(),reorderLevelUoMUuid:dr.z.string().nullish(),reorderLevelUoMName:dr.z.string().nullish(),dateCreated:dr.z.coerce.date().nullish(),creatorGivenName:dr.z.string().nullish(),creatorFamilyName:dr.z.string().nullish(),voided:dr.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 ci(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const si=function(e){return l().createElement(sr.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){ci(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})})))}})},ui=function(e){return l().createElement(sr.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,ref:d,onChange:function(t,n){s(t,n),e.onChange&&e.onChange(t,n)}})}})},di=function(e){var t=Nt((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.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})}})},mi=function(e){var t=nn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.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})}})},pi=function(e){var t=Nt((0,r.useConfig)().stockItemCategoryUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.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.onCategoryUuidChange)||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.categoryUuid})))||{},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})}})},Ai=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits[0]: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(sr.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=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){var t;return null!==(t=e.packagingUomName)&&void 0!==t?t:""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}})):l().createElement(l().Fragment,null)},gi=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(Ai,{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(Ai,{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(ui,{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(Ai,{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(ui,{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(Ai,{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 fi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const vi=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 fi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fi(e,t):void 0}}(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(sr.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 _i=[{label:"Drug",value:!0},{label:"Other",value:!1}],bi=[{label:"Yes",value:!0},{label:"No",value:!1}];function hi(e,t){(null==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 yi(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 ki(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 hi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hi(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 Ci=(0,i.forwardRef)((function(e){var t,n,r,o,c,s,u,d,m,p,A,g=e.model,f=e.onSave,v=e.isEditing,_=e.handleTabChange,b=(0,E.useTranslation)().t,h=(0,sr.cI)({defaultValues:g,mode:"all",resolver:(0,ur.F)(li)}),y=h.handleSubmit,k=h.control,C=h.formState,w=C.errors,S=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){yi(a,r,o,i,l,"next",e)}function l(e){yi(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]),x(!0),e.uuid=g.uuid,[4,f(e)];case 1:return t.sent(),_(1),ce("ws/rest/v1/stockmanagement/stockitem"),[3,4];case 2:return t.sent(),[3,4];case 3:return x(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),D=ki((0,i.useState)(!1),2),O=D[0],x=D[1],N=ki((0,i.useState)(!1),2),T=N[0],B=N[1],P=ki((0,i.useState)(!1),2),U=P[0],j=P[1];return(0,i.useEffect)((function(){var e,t;B(null!==(e=g.isDrug)&&void 0!==e&&e),j(null!==(t=g.hasExpiration)&&void 0!==t&&t)}),[g.hasExpiration,g.isDrug]),l().createElement("form",{className:"".concat(I.formContainer," ").concat(I.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(si,{control:k,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!w.isDrug,invalidText:w.isDrug&&(null==w||null===(t=w.isDrug)||void 0===t?void 0:t.message),onChange:function(e){B(e)},options:_i})),T&&l().createElement(ai,{name:"drugUuid",controllerName:"drugUuid",control:k,title:b("pleaseSpecify","Please specify:"),invalid:!!w.drugUuid,invalidText:w.drugUuid&&(null==w||null===(n=w.drugUuid)||void 0===n?void 0:n.message)}),null!=T&&!T&&l().createElement(vi,{name:"conceptUuid",controllerName:"conceptUuid",control:k,title:b("pleaseSpecify","Please specify:"),placeholder:b("chooseAnItem","Choose an item"),invalid:!!w.drugUuid,invalidText:w.drugUuid&&(null==w||null===(r=w.drugUuid)||void 0===r?void 0:r.message)}),l().createElement(Dr,{id:"commonName",name:"commonName",control:k,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(A=null==g?void 0:g.commonName)&&void 0!==A?A:""),labelText:b("commonName","Common name:"),invalid:!!w.commonName,invalidText:w.commonName&&(null==w||null===(o=w.commonName)||void 0===o?void 0:o.message)}),l().createElement(Dr,{id:"acronym",maxLength:255,name:"acronym",control:k,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation:"),invalid:!!w.acronym,invalidText:w.acronym&&(null==w||null===(c=w.acronym)||void 0===c?void 0:c.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(si,{name:"hasExpiration",controllerName:"hasExpiration",control:k,legendText:"",invalid:!!w.hasExpiration,invalidText:w.hasExpiration&&(null==w||null===(s=w.hasExpiration)||void 0===s?void 0:s.message),onChange:function(e){j(e)},options:bi})),U&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(ui,{id:"expiryNotice",name:"expiryNotice",control:k,controllerName:"expiryNotice",size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!w.expiryNotice,invalidText:w.expiryNotice&&(null==w||null===(u=w.expiryNotice)||void 0===u?void 0:u.message)}))),l().createElement(mi,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:k,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!w.preferredVendorUuid,invalidText:w.preferredVendorUuid&&(null==w||null===(d=w.preferredVendorUuid)||void 0===d?void 0:d.message)}),l().createElement(pi,{name:"categoryUuid",controllerName:"categoryUuid",control:k,title:b("category:","Category:"),placeholder:b("chooseACategory","Choose a category"),invalid:!!w.categoryUuid,invalidText:w.categoryUuid&&(null==w||null===(m=w.categoryUuid)||void 0===m?void 0:m.message)}),T&&l().createElement(di,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:k,title:b("dispensingUnit","Dispensing Unit:"),placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!w.dispensingUnitUuid,invalidText:w.dispensingUnitUuid&&(null==w||null===(p=w.dispensingUnitUuid)||void 0===p?void 0:p.message)}),T&&v&&l().createElement(gi,{control:k,formState:C,stockItemUuid:g.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:y(S),kind:"primary",renderIcon:bo.vc},O?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},b("cancel","Cancel"))))}));const Ei=Ci;function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Si(e){var t,n,o=function(e){console.warn("Rules filter: "+JSON.stringify(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 wi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=(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 Di=n(4563),Oi={};Oi.styleTagTransform=b(),Oi.setAttributes=g(),Oi.insert=p().bind(null,"head"),Oi.domAPI=d(),Oi.insertStyleElement=v(),s()(Di.Z,Oi);const xi=Di.Z&&Di.Z.locals?Di.Z.locals:void 0;function Ni(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ii(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ni(e,t,n[t])}))}return e}function Ti(e,t){(null==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){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pi(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){Bi(e,t,n[t])}))}return e}function Ui(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 ji(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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}}(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 Fi=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t;console.warn("Got stock id: ",c);var u=ji((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,A,g,f,v,_,b=Je(d).items,h=(p={v:U.Default},A="".concat(r.restBaseUrl,"/location").concat(F(p,!1)),g=(0,j.ZP)(A,r.openmrsFetch),f=g.data,v=g.error,_=g.isLoading,{locations:(null==f?void 0:f.data)||{},isErrorLocation:v,isLoadingLocations:_}).locations.results,y=St({v:U.Default}),k=y.items,C=(y.isError,y.isLoading,ji((0,i.useState)(),2)),w=C[0],S=C[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){o.dateCreated,o.creatorGivenName,o.creatorFamilyName;var e=Pi({},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"]));S(e)}}),[o]);var D=(0,i.useCallback)((function(e){e.preventDefault(),o&&(w.uuid=o.uuid),c&&(w.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:Ii({},e)})}(w).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()}),[w,o,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:D},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:xi.section},l().createElement("section",{className:xi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==w?void 0:w.locationUuid)?w.locationUuid:"",onChange:function(e){var t=h.find((function(t){return t.uuid===e.target.value}));S(Ui(Pi({},w),{locationUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==h?void 0:h.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))),l().createElement("section",{className:xi.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),S(Ui(Pi({},w),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:xi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==w?void 0:w.stockItemPackagingUOMUuid)?w.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==b?void 0:b.results.find((function(t){return t.uuid===e.target.value}));S(Ui(Pi({},w),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==b?void 0:b.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:xi.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)),S(Ui(Pi({},w),{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:xi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==w?void 0:w.alertRole)?w.alertRole:"",onChange:function(e){var t=null==k?void 0:k.results.find((function(t){return t.display===e.target.value}));S(Ui(Pi({},w),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==k||null===(t=k.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:xi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==w?void 0:w.mailRole)?w.mailRole:"",onChange:function(e){var t=null==k?void 0:k.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),S(Ui(Pi({},w),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==k||null===(n=k.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:xi.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)),S(Ui(Pi({},w),{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)),S(Ui(Pi({},w),{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:xi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==w?void 0:w.enabled);S(Ui(Pi({},w),{enabled:n}))},checked:null==w?void 0:w.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:xi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==w?void 0:w.enableDescendants);S(Ui(Pi({},w),{enableDescendants:n}))},name:"appliesToChildren",checked:null==w?void 0:w.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")))))},zi=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Fi,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var Li=n(4907),Ri={};Ri.styleTagTransform=b(),Ri.setAttributes=g(),Ri.insert=p().bind(null,"head"),Ri.domAPI=d(),Ri.insertStyleElement=v(),s()(Li.Z,Ri);const Mi=Li.Z&&Li.Z.locals?Li.Z.locals:void 0;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}const Gi=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:Mi.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return qi(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 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)||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 Hi(e,t){(null==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 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,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 Hi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hi(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(Zt.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){Zi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};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}const Ji=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Fi,{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){Qi(e,t,n[t])}))}return e}({size:16},e))}})};function Wi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ki(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){Wi(e,t,n[t])}))}return e}function Vi(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 Xi=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t);console.warn("Found stock uuid: "+t);var o=Si({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 Vi(Ki({},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:K(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:K(null==e?void 0:e.lastActionDate),nextActionDate:K(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Ji,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Yi,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:zn.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:zn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Gi,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(zi,{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,Vi(Ki({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?zn.desktopHeader:zn.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,Ki({className:r.isDesktop?zn.desktopRow:zn.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:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("div",{className:zn.tileContent},l().createElement("p",{className:zn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:zn.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:zn.paginationOverride}))};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,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.")}()}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 nl(e){return function(e){if(Array.isArray(e))return tl(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 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}}(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 rl=function(e){var t=Nt((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(sr.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i,c,s,u,d,m,p,A=t.field,g=A.onChange;return A.value,A.ref,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)?nl(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(nl(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),g((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 ol=dr.z.object({id:dr.z.string().nullish(),uuid:dr.z.string().nullish(),stockItemUuid:dr.z.string().nullish(),packagingUomName:dr.z.string().nullish(),packagingUomUuid:dr.z.string().nullish(),factor:dr.z.coerce.number().nullish(),isDefaultStockOperationsUoM:dr.z.boolean().nullish(),isDispensingUnit:dr.z.boolean().nullish()}),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){e.isEditing;var t=e.stockItemUuid,n=e.handleTabChange,o=function(e){var t=el((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=el((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("quantity","Quantity"),styles:{width:"50%"}},{key:"action",header:m("action","Actions"),styles:{width:"50%"}}]}),[]),A=(0,sr.cI)({defaultValues:{},mode:"all",resolver:(0,ur.F)(ol)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(sr.RV,A,l().createElement(a.wQF,{rows:(d=c,function(e){if(Array.isArray(e))return cl(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 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}}(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: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=(0,A.getValues)();(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:e.factor,packagingUomUuid:e.packagingUomUuid,stockItemUuid:t}).then((function(){return(0,r.showSnackbar)({title:m("savePackingUnitTitle","Package Unit"),subtitle:m("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"})}),(function(){(0,r.showSnackbar)({title:m("savePackagingUnitErrorTitle","Package Unit"),subtitle:m("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})),n(0)},kind:"primary",renderIcon:bo.vc},m("save","Save")))};var pl=function(e){var t=e.isEditing,n=e.row,o=e.key,i=(0,E.useTranslation)().t,c=(0,sr.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(rl,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",control:s,invalid:!!u.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(ui,{row:n,controllerName:"factor",name:"factor",control:s,id:"".concat(n.uuid,"-").concat(o),invalid:!!u.factor}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:Zt.ZN,onClick:function(e){return function(e){var t,o,a;e.preventDefault(),(t=n.uuid,o="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),a=new AbortController,(0,r.openmrsFetch)(o,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showToast)({critical:!0,title:i("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:i("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showNotification)({title:i("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}(e)}}))))};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,D=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){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 O=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,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:O}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:O}),l().createElement(a.laM,{itemText:"Download As Json",onClick:O})),l().createElement(a.Ys1,{className:bl.patientListSearch,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:D,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!==D){if(s)return void s(n);w(n)}}})))})))};function wl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sl=function(e){var t,n=e.stockItemUuid,o=function(e){var t=gl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,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)(),2),f=g[0],v=g[1],_=gl((0,i.useState)(),2),b=_[0],h=_[1],y=gl((0,i.useState)(),2),k=y[0],C=y[1],E=gl((0,i.useState)(),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 D=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),O=D.items,x=D.isLoading,N=D.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:h,setStockBatchUuid:S}}(U.Default),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.totalCount,m=o.setCurrentPage,p=o.setStockItemUuid;(0,i.useEffect)((function(){p(n)}),[n,p]);var A=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e){var n,r,o,a,i,c,s,u,d;return u=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){wl(e,t,n[t])}))}return e}({},e),d=null!=(d={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:K(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===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(a=null==e?void 0:e.packagingUomName)&&void 0!==a?a:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(K(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(qa,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:t}):l().createElement(l().Fragment,null),status:null!==(i=null==e?void 0:e.stockOperationStatus)&&void 0!==i?i:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(r=e.quantity)||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(o=-1*(null==e?void 0:e.quantity))||void 0===o?void 0:o.toLocaleString()," ").concat(null!==(s=null==e?void 0:e.packagingUomName)&&void 0!==s?s:""):""})?d:{},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(d)).forEach((function(e){Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(d,e))})),u}))}),[s,t]);return c?l().createElement(a.gqd,{role:"progressbar"}):null!=(null==s?void 0:s.length)?l().createElement(El,{columns:u,data:A,totalItems:d,goToPage:m,hasToolbar:!1}):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},"No transactions to display")))};function Dl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ol=function(e){var t=e.stockItemUuid,n=ro(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:"batch",header:d("batchNumber","Batch Number")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")},{key:"expires",header:d("expires","Expires")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l;return 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){Dl(e,t,n[t])}))}return e}({},e),l=null!=(l={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:K(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:null!==(a=e.quantityUoM)&&void 0!==a?a:""})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):(null==o?void 0:o.length)>0?l().createElement(El,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1}):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},d("batchInfoToDisplay","No batch information to display"))))};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}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 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}}(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 Il(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tl=function(e){var t=e.stockItemUuid,n=function(e){var t=Nl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Nl((0,i.useState)(10),2),a=o[0],l=o[1],c=Nl((0,i.useState)(null),2),s=c[0],u=c[1],d=Nl((0,i.useState)(1),2),m=d[0],p=d[1],A=Nl((0,i.useState)(),2),g=A[0],f=A[1],v=Nl((0,i.useState)(),2),_=v[0],b=v[1],h=Nl((0,i.useState)(),2),y=h[0],k=h[1],C=Nl((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,D=Ye(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid: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;return 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){Il(e,t,n[t])}))}return e}({},e),l=null!=(l={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:K(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:null!==(a=e.quantityUoM)&&void 0!==a?a:""})?l:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):(null==o?void 0:o.length)>0?l().createElement(El,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1}):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},d("quantityToDisplay","No quantity to display"))))};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}const Pl=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 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.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(Ei,{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(Sl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Ol,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(Tl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Stock Rules"),component:l().createElement(Xi,{stockItemUuid:o.uuid}),disabled:!r}];return l().createElement(Wn,{onChange:m,tabs:p,selectedIndex:u})};function Ul(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 jl=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){Ul(a,r,o,i,l,"next",e)}function l(e){Ul(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?Ve:Ke)(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,Fl(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)}}(),Fl=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(Pl,{model:e,onSave:function(e){return jl(e,t)},isEditing:t}))};const zl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Fl(ei,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var Ll=n(1048),Rl={};Rl.styleTagTransform=b(),Rl.setAttributes=g(),Rl.insert=p().bind(null,"head"),Rl.domAPI=d(),Rl.insertStyleElement=v(),s()(Ll.Z,Rl);const Ml=Ll.Z&&Ll.Z.locals?Ll.Z.locals:void 0,ql=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:Ml.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Drugs",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Other",value:"false",id:"is-drug-other"}))};function Gl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Hl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Zl=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"))},Yl=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,Fl(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function Ql(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Jl(e,t,n[t])}))}return e}function Kl(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(){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 Ql(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ql(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=function(e){(0,E.useTranslation)().t;var t=Hl((0,i.useState)(1),2),n=t[0],o=t[1],a=Hl((0,i.useState)(10),2),l=a[0],c=a[1],s=Hl((0,i.useState)(null),2),u=s[0],d=s[1],m=Hl((0,i.useState)(""),2),p=m[0],A=m[1],g=Hl((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:10,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),d=u.isLoading,m=u.items,p=u.totalCount,A=u.currentPageSize,g=u.pageSizes,f=u.currentPage,v=u.setCurrentPage,_=u.isDrug,b=u.setDrug,h=u.setSearchString,y=yr((function(e){h(e)}),1e3);(0,i.useEffect)((function(){y(c)}),[c,y]);var k=(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]),C=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var r;return Kl(Wl({},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(Yl,{data:m[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,Fl(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(mt.I8,Wl({size:16},e))}}))})}))}),[m,n]);return d?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:C,headers:k,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,u=e.getTableProps,d=e.getRowProps,m=e.getBatchActionProps;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,m()),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(ql,{filterType:_,changeFilterType:b}),l().createElement(Zl,null),l().createElement(zl,null))),l().createElement(a.iA_,u(),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,Kl(Wl({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?zn.desktopHeader:zn.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,Kl(Wl({className:r.isDesktop?zn.desktopRow:zn.tabletRow},d({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:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("div",{className:zn.tileContent},l().createElement("p",{className:zn.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:zn.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:f,pageSize:A,pageSizes:g,totalItems:p,onChange:function(e){var t=e.page;return v(t)},className:zn.paginationOverride}))},Xl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Vl,null))},$l=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function ec(e,t){(null==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 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)}function nc(){return nc=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;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]}}))})),nc.apply(this,arguments)}var rc=n(2761),oc={};oc.styleTagTransform=b(),oc.setAttributes=g(),oc.insert=p().bind(null,"head"),oc.domAPI=d(),oc.insertStyleElement=v(),s()(rc.Z,oc);const ac=rc.Z&&rc.Z.locals?rc.Z.locals:void 0;function ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function lc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){lc(e,t,n[t])}))}return e}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 ic(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ic(e,t):void 0}}(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 uc=dr.z.object({name:dr.z.string().max(255)});const dc=function(e){var t,n,o,c,s,u,d,m=e.showModal,p=e.onModalChange,A=e.handleCreateQuestion,g=e.headerTitle,f=e.initialData,v=(0,E.useTranslation)().t,_=sc((0,i.useState)(!1),2),b=_[0],h=_[1],y=sc((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,sr.cI)({mode:"all",resolver:(0,ur.F)(uc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),D=S.handleSubmit,O=S.control,x=S.getValues,N=S.formState.isDirty;return l().createElement(a.lpG,{open:m,onClose:function(){return p(!1)},preventCloseOnClickOutside:!0,size:"md"},l().createElement(a.xBx,{title:g}),l().createElement("form",{onSubmit:D((function(e){var t,n,r,o=x(),a=null!==(r=null==o||null===(n=o.tags)||void 0===n||null===(t=n.selectedItems)||void 0===t?void 0:t.map((function(e){return e.uuid})))&&void 0!==r?r:[],i={name:o.name,tags:a};uc.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(sr.Qr,{name:"name",control:O,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,cc({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:ac.loaderContainer},l().createElement(sr.Qr,{name:"tags",control:O,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=cc({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"))))))},mc=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 nc.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(dc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};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}const gc=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 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(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 ec(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ec(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(){};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(mc,{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){Ac(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:zn.tileContainer},l().createElement(a.n9L,{className:zn.tile},l().createElement("p",{className:zn.content},"No stock items to display")))},fc=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(gc,null))};var vc=n(557),_c={};_c.styleTagTransform=b(),_c.setAttributes=g(),_c.insert=p().bind(null,"head"),_c.domAPI=d(),_c.insertStyleElement=v(),s()(vc.Z,_c);const bc=vc.Z&&vc.Z.locals?vc.Z.locals:void 0;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}var yc,kc=dr.z.object({startDate:dr.z.coerce.date().refine((function(e){return void 0!==e}),{message:"Start Date is required"}),endDate:dr.z.coerce.date().refine((function(e){return void 0!==e}),{message:"End Date is required"}),location:dr.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:dr.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:dr.z.string().optional(),mostLeastMoving:dr.z.string().optional(),mostLeastMovingName:dr.z.string().optional(),stockItemUuid:dr.z.string().optional(),stockItemName:dr.z.string().optional(),patientUuid:dr.z.string().optional(),patientName:dr.z.string().optional(),locationUuid:dr.z.string().optional(),childLocations:dr.z.boolean().optional(),stockSourceUuid:dr.z.string().optional(),stockSource:dr.z.string().optional(),stockSourceDestinationUuid:dr.z.string().optional(),stockSourceDestination:dr.z.string().optional(),inventoryGroupBy:dr.z.string().optional(),inventoryGroupByName:dr.z.string().optional(),stockItemCategoryConceptUuid:dr.z.string().optional(),reportSystemName:dr.z.string().optional(),stockItemCategory:dr.z.string().optional(),maxReorderLevelRatio:dr.z.number().optional(),fullFillment:dr.z.string().array().optional(),limit:dr.z.string().optional(),date:dr.z.date().optional()});function Cc(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"}(yc||(yc={}));var Ec=function(e){return wc(e)?4:e?20:null},wc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Sc="Completed";function Dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Oc(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 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)||Ic(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 Nc(e){return function(e){if(Array.isArray(e))return Dc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ic(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 Ic(e,t){if(e){if("string"==typeof e)return Dc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dc(e,t):void 0}}const Tc=function(e){e.model;var t,n=(0,E.useTranslation)().t,o=(0,r.useConfig)().stockItemCategoryUUID,c=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}}(),s=c.reportTypes,u=c.isLoading,d=wt().stockLocations,m=Nt(o),p=m.items,A=(m.isLoading,xc((0,i.useState)(!1),2)),g=A[0],f=A[1],v=xc((0,i.useState)(!1),2),_=v[0],b=v[1],h=xc((0,i.useState)(!1),2),y=h[0],k=h[1],C=xc((0,i.useState)(!1),2),w=C[0],S=C[1],D=xc((0,i.useState)(!1),2),O=D[0],x=D[1],N=xc((0,i.useState)(!1),2),I=N[0],T=N[1],B=xc((0,i.useState)(!1),2),P=B[0],U=B[1],F=xc((0,i.useState)(!1),2),z=F[0],L=F[1],R=xc((0,i.useState)(!1),2),M=R[0],q=R[1],G=xc((0,i.useState)(!1),2),H=G[0],Z=G[1],Y=xc((0,i.useState)(!1),2),J=Y[0],W=Y[1],te=xc((0,i.useState)(!1),2),ne=te[0],re=te[1],oe=xc((0,i.useState)(!1),2),ae=oe[0],ie=oe[1],le=xc((0,i.useState)(!1),2),ce=le[0],se=le[1],ue=xc((0,i.useState)(!1),2),de=ue[0],me=ue[1],pe=xc((0,i.useState)(""),2),Ae=pe[0],ge=pe[1];(0,i.useEffect)((function(){var e=!1;if(Ae){var t,n,r,o,a,i,l,c,u,d,m,p,A,g,v,_=null==s?void 0:s.find((function(e){return e.name===Ae}));_&&(f(null===(t=_.parameters)||void 0===t?void 0:t.some((function(e){return e===yc.Date}))),b(null===(n=_.parameters)||void 0===n?void 0:n.some((function(e){return e===yc.StartDate}))),k(null===(r=_.parameters)||void 0===r?void 0:r.some((function(e){return e===yc.EndDate}))),S(null===(o=_.parameters)||void 0===o?void 0:o.some((function(e){return e===yc.StockItemCategory}))),x(null===(a=_.parameters)||void 0===a?void 0:a.some((function(e){return e===yc.Location}))),T(null===(i=_.parameters)||void 0===i?void 0:i.some((function(e){return e===yc.ChildLocations}))),U(null===(l=_.parameters)||void 0===l?void 0:l.some((function(e){return e===yc.StockSource}))),L(null===(c=_.parameters)||void 0===c?void 0:c.some((function(e){return e===yc.StockSourceDestination}))),q(null===(u=_.parameters)||void 0===u?void 0:u.some((function(e){return e===yc.InventoryGroupBy}))),Z(null===(d=_.parameters)||void 0===d?void 0:d.some((function(e){return e===yc.MaxReorderLevelRatio}))),re(null===(m=_.parameters)||void 0===m?void 0:m.some((function(e){return e===yc.StockItem}))),W(null===(p=_.parameters)||void 0===p?void 0:p.some((function(e){return e===yc.Patient}))),ie(null===(A=_.parameters)||void 0===A?void 0:A.some((function(e){return e===yc.Limit}))),se(null===(g=_.parameters)||void 0===g?void 0:g.some((function(e){return e===yc.MostLeastMoving}))),me(null===(v=_.parameters)||void 0===v?void 0:v.some((function(e){return e===yc.Fullfillment}))),e=!0)}e||(f(!1),b(!1),k(!1),S(!1),x(!1),T(!1),U(!1),L(!1),q(!1),Z(!1),re(!1),W(!1),ie(!1),se(!1),me(!1))}),[Ae,s]);var fe=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Nc(null!==(t=p&&(null==p||null===(e=p.answers)||void 0===e?void 0:e.length)>0?null==p?void 0:p.answers:null==p?void 0:p.setMembers)&&void 0!==t?t:[]))}),[p]),ve=(0,sr.cI)({mode:"all",resolver:(0,ur.F)(kc)}),_e=ve.handleSubmit,be=ve.control,he=ve.formState,ye=he.errors,ke=(he.defaultValues,he.isDirty,ve.setValue);if(u)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Ce=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){Oc(a,r,o,i,l,"next",e)}function l(e){Oc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,o,a,i,l,c,u,d,m,p,A,f,v,b,h,k,C,E,S,D,x,N,T,B,U,j,F,L,R,q,G,Z,Y,W,V,X,$,ee;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(te){switch(te.label){case 0:o=null===(t=s.find((function(t){return t.name===e.reportName})))||void 0===t?void 0:t.systemName,te.label=1;case 1:return te.trys.push([1,,3,4]),a="\r\n",i="param.report=".concat(o).concat(a),de&&(i+=Ee(yc.Fullfillment,(null!==(l=e.fullFillment)&&void 0!==l?l:["All"]).join(","),(null!==(c=e.fullFillment)&&void 0!==c?c:["All"]).join(", "),n("stockmanagement.report.edit.fullfillment"),a)),J&&(i+=Ee(yc.Patient,null!==(d=e.patientUuid)&&void 0!==d?d:"",null!==(m=null===(u=e.patientName)||void 0===u?void 0:u.trim())&&void 0!==m?m:"All Patients",n("Patients"),a)),ne&&(i+=Ee(yc.StockItem,null!==(A=e.stockItemUuid)&&void 0!==A?A:"",null!==(f=null===(p=e.stockItemName)||void 0===p?void 0:p.trim())&&void 0!==f?f:"All Stock Items",n("Stock Item"),a)),w&&(i+=Ee(yc.StockItemCategory,null!==(b=e.stockItemCategoryConceptUuid)&&void 0!==b?b:"",null!==(h=null===(v=e.stockItemCategory)||void 0===v?void 0:v.trim())&&void 0!==h?h:"All Categories",n("Stock Item Category"),a)),M&&(i+=Ee(yc.InventoryGroupBy,null!==(C=e.inventoryGroupBy)&&void 0!==C?C:"LocationStockItemBatchNo",null!==(E=null===(k=e.inventoryGroupByName)||void 0===k?void 0:k.trim())&&void 0!==E?E:"Stock Item Batch Number",n("stockmanagement.report.edit.inventorygroupby"),a)),O&&(i+=Ee(yc.Location,e.location,null!==(D=null===(S=e.location)||void 0===S?void 0:S.trim())&&void 0!==D?D:"",n("Location"),a),I&&(i+=Ee(yc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",n("Include Child Locations"),a))),H&&(i+=Ee(yc.MaxReorderLevelRatio,(null!==(x=e.maxReorderLevelRatio)&&void 0!==x?x:0).toString(),(null!==(N=e.maxReorderLevelRatio)&&void 0!==N?N:0).toString()+"%",n("stockmanagement.report.edit.maxreorderlevelratio"),a)),P&&(i+=Ee(yc.StockSource,null!==(B=e.stockSourceUuid)&&void 0!==B?B:"",null!==(U=null===(T=e.stockSource)||void 0===T?void 0:T.trim())&&void 0!==U?U:"All Sources",n("stockmanagement.report.edit.stocksource"),a)),z&&(i+=Ee(yc.StockSourceDestination,null!==(F=e.stockSourceDestinationUuid)&&void 0!==F?F:"",null!==(L=null===(j=e.stockSourceDestination)||void 0===j?void 0:j.trim())&&void 0!==L?L:"All Destinations",n("stockmanagement.report.edit.stocksourcedestination"),a)),ce&&(i+=Ee(yc.MostLeastMoving,null!==(q=e.mostLeastMoving)&&void 0!==q?q:"MostMoving",null!==(G=null===(R=e.mostLeastMovingName)||void 0===R?void 0:R.trim())&&void 0!==G?G:"Most Moving",n("stockmanagement.report.edit.mostleastmoving"),a)),ae&&(i+=Ee(yc.Limit,(null!==(Y=null!==(Z=e.limit)&&void 0!==Z?Z:Ec(e.reportSystemName))&&void 0!==Y?Y:20).toString(),(null!==(V=null!==(W=e.limit)&&void 0!==W?W:Ec(e.reportSystemName))&&void 0!==V?V:20).toString(),n(function(e){return wc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),a)),g&&(i+=Ee(yc.Date,JSON.stringify(e.date).replaceAll('"',""),null!==(X=K(e.date))&&void 0!==X?X:"",n("stockmanagement.report.edit.date"),a)),_&&(i+=Ee(yc.StartDate,JSON.stringify(e.startDate).replaceAll('"',""),null!==($=K(e.startDate))&&void 0!==$?$:"",n(function(e){return wc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),a)),y&&(i+=Ee(yc.EndDate,JSON.stringify(e.endDate).replaceAll('"',""),null!==(ee=K(e.endDate))&&void 0!==ee?ee:"",n(function(e){return wc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),a)),[4,Cc({batchJobType:"Report",description:e.reportName,parameters:i}).then((function(e){Q(),201===e.status?(0,r.showSnackbar)({title:n("batchJob","Batch Job"),subtitle:n("BatchJobSuccess","Batch job created successfully"),kind:"success"}):(0,r.showSnackbar)({title:n("BatchJobErrorTitle","Batch job"),subtitle:n("batchJobErrorMessage","Error creating batch job"),kind:"error"})})).catch((function(e){(0,r.showSnackbar)({title:n("BatchJobErrorTitle","Batch job"),subtitle:n("batchJobErrorMessage","Error creating batch job"),kind:"error"})}))];case 2:return te.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),Ee=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:_e(Ce,(function(e){console.error(e)}))},l().createElement("div",{className:bc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,n("reportName","Report")),l().createElement(sr.Qr,{control:be,name:"reportName",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"report",size:"md",labelText:n("reportName","Report"),items:s,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,ge(n)}})}})),w&&l().createElement(l().Fragment,null,l().createElement("span",null,n("stockItemCategory","Stock Item Category")),l().createElement(sr.Qr,{control:be,name:"stockReportItemCategory",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"stockReportItem",size:"md",labelText:n("stockItemCategory","Stock Item Category"),items:fe,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..."})}})),_&&l().createElement(sr.Qr,{control:be,name:"startDate",render:function(e){var t,r,o=e.field,i=o.onChange,c=o.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:i,value:c},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:V,labelText:n("startDate","Start Date"),defaultValue:"",invalid:null==ye||null===(t=ye.startDate)||void 0===t?void 0:t.message,invalidText:null==ye||null===(r=ye.startDate)||void 0===r?void 0:r.message}))}}),y&&l().createElement(sr.Qr,{control:be,name:"endDate",render:function(e){var t,r,o=e.field,i=o.onChange,c=o.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:i,value:c},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:V,labelText:n("endDate","End Date"),defaultValue:"",invalid:null==ye||null===(t=ye.endDate)||void 0===t?void 0:t.message,invalidText:null==ye||null===(r=ye.endDate)||void 0===r?void 0:r.message}))}}),O&&l().createElement(a.PhF,{name:"location",className:"select-field",labelText:n("location","Location"),id:"location",onChange:function(e){return ke("location",e.target.value)},defaultValue:""},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:n("Choose a location")}),null===(t=null!=d?d:[])||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})}))),I&&l().createElement(sr.Qr,{control:be,name:"childLocations",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(a.XZJ,{id:"childLocations",onChange:r,value:o,labelText:n("IncludeChildLocations","Include Child Locations")})}}),ce&&l().createElement(sr.Qr,{control:be,name:"mostLeastMoving",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(a.SYO,{name:"mostLeastMoving",legendText:n("rank","Rank"),onChange:r,value:o},l().createElement(a.EUY,{value:"MostMoving",id:"mostLeastMovingMost",labelText:n("mostMoving","Most Moving")}),l().createElement(a.EUY,{value:"LeastMoving",id:"mostLeastMovingLeast",labelText:n("LeastMoving","Least Moving")}))}}),ae&&l().createElement(sr.Qr,{control:be,name:"limit",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(a.Y2U,{id:"limitTop",allowEmpty:!0,value:o,onchange:r,label:n("limit","Limit"),defaultValue:20})}}),de&&l().createElement("div",{style:{display:"flex",flexDirection:"row",gap:"0 1rem"}},l().createElement(sr.Qr,{control:be,name:"fullFillment",render:function(e){var t=e.field,r=t.onChange,o=t.value;return l().createElement(l().Fragment,null,l().createElement(a.XZJ,{id:"allFulfillment",checked:null==o?void 0:o.includes("All"),onChange:function(e){var t=e.target.checked;r(t?["All"]:o.filter((function(e){return"All"!==e})))},labelText:n("all","All")}),l().createElement(a.XZJ,{id:"fullFulfillment",checked:null==o?void 0:o.includes("Full"),onChange:function(e){var t=e.target.checked;r(t?Nc(o.filter((function(e){return"All"!==e}))).concat(["Full"]):o.filter((function(e){return"Full"!==e})))},labelText:n("fullFulfillment","Full Fulfillment")}),l().createElement(a.XZJ,{id:"partialFulfillment",checked:null==o?void 0:o.includes("Partial"),onChange:function(e){var t=e.target.checked;r(t?Nc(o.filter((function(e){return"All"!==e}))).concat(["Partial"]):o.filter((function(e){return"Partial"!==e})))},labelText:n("partialFulfillment","Partial Fulfillment")}),l().createElement(a.XZJ,{id:"noneFulfillment",checked:null==o?void 0:o.includes("None"),onChange:function(e){var t=e.target.checked;r(t?Nc(o.filter((function(e){return"All"!==e}))).concat(["None"]):o.filter((function(e){return"None"!==e})))},labelText:n("noneFulfillment","Non Fulfillment")}))}}))),l().createElement("div",{className:bc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Q},n("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},n("continue","Continue"))))},Bc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("New Report",l().createElement(Tc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var Pc=n(5861),Uc={};Uc.styleTagTransform=b(),Uc.setAttributes=g(),Uc.insert=p().bind(null,"head"),Uc.domAPI=d(),Uc.insertStyleElement=v(),s()(Pc.Z,Uc);const jc=Pc.Z&&Pc.Z.locals?Pc.Z.locals:void 0;var Fc=n(6811),zc=n(3570);function Lc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Lc(e,t,n[t])}))}return e}function Mc(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 qc=function(){var e=(0,E.useTranslation)().t,t=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 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}}(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}}(),n=t.reports,o=t.isLoading,c=t.currentPage,s=t.pageSizes,u=t.totalItems,d=t.goTo,m=t.currentPageSize,p=t.setPageSize,A=(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"}]}),[]),g=(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")}),[]),f=(0,i.useMemo)((function(){return null==n?void 0:n.map((function(e,t){var n,r,o;return Mc(Rc({},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(Fc.mg,{className:"report-cancelled",title:e.status}),e.status===Sc&&l().createElement(To.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(zc.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:Zt.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)===Sc&&(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 g(e.uuid,e.outputArtifactFileExt)}}))})}))}),[n,g]);return o?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:jc.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:f,headers:A,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,o=t.headers,i=t.getHeaderProps,c=t.getTableProps,s=t.getRowProps,u=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:jc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement(Bc,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,Mc(Rc({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?jc.desktopHeader:jc.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,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Rc({className:r.isDesktop?jc.desktopRow:jc.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===n.length?l().createElement("div",{className:jc.tileContainer},l().createElement(a.n9L,{className:jc.tile},l().createElement("div",{className:jc.tileContent},l().createElement("p",{className:jc.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:jc.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:c,pageSize:m,pageSizes:s,totalItems:u,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&p(t),n!==c&&d(n)},className:jc.paginationOverride}))};var Gc="@openmrs/esm-stock-management-app",Hc={featureName:"stock-management",moduleName:Gc},Zc=n(3979),Yc=(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}))))}),Hc),Qc=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),Hc),Jc=(0,r.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Pe.BrowserRouter,{basename:e},l().createElement("div",{className:De.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(Xl,null)}),l().createElement(Pe.Route,{path:"stock-operations",element:l().createElement($a,null)}),l().createElement(Pe.Route,{path:"stock-user-scopes",element:l().createElement($t,null)}),l().createElement(Pe.Route,{path:"stock-sources",element:l().createElement(Bn,null)}),l().createElement(Pe.Route,{path:"stock-locations",element:l().createElement(fc,null)}),l().createElement(Pe.Route,{path:"stock-reports",element:l().createElement(qc,null)}),l().createElement(Pe.Route,{path:"stock-settings",element:l().createElement($l,null)}))),l().createElement(Ee,null)))}),Hc),Wc=(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")))))}),Hc),Kc=(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:Gc}),Vc=(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:Gc}),Xc=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=O((0,i.useState)(),2),c=o[0],s=o[1],u=O((0,i.useState)(!0),2),d=u[0],m=(u[1],O((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")))))}),Hc),$c=(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"))}),Hc);function es(){(0,r.defineConfigSchema)(Gc,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}}]);
|