@openmrs/esm-stock-management-app 1.0.1-pre.342 → 1.0.1-pre.345
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/220.js +1 -1
- package/dist/220.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +6 -6
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/core/components/table/table.scss +1 -1
- package/src/root.component.tsx +0 -5
- package/src/root.scss +41 -112
- package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.scss +1 -1
- package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +1 -1
- package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +1 -1
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss +1 -1
- package/src/stock-sources/add-stock-sources/add-stock-sources.scss +1 -1
- package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +4 -1
package/dist/220.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[220],{3432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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}section{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,QACE,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",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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__root__productiveHeading01___qz04k{font-size:.875rem;font-weight:600;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__root__productiveHeading02___P86oI{font-size:1rem;font-weight:600;line-height:1.375;letter-spacing:0}.-esm-stock-management__root__productiveHeading03___ad2Jr{font-size:1.25rem;font-weight:400;line-height:1.4;letter-spacing:0}.-esm-stock-management__root__productiveHeading04____lfRk{font-size:1.75rem;font-weight:400;line-height:1.29;letter-spacing:0}.-esm-stock-management__root__productiveHeading05___BiHXj{font-size:2rem;font-weight:400;line-height:1.25;letter-spacing:0}.-esm-stock-management__root__productiveHeading06___fCUbs{font-size:2rem;font-weight:300;line-height:1.199;letter-spacing:0}.-esm-stock-management__root__bodyShort01___qFZKo{font-size:.875rem;font-weight:400;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__root__helperText01___l9eBE{font-size:.75rem;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__root__bodyShort02___e318z{font-size:1rem;font-weight:400;line-height:1.375;letter-spacing:0}.-esm-stock-management__root__bodyLong01___hajrO{font-size:.875rem;font-weight:400;line-height:1.43;letter-spacing:.16px}.-esm-stock-management__root__bodyLong02___rbPh9{font-size:1rem;font-weight:400;line-height:1.5;letter-spacing:0}.-esm-stock-management__root__label01___B9Vra{font-size:.75rem;font-weight:400;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__root__text01___hIiid{color:#161616}.-esm-stock-management__root__text02___HK43C{color:#525252}aside{background-color:#fff !important}div[class*=-esm-login__styles__center]>img{width:140px}.tab-12rem>button{width:12rem !important}.tab-14rem>button{width:14rem !important}.tab-16rem>button{width:16rem !important}.bx--overflow-menu>div{width:15rem !important}nav .bx--accordion__title{color:#525252;font-weight:600 !important}nav .bx--accordion__content{padding-bottom:0 !important;padding-top:0 !important}nav .bx--accordion__content>a{background-color:#cecece !important;color:#161616 !important;border-left-color:var(--brand-01) !important}.-esm-stock-management__root__container___Rf8rX{padding:2rem}.-esm-stock-management__root__welcome___z11zb{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);margin:1rem 0}.-esm-stock-management__root__explainer___Iuxmg{margin-bottom:2rem}.-esm-stock-management__root__noMargin___d3uMR{margin:0 !important}.-esm-stock-management__root__noPadding___k8nyn{margin:0 !important}.-esm-stock-management__root__noSpacing___IWb3Y{margin:0 !important;padding:0 !important}.-esm-stock-management__root__section___U2CGA{margin:.5rem}.cds--table-sort__description{display:none}.-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-components/scss/globals/scss/vendor/@carbon/elements/scss/type/_styles.import.scss","webpack://./node_modules/carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/generated/_mixins.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,CCjCF,0DC0iBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDhuB1B,0DCsiBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD5tB1B,0DCkiBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDxtB1B,0DC8hBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CDptB1B,0DC0hBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CDhtB1B,0DCshBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD5sB1B,kDCkhBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDxsB1B,mDC8gBI,gBA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDpsB1B,kDC0gBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CDhsB1B,iDCsgBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CD5rB1B,iDCkgBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDxrB1B,8CC8fI,gBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDprB1B,6CACI,aErBQ,CFwBZ,6CACI,aDtEM,CCyEV,MACI,gCAAA,CAIJ,2CACI,WAAA,CAGJ,kBACI,sBAAA,CAGJ,kBACI,sBAAA,CAGJ,kBACI,sBAAA,CAGJ,uBACI,sBAAA,CAGJ,0BACI,aAAA,CACA,0BAAA,CAGJ,4BACI,2BAAA,CACA,wBAAA,CAGJ,8BACI,mCAAA,CACA,wBAAA,CACA,4CAAA,CAGJ,gDACI,YG/ES,CHkFb,8CIuuBI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CJruBA,aAAA,CAGJ,gDACI,kBAAA,CAGJ,+CACI,mBAAA,CAGJ,gDACI,mBAAA,CAGJ,gDACI,mBAAA,CACA,oBAAA,CAGJ,8CACI,YG7HS,CHgIb,8BACI,YAAA,CAGJ,oDACI,qCAAA,CACA,eAAA,CACA,cAAA,CAGJ,mDACI,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CACC,mEACG,oBAAA,CAEH,+DACG,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",text01:"-esm-stock-management__root__text01___hIiid",text02:"-esm-stock-management__root__text02___HK43C",container:"-esm-stock-management__root__container___Rf8rX",welcome:"-esm-stock-management__root__welcome___z11zb",explainer:"-esm-stock-management__root__explainer___Iuxmg",noMargin:"-esm-stock-management__root__noMargin___d3uMR",noPadding:"-esm-stock-management__root__noPadding___k8nyn",noSpacing:"-esm-stock-management__root__noSpacing___IWb3Y",section:"-esm-stock-management__root__section___U2CGA",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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}section{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,QACE,YCgBW,CDbb,8DE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,2DACE,mBCgBW",sourceRoot:""}]),i.locals={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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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:.875rem;font-weight:600;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__stock-items-table__productiveHeading02___E1KiC{font-size:1rem;font-weight:600;line-height:1.375;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading03___N33sp{font-size:1.25rem;font-weight:400;line-height:1.4;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading04___lh7n8{font-size:1.75rem;font-weight:400;line-height:1.29;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading05___ieA0n{font-size:2rem;font-weight:400;line-height:1.25;letter-spacing:0}.-esm-stock-management__stock-items-table__productiveHeading06___JPMyX{font-size:2rem;font-weight:300;line-height:1.199;letter-spacing:0}.-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK{font-size:.875rem;font-weight:400;line-height:1.29;letter-spacing:.16px}.-esm-stock-management__stock-items-table__helperText01___uOks4{font-size:.75rem;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__stock-items-table__bodyShort02___d7A67{font-size:1rem;font-weight:400;line-height:1.375;letter-spacing:0}.-esm-stock-management__stock-items-table__bodyLong01____Gl3H{font-size:.875rem;font-weight:400;line-height:1.43;letter-spacing:.16px}.-esm-stock-management__stock-items-table__bodyLong02___Dwoe9{font-size:1rem;font-weight:400;line-height:1.5;letter-spacing:0}.-esm-stock-management__stock-items-table__label01___ANQCM{font-size:.75rem;font-weight:400;line-height:1.34;letter-spacing:.32px}.-esm-stock-management__stock-items-table__text01___ZPeOt{color:#161616}.-esm-stock-management__stock-items-table__text02___ac1IL{color:#525252}aside{background-color:#fff !important}div[class*=-esm-login__styles__center]>img{width:140px}.tab-12rem>button{width:12rem !important}.tab-14rem>button{width:14rem !important}.tab-16rem>button{width:16rem !important}.bx--overflow-menu>div{width:15rem !important}nav .bx--accordion__title{color:#525252;font-weight:600 !important}nav .bx--accordion__content{padding-bottom:0 !important;padding-top:0 !important}nav .bx--accordion__content>a{background-color:#cecece !important;color:#161616 !important;border-left-color:var(--brand-01) !important}.-esm-stock-management__stock-items-table__container___VONiZ{padding:2rem}.-esm-stock-management__stock-items-table__welcome___WGa3N{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);margin:1rem 0}.-esm-stock-management__stock-items-table__explainer___DhGUo{margin-bottom:2rem}.-esm-stock-management__stock-items-table__noMargin___KC8ym{margin:0 !important}.-esm-stock-management__stock-items-table__noPadding___N1WX1{margin:0 !important}.-esm-stock-management__stock-items-table__noSpacing___Df9tM{margin:0 !important;padding:0 !important}.-esm-stock-management__stock-items-table__section___EQIFK{margin:.5rem}.cds--table-sort__description{display:none}.-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-components/scss/globals/scss/vendor/@carbon/elements/scss/type/_styles.import.scss","webpack://./node_modules/carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/generated/_mixins.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.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,CCjCF,uEC0iBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDhuB1B,uECsiBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD5tB1B,uECkiBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDxtB1B,uEC8hBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CDptB1B,uEC0hBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,gBA0LsB,CDhtB1B,uECshBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CD5sB1B,+DCkhBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDxsB1B,gEC8gBI,gBA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDpsB1B,+DC0gBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,iBA0LsB,CA1LtB,gBA0LsB,CDhsB1B,8DCsgBI,iBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CD5rB1B,8DCkgBI,cA0LsB,CA1LtB,eA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CDxrB1B,2DC8fI,gBA0LsB,CA1LtB,eA0LsB,CA1LtB,gBA0LsB,CA1LtB,oBA0LsB,CDprB1B,0DACI,aErBQ,CFwBZ,0DACI,aDtEM,CCyEV,MACI,gCAAA,CAIJ,2CACI,WAAA,CAGJ,kBACI,sBAAA,CAGJ,kBACI,sBAAA,CAGJ,kBACI,sBAAA,CAGJ,uBACI,sBAAA,CAGJ,0BACI,aAAA,CACA,0BAAA,CAGJ,4BACI,2BAAA,CACA,wBAAA,CAGJ,8BACI,mCAAA,CACA,wBAAA,CACA,4CAAA,CAGJ,6DACI,YG/ES,CHkFb,2DIuuBI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CJruBA,aAAA,CAGJ,6DACI,kBAAA,CAGJ,4DACI,mBAAA,CAGJ,6DACI,mBAAA,CAGJ,6DACI,mBAAA,CACA,oBAAA,CAGJ,2DACI,YG7HS,CHgIb,8BACI,YAAA,CAGJ,iEACI,qCAAA,CACA,eAAA,CACA,cAAA,CAGJ,gEACI,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CACC,gFACG,oBAAA,CAEH,4EACG,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CK5KR,sEACI,qBLMY,CKLZ,YFyBS,CExBT,gBAAA,CAGF,iEACE,qBLHI,CKIJ,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEF,2DDw0BE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CCt0BA,aNvBM,CMwBN,mBAAA,CAGF,0DDk0BE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CCh0BA,aN7BM,CMgCR,6DD6zBE,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CC3zBA,aNlCM,CMmCN,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBNzCI,CM0CJ,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",text01:"-esm-stock-management__stock-items-table__text01___ZPeOt",text02:"-esm-stock-management__stock-items-table__text02___ac1IL",container:"-esm-stock-management__stock-items-table__container___VONiZ",welcome:"-esm-stock-management__stock-items-table__welcome___WGa3N",explainer:"-esm-stock-management__stock-items-table__explainer___DhGUo",noMargin:"-esm-stock-management__stock-items-table__noMargin___KC8ym",noPadding:"-esm-stock-management__stock-items-table__noPadding___N1WX1",noSpacing:"-esm-stock-management__stock-items-table__noSpacing___Df9tM",section:"-esm-stock-management__stock-items-table__section___EQIFK",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},965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,"section{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,QACE,YCiBW,CDdb,sEACE,oBCkBW,CDfb,mEACE,mBCmBW",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp",modalBody:"-esm-stock-management__stock-operations-dialog__modalBody___xG3z2"};const l=i},8098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}section{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,QACE,YCgBW,CDbb,gEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,6DACE,mBCgBW",sourceRoot:""}]),i.locals={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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}section{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,QACE,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,CAEF,8DACE,qBAAA,CAEF,kEACE,UAAA,CAEF,oEACE,UAAA",sourceRoot:""}]),i.locals={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 o=n(7537),r=n.n(o),a=n(3645),i=n.n(a)()(r());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},3880:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deleteStockModal:()=>ls,deleteUserScopeModal:()=>ss,importBulkStockItemsDialog:()=>cs,importTranslation:()=>ns,startupApp:()=>ds,stockManagement:()=>rs,stockManagementAdminCardLink:()=>os,stockManagementAppMenuItem:()=>us,stockManagementDashboard:()=>as,stockOperationDialog:()=>is});var o=n(7248),r={printItemCost:{type:o.Type.Boolean,_default:!1,_description:"Whether to print item costs on the print out"},printBalanceOnHand:{type:o.Type.Boolean,_default:!1,_description:"Whether to print balance on hand on the print out"},packagingUnitsUUID:{_type:o.Type.ConceptUuid,_description:"UUID for the packaging unit",_default:"bce2b1af-98b1-48a2-98a2-3e4ffb3c79c2"},stockAdjustmentReasonUUID:{_type:o.Type.ConceptUuid,_description:"UUID for the stock adjustment reasons",_default:"3bbfaa44-d5b8-404d-b4c1-2bf49ad8ce25"},stockSourceTypeUUID:{_type:o.Type.ConceptUuid,_description:"UUID for the stock source types",_default:"2e1e8049-9cbe-4a2d-b1e5-8a91e5d7d97d"},dispensingUnitsUUID:{_type:o.Type.ConceptUuid,_description:"UUID for the stock dispensing units uuid",_default:"162402AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},stockItemCategoryUUID:{_type:o.Type.ConceptUuid,_description:"UUID for the stock item category",_default:"6d24eb6e-b42f-4706-ab2d-ae4472161f6a"}},a=n(1009),i=n(1672),l=n.n(i),s=n(7410),c=n.n(s),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),_=n(2434),f=n.n(_),v=n(1422),b=n.n(v),h=n(7813),y={};y.styleTagTransform=b(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=f(),c()(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,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function S(){var e;return e=function(e){var t;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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,o.openmrsFetch)("".concat(o.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){w(a,o,r,i,l,"next",e)}function l(e){w(a,o,r,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(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),D={};D.styleTagTransform=b(),D.setAttributes=g(),D.insert=p().bind(null,"head"),D.domAPI=d(),D.insertStyleElement=f(),c()(x.Z,D);const N=x.Z&&x.Z.locals?x.Z.locals:void 0;var I=n(1256),T={};T.styleTagTransform=b(),T.setAttributes=g(),T.insert=p().bind(null,"head"),T.domAPI=d(),T.insertStyleElement=f(),c()(I.Z,T);const P=I.Z&&I.Z.locals?I.Z.locals:void 0;var U,j=n(9820);function L(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var o=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var o=e[t];return n&&(!1===o||!0===o||o)||!n&&(""===o||!1===o||!0===o||o)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(o.toString())):null})).filter((function(e){return null!=e})).join("&");return o.length>0?"?"+o:""}function F(e){var t="ws/rest/v1/stockmanagement/stockoperation".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function z(e){var t="ws/rest/v1/stockmanagement/stockoperation/".concat(e,"?v=full");return(0,o.openmrsFetch)(t)}function R(e){var t=new AbortController;return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperation",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}function M(e){var t="ws/rest/v1/stockmanagement/stockoperation/".concat(e.uuid),n=new AbortController;return(0,o.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,o=new Array(t);n<t;n++)o[n]=e[n];return o}var H={isOverlayOpen:!1,component:Function,header:""},Z=function(){return(0,o.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",oe="Ministry of Health",re="Main Store",ae="/openmrs/",ie=!0;function le(e){var t,n,o,r,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===(r=e.responseBody)||void 0===r||null===(o=r.error)||void 0===o?void 0:o.message)&&void 0!==a?a:null==e?void 0:e.message]}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ce(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function ue(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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.")}()}"".concat(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var de=n(965),me={};me.styleTagTransform=b(),me.setAttributes=g(),me.insert=p().bind(null,"head"),me.domAPI=d(),me.insertStyleElement=f(),c()(de.Z,me);const pe=de.Z&&de.Z.locals?de.Z.locals:void 0,Ae=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 ge=n(9375),_e=n(2411),fe=function(){var e,t=(0,E.useTranslation)().t,n=(0,o.useSession)(),r=null==n||null===(e=n.sessionLocation)||void 0===e?void 0:e.display;return l().createElement("div",{className:pe.header},l().createElement("div",{className:pe["left-justified-items"]},l().createElement(Ae,null),l().createElement("div",{className:pe["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:pe["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:pe["right-justified-items"]},l().createElement("div",{className:pe["date-and-location"]},l().createElement(ge.Ye,{size:16}),l().createElement("span",{className:pe.value},r),l().createElement("span",{className:pe.middot},"·"),l().createElement(_e.f,{size:16}),l().createElement("span",{className:pe.value},(0,o.formatDate)(new Date,{mode:"standard"})))))},ve=n(6194),be=n(8115),he=n(2296),ye={};ye.styleTagTransform=b(),ye.setAttributes=g(),ye.insert=p().bind(null,"head"),ye.domAPI=d(),ye.insertStyleElement=f(),c()(he.Z,ye);const ke=he.Z&&he.Z.locals?he.Z.locals:void 0,Ce=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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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.")}()),o=n[0],r=n[1];return(0,i.useEffect)((function(){var e=function(e){r(e)};e(Z().getState()),Z().subscribe(e)}),[]),{isOverlayOpen:null==o?void 0:o.isOverlayOpen,component:null==o?void 0:o.component,header:null==o?void 0:o.header}}(),t=e.header,n=e.component,r=e.isOverlayOpen,s=(0,o.useLayoutType)(),c=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,r&&l().createElement("div",{className:"tablet"!==s?ke.desktopOverlay:ke.tabletOverlay},"tablet"!==s?l().createElement("div",{className:ke.desktopHeader},l().createElement("div",{className:ke.headerContent},t),l().createElement(a.zxk,{className:ke.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(ve.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":c("tabletOverlay","Tablet overlay"),className:ke.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(be.Xd,{size:16})),l().createElement("div",{className:ke.headerContent},t)),l().createElement("div",null,n)))};var Ee=n(6919),we={};we.styleTagTransform=b(),we.setAttributes=g(),we.insert=p().bind(null,"head"),we.domAPI=d(),we.insertStyleElement=f(),c()(Ee.Z,we);const Se=Ee.Z&&Ee.Z.locals?Ee.Z.locals:void 0;var Be=n(1940),Oe={};Oe.styleTagTransform=b(),Oe.setAttributes=g(),Oe.insert=p().bind(null,"head"),Oe.domAPI=d(),Oe.insertStyleElement=f(),c()(Be.Z,Oe);const xe=Be.Z&&Be.Z.locals?Be.Z.locals:void 0,De=function(e){var t=e.tabs,n=e.selectedIndex,r=e.onSelectTab;return l().createElement("div",{className:"\n ".concat(xe.cohortBuilder,"\n ")},l().createElement("div",{className:xe.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,o.navigate)({to:"/openmrs/admin/maintenance/settings.list?show=Stockmanagement"}):(r(i),(0,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/").concat(e.link)}))}},e.name)}))))))};function Ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Ie=function(){var e,t,n=(0,E.useTranslation)().t,o=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ne(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=o[0],a=o[1],s=[{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("stockManagementSettings","Stock Settings"),link:"admin/maintenance/settings.list?show=Stockmanagement"}];return l().createElement(De,{tabs:s,selectedIndex:r,onSelectTab:a})};var Te=n(1914),Pe=n(2426),Ue={};Ue.styleTagTransform=b(),Ue.setAttributes=g(),Ue.insert=p().bind(null,"head"),Ue.domAPI=d(),Ue.insertStyleElement=f(),c()(Pe.Z,Ue);const je=Pe.Z&&Pe.Z.locals?Pe.Z.locals:void 0;var Le=n(3432),Fe={};Fe.styleTagTransform=b(),Fe.setAttributes=g(),Fe.insert=p().bind(null,"head"),Fe.domAPI=d(),Fe.insertStyleElement=f(),c()(Le.Z,Fe);const ze=Le.Z&&Le.Z.locals?Le.Z.locals:void 0;var Re=n(9697),Me=n(7412),qe=n.n(Me);W().extend(qe());const Ge=function(e){var t,n,r,i,s,c,u=e.label,d=e.value,m=e.headerLabel,p=e.children,A=e.view,g=e.count,_=e.outofstockCount,f=e.disposedCount,v=(0,E.useTranslation)().t;return l().createElement(a.n9L,{className:ze.tileContainer},l().createElement("div",{className:ze.tileHeader},l().createElement("div",{className:ze.headerLabelContainer},l().createElement("label",{className:ze.headerLabel},m),p),A&&l().createElement(o.ConfigurableLink,{className:ze.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(be.ol,{size:16,className:ze.viewListBtn}))),l().createElement("div",{className:ze.metricsGrid},l().createElement("div",null,l().createElement("label",{className:ze.totalsLabel},u),l().createElement("p",{className:ze.totalsValue},d)),!(0,Re.Z)(g)&&l().createElement("div",{className:ze.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("in7days","In 7 days")),l().createElement("span",{style:{color:" #FABA5F"}},v("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,Re.Z)(_)&&l().createElement("div",{className:ze.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},v("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(r=_.itemsbelowmin)||void 0===r?void 0:r.length),l().createElement("p",{style:{color:"#319227"}},null===(i=_.itemsabovemax)||void 0===i?void 0:i.length)),!(0,Re.Z)(f)&&l().createElement("div",{className:ze.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},v("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(s=f.expired)||void 0===s?void 0:s.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(c=f.poorquality)||void 0===c?void 0:c.length))))};function He(e){var t="ws/rest/v1/stockmanagement/stockitem".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Ze(e){var t="ws/rest/v1/stockmanagement/stockiteminventory".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Ye(e){var t="ws/rest/v1/stockmanagement/stockbatch".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Qe(e){var t="ws/rest/v1/stockmanagement/stockitempackaginguom".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function Je(e){var t="ws/rest/v1/stockmanagement/stockitem/".concat(e,"?v=full"),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{item:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function We(e){var t=new AbortController;return delete e.isDrug,(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockitem",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}function Ke(e){var t="ws/rest/v1/stockmanagement/stockitem/".concat(e.uuid),n=new AbortController;return delete e.isDrug,delete e.dateCreated,(0,o.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Xe(e){var t,n,o,r=(n=(0,i.useState)({v:e||U.Default,q:null,totalCount:!0}),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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(n,o)||function(e,t){if(e){if("string"==typeof e)return Ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(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.")}()),a=r[0],l=r[1],s=He(a),c=s.items,u=s.isLoading,d=s.isError;return(0,i.useEffect)((function(){l({v:U.Default,totalCount:!0})}),[]),{items:null!==(t=null==c?void 0:c.results)&&void 0!==t?t:[],isLoading:u,isError:d}}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function et(){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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$e(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=n[0],r=n[1];(0,i.useEffect)((function(){r({v:U.Default,includeStockItemName:"true"})}),[]);var a,l=Ye(o),s=l.items,c=l.isLoading,u=l.isError;return{items:null!==(a=s.results)&&void 0!==a?a:[],isLoading:c,isError:u}}function tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const nt=function(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(o.restBaseUrl,"/stockmanagement/stockitem"),t=(0,j.ZP)(e,o.openmrsFetch),n=t.data,r=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&&!r,error:r}}(),r=n.stockList,i=n.isLoading,s=n.error,c=et(),u=c.items,d=(c.isLoading,Xe().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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){tt(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),o=Math.ceil((n-m)/864e5);return o<=t||o<0})),g=function(e){var t,n=F(e),o=n.items,r=n.isLoading,a=n.isError,i=null==o||null===(t=o.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:r,isError:a}}({v:U.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(s)return l().createElement(o.ErrorState,{headerTitle:t("errorStockMetric"),error:s});var _=r.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=7})),f=r.filter((function(e){return e.hasExpiration&&e.ExpiryNotice<=30})),v=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:je.cardContainer},l().createElement(Ge,{label:t("stocks","Expiring stock"),value:(null==A?void 0:A.length)||0,headerLabel:t("expiringStock","Expiring Stock"),view:"items",count:{expiry7days:_,expiry30days:f}}),l().createElement(Ge,{label:t("outofstock","Out of Stock"),value:null==r?void 0:r.length,headerLabel:t("highestServiceVolume","Out of Stock "),view:"items",outofstockCount:{itemsbelowmin:_,itemsabovemax:f}}),l().createElement(Ge,{label:t("disposedstock","Disposed Stock"),value:(null==g?void 0:g.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:v,poorquality:b}})))};var ot=n(8629),rt={};rt.styleTagTransform=b(),rt.setAttributes=g(),rt.insert=p().bind(null,"head"),rt.domAPI=d(),rt.insertStyleElement=f(),c()(ot.Z,rt);const at=ot.Z&&ot.Z.locals?ot.Z.locals:void 0;var it=n(4797);function lt(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,o.useLayoutType)(),et()),n=t.items,r=(t.isLoading,Xe()),i=r.items;if(r.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:at.content},e("inventoryAlertNull","No inventory alerts to display")));var s=new Date,c=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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){lt(e,t,n[t])}))}return e}({},e,t)}));c=c.filter((function(e){return e.hasExpiration}));var u=c.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),o=Math.ceil((n-s)/864e5);return o<=t||o<0}));return l().createElement(l().Fragment,null,u.map((function(e,t){return l().createElement("div",{className:at.card,key:t},l().createElement("div",{className:at.colorLineRed}),l().createElement("div",{className:at.icon},l().createElement(it.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:at.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,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/expired-stock")})},kind:"ghost"},"View All"))};var ct=n(8748);const ut=function(){var e=(0,E.useTranslation)().t,t=((0,o.useLayoutType)(),function(e){var t,n=F(e),o=n.items,r=n.isLoading,a=n.isError,i=null==o||null===(t=o.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:r,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:at.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:at.card,key:t},l().createElement("div",{className:at.colorLineBlue}),l().createElement("div",{className:at.icon},l().createElement(ct.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:at.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,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/orders")})},kind:"ghost"},e("receivedView","View All")))};var dt=n(2327);const mt=function(){var e=(0,E.useTranslation)().t,t=((0,o.useLayoutType)(),function(e){var t,n=F(e),o=n.items,r=n.isLoading,a=n.isError,i=null==o||null===(t=o.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:r,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:at.content},e("issuingNull","No issued to display")));var r=null==n?void 0:n.map((function(e,t){return((null==e?void 0:e.stockOperationItems)||[]).map((function(n,o){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(o)}}))})),i=null==r?void 0:r.flat().slice(0,10);return l().createElement(l().Fragment,null,null==i?void 0:i.map((function(e,t){return l().createElement("div",{className:at.card,key:t},l().createElement("div",{className:at.colorLineGreen}),l().createElement("div",{className:at.icon},l().createElement(dt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:at.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,o.navigate)({to:"".concat(window.getOpenmrsSpaBase(),"stock-management/requisitions")})},kind:"ghost"},"View All"))},pt=function(){var e="tablet"===(0,o.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:at.cardContainer},l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(st,null)))),l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(ut,null)))),l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(mt,null)))))};function At(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(nt,null),l().createElement(pt,null))}var gt=n(5104),_t={};_t.styleTagTransform=b(),_t.setAttributes=g(),_t.insert=p().bind(null,"head"),_t.domAPI=d(),_t.insertStyleElement=f(),c()(gt.Z,_t);const ft=gt.Z&>.Z.locals?gt.Z.locals:void 0;function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function bt(e){var t,n,r=function(e){var t="ws/rest/v1/stockmanagement/userrolescope".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(e),a=r.items,l=r.isLoading,s=r.isError,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.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:s,setPageSize:d}}var ht=n(4300),yt={};yt.styleTagTransform=b(),yt.setAttributes=g(),yt.insert=p().bind(null,"head"),yt.domAPI=d(),yt.insertStyleElement=f(),c()(ht.Z,yt);const kt=ht.Z&&ht.Z.locals?ht.Z.locals:void 0;var Ct=n(9337);function Et(e){var t="ws/rest/v1/location".concat(L(e,!1)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{locations:(null==r?void 0:r.data)||{},isErrorLocation:a,isLoadingLocations:i}}function wt(e){var t="ws/rest/v1/role".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function St(){var e=(0,j.ZP)("ws/rest/v1/stockmanagement/stockoperationtype?v=default",o.openmrsFetch),t=e.data,n=e.isLoading,r=e.error;return{types:(null==t?void 0:t.data)||{},isLoading:n,isError:r}}function Bt(){return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperationtype?v=default")}function Ot(e){var t="ws/rest/v1/user".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function xt(e){var t="ws/rest/v1/concept/".concat(e),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}var Dt=n(8891),Nt=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function It(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Tt(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Lt(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||zt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ft(e){return function(e){if(Array.isArray(e))return It(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||zt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zt(e,t){if(e){if("string"==typeof e)return It(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?It(e,t):void 0}}var Rt=ee();const Mt=function(e){var t,n,r,s,c,u,d=e.model,m=(0,E.useTranslation)().t,p=Lt((0,i.useState)(Ut({},d)),2),A=p[0],g=p[1],_=Lt((0,i.useState)([]),2),f=_[0],v=_[1],b=function(e){var t="ws/rest/v1/user".concat(e),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{data:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(null==d?void 0:d.uuid),h=b.data,y=St(),k=y.types.results,C=y.isLoading,w=Ot({v:U.Default}),S=w.items,B=w.isLoading,O=wt({v:U.Default}),x=(O.items,O.isLoading),D=function(){var e,t,n="".concat(o.fhirBaseUrl,"/Location?_summary=data&_tag=main store,main pharmacy,dispensary "),r=(0,j.ZP)(n,o.openmrsFetch),a=r.data,l=r.error,s=r.isLoading,c=(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,Ct.Z)(c,"id"))&&void 0!==t?t:[],isLoading:s,error:l}}().stockLocations,N=(0,i.useMemo)((function(){return(0,Dt.Z)((function(e){Ot({v:U.Default,q:e})}),300)}),[]),I=function(e){var t,n;return(null==A||null===(n=A.operationTypes)||void 0===n||null===(t=n.filter((function(t){return t.operationTypeUuid===e.uuid})))||void 0===t?void 0:t.length)>0},T=(r=function(e){return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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,r="ws/rest/v1/stockmanagement/userrolescope".concat(n?"/"+e.uuid:"");return(0,o.openmrsFetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(e){Nt("ws/rest/v1/stockmanagement/userrolescope"),(0,o.showToast)({critical:!0,title:m("addUserRole","Add User role"),kind:"success",description:m("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,o.showNotification)({title:m("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,o){var a=r.apply(e,t);function i(e){Tt(a,n,o,i,l,"next",e)}function l(e){Tt(a,n,o,i,l,"throw",e)}i(void 0)}))},function(e){return s.apply(this,arguments)});return C||x||B?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:kt.section},l().createElement("div",null,(null==S||null===(t=S.results)||void 0===t?void 0:t.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:kt.subTitle},m("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:m("user","User"),items:null==S?void 0:S.results,onChange:function(e){var t,n,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"],r=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return o.includes(e.uuid)}));g(jt(Ut({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),v(null!=r?r:[]),console.info(f)},shouldFilterItem:function(e){return!0},onFocus:function(){return(null==S?void 0:S.results)||N("")},onToggleClick:function(){return(null==S?void 0:S.results)||N("")},itemToString:function(e){var t,n,o;return"".concat(null!==(o=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!==o?o:"")},placeholder:"Filter..."})))),l().createElement("section",{className:kt.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:m("role","Role"),id:"select-role",value:null!==(c=A.role)&&void 0!==c?c:"placeholder-item",onChange:function(e){var t,n,o,r=null==D||null===(t=D.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(o=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return!r||0===r.length||!r.some((function(t){return t===e.locationUuid}))})))&&void 0!==o?o:[];g(jt(Ut({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:m("Choose a role")}),null===(n=null!==(u=null==h?void 0:h.roles)&&void 0!==u?u:f)||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:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.enabled);g(jt(Ut({},A),{enabled:n}))},checked:null==A?void 0:A.enabled,labelText:m("Enabled ?"),value:null==d?void 0:d.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.permanent);g(jt(Ut({},A),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==d?void 0:d.permanent,labelText:m("Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(Rt),locale:"en",dateFormat:X,onChange:function(e){g(jt(Ut({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,labelText:m("activeFrom","Active From"),value:$(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:V,labelText:m("activeTo","Active To"),value:$(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:kt.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kt.sectionTitle}," ",m("stockOperation","Stock Operations")),l().createElement("div",{className:kt.hr}),l().createElement("span",{className:kt.subTitle},m("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},(null==k?void 0:k.length)>0&&k.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:I(e),onChange:function(t){return function(e,t,n){var o,r=null==A||null===(o=A.operationTypes)||void 0===o?void 0:o.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(r){var a=Ft(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==r?void 0:r.operationTypeUuid)})));g(jt(Ut({},A),{operationTypes:a}))}else{var i,l=null==k?void 0:k.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={operationTypeName:null==l?void 0:l.name,operationTypeUuid:null==l?void 0:l.uuid};g(jt(Ut({},A),{operationTypes:Ft(null!==(i=null==A?void 0:A.operationTypes)&&void 0!==i?i:[]).concat([s])}))}}(t,e.uuid,I(e))},className:kt.checkbox,labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:kt.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kt.sectionTitle}," ",m("Locations")),l().createElement("div",{className:kt.hr}),l().createElement("span",{className:kt.subTitle},m("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},(null==D?void 0:D.length)>0&&D.map((function(e){var t,n,o,r=(t=e,(o=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return e.locationUuid===t.id})))&&o.length>0?o[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,o=null==A||null===(n=A.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(o){var r,a,i=Ft(null!==(a=null==A||null===(r=A.locations)||void 0===r?void 0:r.filter((function(e){return e.locationUuid!==(null==o?void 0:o.locationUuid)})))&&void 0!==a?a:[]);g(jt(Ut({},A),{locations:i}))}else{var l,s=null==D?void 0:D.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={locationName:null==s?void 0:s.name,locationUuid:null==s?void 0:s.id,enableDescendants:!1},u=Ft(null!==(l=null==A?void 0:A.locations)&&void 0!==l?l:[]).concat([c]);g(jt(Ut({},A),{locations:u}))}}(t,e.id)},className:kt.checkbox,labelText:e.name,checked:null!=r}),r&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:kt.toggle,size:"sm",onToggleClick:function(e){var t=(null==r?void 0:r.locationUuid)===e?r: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},m("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:T},m("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,o=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Mt,{model:t}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:o,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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,o=new Array(t);n<t;n++)o[n]=e[n];return o}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,r=e.uuid,s=(0,E.useTranslation)().t,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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=c[0],d=c[1],m=l().useCallback((function(){var e=(0,o.showModal)("delete-stock-user-scope-modal",{close:function(){return e()},uuid:r,onConfirmation:function(){var t=[];t.push(r),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="ws/rest/v1/stockmanagement/userrolescope/".concat(e[0]).concat(t),r=new AbortController;return(0,o.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal})}(t).then((function(){Nt("ws/rest/v1/stockmanagement/userrolescope"),d(!1),(0,o.showToast)({critical:!0,title:s("deletingstockUserScope","Delete Stock User Scope"),kind:"success",description:s("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,o.showNotification)({title:s("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[s,r]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:s("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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}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,o.useSession)(),n=bt({v:U.Default,totalCount:!0}),r=n.items,s=n.totalItems,c=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"}]}),[]),_=(0,i.useMemo)((function(){return null==r?void 0:r.map((function(n,o){var i,s,c,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(be.l2,{key:"".concat(t,"-").concat(o,"-0")}):l().createElement(be.Xd,{key:"".concat(t,"-").concat(o,"-1")})," ")})),stockOperations:null==n||null===(c=n.operationTypes)||void 0===c||null===(s=c.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===s?void 0:s.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:r[o]}),l().createElement(Jt,{uuid:r[o].uuid}))})}))}),[t.user.uuid,r,e]);return A?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:ft.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!=_?_:[],headers:g,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,r=t.headers,i=t.getHeaderProps,s=t.getTableProps,c=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:ft.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:u}),l().createElement(qt,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,r.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Vt(Kt({},i({header:e,isSortable:e.isSortable})),{className:o.isDesktop?ft.desktopHeader:ft.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:o.isDesktop?ft.desktopRow:ft.tabletRow},c({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:ft.tileContainer},l().createElement(a.n9L,{className:ft.tile},l().createElement("div",{className:ft.tileContent},l().createElement("p",{className:ft.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:ft.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:c,pageSize:m,pageSizes:u,totalItems:s,onChange:function(e){var t=e.pageSize,n=e.page;t!==m&&p(t),n!==c&&d(n)},className:ft.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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){en(e,t,n[t])}))}return e}function nn(e){var t="ws/rest/v1/stockmanagement/stocksource".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}function on(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var rn=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=f(),c()(an.Z,ln);const sn=an.Z&&an.Z.locals?an.Z.locals:void 0;function cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const pn=function(e){var t,n,r,s=e.model,c=(0,E.useTranslation)().t,u=xt((0,o.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(dn({},s)),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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(n,r)||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}}(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.")}()),m=d[0],p=d[1],A=(0,i.useCallback)((function(e){e.preventDefault(),s&&(m.uuid=s.uuid),function(e){var t,n,r,a=null!=e.uuid,i="ws/rest/v1/stockmanagement/stocksource".concat(a?"/"+e.uuid:""),l=new AbortController;return(0,o.openmrsFetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},signal:l.signal,body:(n=tn({},e),r={sourceType:null==e||null===(t=e.sourceType)||void 0===t?void 0:t.uuid},r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n)})}(m).then((function(){(0,o.showToast)({critical:!0,title:c("addedSource","Add Source"),kind:"success",description:c("stocksourceaddedsuccessfully","Stock Source Added Successfully")}),rn("ws/rest/v1/stockmanagement/stocksource"),Q()}),(function(e){(0,o.showNotification)({title:c("errorAddingSource', 'error adding a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[m,s,c]);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:sn.section},l().createElement(a.oil,{id:"fullname",type:"text",labelText:c("fullName","Full Name"),size:"md",onChange:function(e){s&&(s.name=e.target.value),p(mn(dn({},m),{name:e.target.value}))},value:null==s?void 0:s.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:sn.section},l().createElement(a.oil,{id:"acronym",type:"text",size:"md",placeholder:"e.g NMS",onChange:function(e){s&&(s.acronym=e.target.value),p(mn(dn({},m),{acronym:e.target.value}))},value:null==s?void 0:s.acronym,labelText:c("acronym","Acronym/Code")})),l().createElement("section",{className:sn.section},l().createElement(a.PhF,{name:"sourceType",className:"select-field",labelText:c("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:c("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},c("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},c("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),_n={};_n.styleTagTransform=b(),_n.setAttributes=g(),_n.insert=p().bind(null,"head"),_n.domAPI=d(),_n.insertStyleElement=f(),c()(gn.Z,_n);const fn=gn.Z&&gn.Z.locals?gn.Z.locals:void 0;function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const bn=function(e){var t,n=e.onFilterChange,r=xt((0,o.useConfig)().stockSourceTypeUUID),i=r.items,s=r.isLoading,c=r.isError;return s||c?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:fn.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return vn(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 vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vn(e,t):void 0}}(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=f(),c()(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,o=new Array(t);n<t;n++)o[n]=e[n];return o}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,r=e.uuid,s=(0,E.useTranslation)().t,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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=c[0],d=c[1],m=l().useCallback((function(){var e=(0,o.showModal)("delete-stock-modal",{close:function(){return e()},uuid:r,onConfirmation:function(){var t=[];t.push(r),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="ws/rest/v1/stockmanagement/stocksource/".concat(e[0]).concat(t),r=new AbortController;return(0,o.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:r.signal})}(t).then((function(){d(!1),rn("ws/rest/v1/stockmanagement/stocksource"),(0,o.showToast)({critical:!0,title:s("deletingSource","Delete Source"),kind:"success",description:s("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,o.showNotification)({title:s("errorDeletingSource', 'error deleting a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[s,r]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:s("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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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 Bn=function(e){var t=e.data,n=(0,E.useTranslation)().t,o=(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 o()},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.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,o=new Array(t);n<t;n++)o[n]=e[n];return o}function xn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){xn(e,t,n[t])}))}return e}function Nn(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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const In=function(){var e,t,n=(0,E.useTranslation)().t,r=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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.")}()),s=r[0],c=r[1],u=function(e){var t=nn(e),n=t.items,r=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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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.")}()}((0,i.useState)(10),2),s=l[0],c=l[1],u=(0,o.usePagination)(n.results,s),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:s,paginatedItems:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:r,isError:a,setPageSize:c,tableHeaders:A}}({v:U.Default,totalCount:!0}),d=u.items,m=u.totalItems,p=u.tableHeaders,A=u.currentPage,g=u.pageSizes,_=u.goTo,f=u.currentPageSize,v=u.setPageSize,b=u.isLoading,h=(0,i.useMemo)((function(){return null==d?void 0:d.map((function(e,t){var n;return Nn(Dn({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:null==e?void 0:e.uuid,name:null==e?void 0:e.name,acronym:null==e?void 0:e.acronym,sourceType:null==e||null===(n=e.sourceType)||void 0===n?void 0:n.display,actions:l().createElement(l().Fragment,null,l().createElement(Bn,{data:d[t]}),l().createElement(wn,{uuid:d[t].uuid}))})}))}),[d]),y=function(e){c(e)},k=(0,i.useMemo)((function(){return s?h.filter((function(e){return e.sourceType===s})):h}),[h,s]);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,r=e.headers,i=e.getHeaderProps,s=e.getTableProps,c=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_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,r.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Nn(Dn({},i({header:e,isSortable:e.isSortable})),{className:o.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,Dn({className:o.isDesktop?kn.desktopRow:kn.tabletRow},c({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:f,pageSizes:g,totalItems:m,onChange:function(e){var t=e.pageSize,n=e.page;t!==f&&v(t),n!==A&&_(n)},className:kn.paginationOverride}))},Tn=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(In,null))};function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Un(e){var t,n,r=F(e),a=r.items,l=r.isLoading,s=r.isError,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,_=(0,E.useTranslation)().t,f=(0,i.useMemo)((function(){return[{id:0,header:_("type","Type"),key:"operationTypeName"},{id:1,header:_("number","Number"),key:"operationNumber"},{id:2,header:_("status","Status"),key:"status"},{id:3,header:_("location","Location"),key:"location"},{id:4,header:_("responsiblePerson","Responsible Person"),key:"responsiblePerson"},{id:5,header:_("date","Date"),key:"operationDate"},{id:6,key:"details"},{key:"actions",header:""}]}),[_]);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:s,setPageSize:d,tableHeaders:f}}var jn=n(1535),Ln={};Ln.styleTagTransform=b(),Ln.setAttributes=g(),Ln.insert=p().bind(null,"head"),Ln.domAPI=d(),Ln.insertStyleElement=f(),c()(jn.Z,Ln);const Fn=jn.Z&&jn.Z.locals?jn.Z.locals:void 0;var zn="RETURNED",Rn="CANCELLED",Mn="REJECTED",qn=["NEW","SUBMITTED","DISPATCHED","COMPLETED",zn,Rn,Mn],Gn=n(6817);function Hn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Zn=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,r=St(),s=r.types.results,c=r.isLoading,u=r.isError,d=function(){var e,t=(0,o.useSession)().user,n="".concat(o.restBaseUrl,"/stockmanagement/userrolescope"),r=(0,j.ZP)(n,o.openmrsFetch),a=r.data,i=r.isLoading,l=r.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})))||[],o=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==s?void 0:s.filter((function(e){return o.includes(e.uuid)})))||[]}),[s,d]);return(0,i.useEffect)((function(){null==n||n(m)}),[m,n]),c||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=f(),c()(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,o=e.hasContainer,r=e.selectedIndex,i=e.onChange;return l().createElement("div",{className:"\n ".concat(o?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:r,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;function Vn(e){return"transferout"===(e=e.toLowerCase())?"transferout":"disposed"===e?"disposed":"stockissue"===e?"stockissue":"stocktake"===e?"stocktake":"requisition"===e?"requisition":"receipt"===e?"receipt":"return"===e?"return":"adjustment"===e?"adjustment":"initial"===e?"initial":void 0}!function(e){e.TRANSFER_OUT_OPERATION_TYPE="transferout",e.DISPOSED_OPERATION_TYPE="disposed",e.STOCK_ISSUE_OPERATION_TYPE="stockissue",e.STOCK_TAKE_OPERATION_TYPE="stocktake",e.REQUISITION_OPERATION_TYPE="requisition",e.OPENING_STOCK_OPERATION_TYPE="initial",e.RECEIPT_OPERATION_TYPE="receipt",e.RETURN_OPERATION_TYPE="return",e.ADJUSTMENT_OPERATION_TYPE="adjustment"}(Kn||(Kn={}));var Xn=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},$n=function(e){return!eo(e)&&"requisition"!==e},eo=function(e){return"receipt"===e||"initial"===e},to=function(e){return"requisition"===e},no=function(e){return"receipt"===e||"initial"===e},oo=function(e){return"stockissue"===e||"return"===e},ro=function(e){return"stockissue"===e||ao(e)||io(e)||lo(e)},ao=function(e){return"requisition"===e},io=function(e){return"receipt"===e},lo=function(e){return"transferout"===e},so=n(7536),co=n(6312),uo=n(1604),mo=uo.z.object({id:uo.z.string().nullish(),uuid:uo.z.string().nullish(),stockItemUuid:uo.z.string().nullish(),packagingUomName:uo.z.string().nullish(),packagingUomUuid:uo.z.string().nullish(),factor:uo.z.number().nullish(),isDefaultStockOperationsUoM:uo.z.boolean().nullish(),isDispensingUnit:uo.z.boolean().nullish()}),po=uo.z.object({canView:uo.z.boolean(),canEdit:uo.z.boolean(),canApprove:uo.z.boolean().nullish(),canReceiveItems:uo.z.boolean().nullish(),canDisplayReceivedItems:uo.z.boolean().nullish(),isRequisitionAndCanIssueStock:uo.z.boolean().nullish(),canUpdateBatchInformation:uo.z.boolean().nullish()}),Ao=uo.z.object({itemIndex:uo.z.number().nullish(),id:uo.z.string().nullish(),uuid:uo.z.string().nullish(),stockItemUuid:uo.z.string().nullish(),stockItemName:uo.z.string().nullish(),stockItemPackagingUOMUuid:uo.z.string().nullish(),stockItemPackagingUOMName:uo.z.string().nullish(),stockBatchUuid:uo.z.string().nullish(),batchNo:uo.z.string().nullish(),expiration:uo.z.coerce.date().nullish(),quantity:uo.z.number().nullish(),purchasePrice:uo.z.number().nullish(),permission:po.nullish(),edit:uo.z.boolean().nullish(),hasExpiration:uo.z.boolean().nullish(),packagingUnits:mo.array(),quantityReceived:uo.z.number().nullish(),quantityReceivedPackagingUOMName:uo.z.string().nullish(),quantityReceivedPackagingUOMUuid:uo.z.string().nullish(),quantityRequested:uo.z.number().nullish(),quantityRequestedPackagingUOMUuid:uo.z.string().nullish(),quantityRequestedPackagingUOMName:uo.z.string().nullish(),commonName:uo.z.string().nullish(),acronym:uo.z.string().nullish()}),go=(uo.z.object({uuid:uo.z.string().nullish(),cancelReason:uo.z.string().nullish(),cancelledBy:uo.z.coerce.number(),cancelledByGivenName:uo.z.string().nullish(),cancelledByFamilyName:uo.z.string().nullish(),cancelledDate:uo.z.coerce.date(),completedBy:uo.z.coerce.number(),completedByGivenName:uo.z.string().nullish(),completedByFamilyName:uo.z.string().nullish(),completedDate:uo.z.coerce.date(),destinationUuid:uo.z.string().nullish(),destinationName:uo.z.string().nullish(),externalReference:uo.z.string().nullish(),atLocationUuid:uo.z.string().nullish(),atLocationName:uo.z.string().nullish(),operationDate:uo.z.coerce.date(),submitted:uo.z.boolean(),submittedBy:uo.z.string().nullish(),submittedByGivenName:uo.z.string().nullish(),submittedByFamilyName:uo.z.string().nullish(),locked:uo.z.boolean(),operationNumber:uo.z.string().nullish(),operationOrder:uo.z.coerce.number(),remarks:uo.z.string().nullish(),sourceUuid:uo.z.string().nullish(),sourceName:uo.z.string().nullish(),status:uo.z.enum(qn),returnReason:uo.z.string().nullish(),rejectionReason:uo.z.string().nullish(),operationTypeUuid:uo.z.string().nullish(),operationType:uo.z.string().nullish(),operationTypeName:uo.z.string().nullish(),responsiblePerson:uo.z.coerce.number(),responsiblePersonUuid:uo.z.string().nullish(),responsiblePersonGivenName:uo.z.string().nullish(),responsiblePersonFamilyName:uo.z.string().nullish(),responsiblePersonOther:uo.z.string().nullish(),creator:uo.z.coerce.number(),dateCreated:uo.z.coerce.date(),creatorGivenName:uo.z.string().nullish(),creatorFamilyName:uo.z.string().nullish(),permission:po.nullish(),reasonUuid:uo.z.string().nullish(),reasonName:uo.z.string().nullish(),approvalRequired:uo.z.boolean().nullish(),stockOperationItems:Ao.array(),submittedDate:uo.z.coerce.date(),returnedByGivenName:uo.z.string().nullish(),returnedByFamilyName:uo.z.string().nullish(),returnedDate:uo.z.coerce.date(),rejectedByGivenName:uo.z.string().nullish(),rejectedByFamilyName:uo.z.string().nullish(),rejectedDate:uo.z.coerce.date(),dispatchedByGivenName:uo.z.string().nullish(),dispatchedByFamilyName:uo.z.string().nullish(),dispatchedDate:uo.z.coerce.date(),requisitionStockOperationUuid:uo.z.string()}),uo.z.object({operationDate:uo.z.coerce.date(),sourceUuid:uo.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:uo.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:uo.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:uo.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:uo.z.string().nullish(),remarks:uo.z.string().nullish()})),_o=function(e){switch(e){case Kn.OPENING_STOCK_OPERATION_TYPE:return go.omit({destinationUuid:!0,reasonUuid:!0});case Kn.STOCK_TAKE_OPERATION_TYPE:case Kn.ADJUSTMENT_OPERATION_TYPE:case Kn.DISPOSED_OPERATION_TYPE:return go.omit({destinationUuid:!0});case Kn.TRANSFER_OUT_OPERATION_TYPE:case Kn.STOCK_ISSUE_OPERATION_TYPE:return go.omit({reasonUuid:!0}).merge(uo.z.object({destinationUuid:uo.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"}),requisitionStockOperationUuid:uo.z.string({required_error:"Requisition stock uuid required"})}));case Kn.RETURN_OPERATION_TYPE:case Kn.REQUISITION_OPERATION_TYPE:case Kn.RECEIPT_OPERATION_TYPE:return go.omit({reasonUuid:!0}).merge(uo.z.object({sourceUuid:uo.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const fo=function(e){return l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,r=o.onChange,i=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:e.parties,onChange:function(t){var n,o;null===(n=e.onPartyChange)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.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 vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function bo(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ho(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function yo(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 o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];var i=setTimeout((function(){var t;e.apply(void 0,function(e){if(Array.isArray(e))return ho(e)}(t=r)||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 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}}(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 ko=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:""}},Co={uuid:"Other",display:"Other",person:{display:"Other"}};function Eo(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const wo=function(e){var t=function(e){var t=bo((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],o=t[1],r=Ot(n),a=r.items.results,l=r.isLoading,s=bo((0,i.useState)(null),2),c=s[0],u=s[1],d=bo((0,i.useState)(10),2),m=d[0],p=d[1],A=bo((0,i.useState)(U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){o({startIndex:0,v:g,limit:m,q:c})}),[c,m,g]),{userList:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}(),n=t.isLoading,o=t.userList,r=t.setSearchString,s=yo((function(e){r(e)}),1e3);return o&&o.push(Co),l().createElement("div",null,l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,i=r.onChange,c=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:o||[],onChange:function(t){var n,o;null===(n=e.onUserChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:null!==(n=null==o?void 0:o.find((function(t){return t.uuid===e.userUuid})))&&void 0!==n?n:"",itemToString:Eo,onInputChange:s,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};function So(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Bo=function(e){return l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r=t.field,i=r.onChange,s=r.value,c=r.ref;return l().createElement(a.oil,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){So(e,t,n[t])}))}return e}({},e),o=null!=(o={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.name,ref:c,value:s})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n))}})},Oo=function(e){var t=xt((0,o.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,r=t.isError,i=t.items.answers;return n||r?l().createElement(a.xNL,null):l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,o=n.onChange,r=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,r;null===(n=e.onReasonChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),o(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},ref:r,invalid:e.invalid,invalidText:e.invalidText})}})};function xo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Do=function(e){return l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r=t.field,i=r.onChange,s=r.value,c=r.ref;return l().createElement(a.Kx8,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){xo(e,t,n[t])}))}return e}({},e),o=null!=(o={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.name,ref:c,value:s})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n))}})};function No(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var Io=(0,i.createContext)(null),To=function(){return(0,i.useContext)(Io)},Po=function(e){var t,n,o=e.children,r=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||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}}(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:r[0],setFormContext:r[1]};return l().createElement(Io.Provider,{value:a},o)},Uo=[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],jo=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE];function Lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Fo(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function zo(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}(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 Ro=function(e){var t,n,o,r,s,c,u=e.model,d=e.onSave,m=e.operation,p=e.canEdit,A=e.isEditing,g=e.setup,_=g.requiresStockAdjustmentReason,f=g.shouldLockSource,v=g.shouldLockDestination,b=g.sourcePartyList,h=g.destinationPartyList,y=(0,E.useTranslation)().t,k=To().setFormContext,C=Un({v:U.Full,totalCount:!0}),w=C.isLoading,S=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=null!==(e=null==n?void 0:n.filter((function(e){return e.operationType===Kn.STOCK_ISSUE_OPERATION_TYPE})).map((function(e){return e.requisitionStockOperationUuid})))&&void 0!==e?e:[],r=null!==(t=null==n?void 0:n.filter((function(e){return e.operationType===Kn.REQUISITION_OPERATION_TYPE&&!o.includes(e.uuid)})))&&void 0!==t?t:[];return r}(C.items),B=Vn(m.operationType),O=(0,so.cI)({defaultValues:u,mode:"all",resolver:(0,co.F)(_o(B))}),x=O.handleSubmit,D=O.control,I=O.formState.errors,T=O.setValue,P=zo((0,i.useState)(),2),j=P[0],L=P[1],F=zo((0,i.useState)(!1),2),z=F[0],R=F[1];if(w)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var M,q,G,H,Z,Y,Q=function(){var e,t=(e=function(e){var t;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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]),R(!0),t=function(e,t,n){var o=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]}))}(o),function(e){return Uo.includes(e)}(n)&&delete o.destinationName,function(e){return jo.includes(e)}(n)&&delete o.destinationUuid,o}(u,e,B),[4,d(t)];case 1:case 2:return n.sent(),[3,4];case 3:return R(!1),[7];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Fo(a,o,r,i,l,"next",e)}function l(e){Fo(a,o,r,i,l,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return l().createElement("div",{style:{margin:"10px"}},l().createElement("form",{className:"".concat(N.formContainer," ").concat(N.verticalForm)},B===Kn.STOCK_ISSUE_OPERATION_TYPE&&l().createElement(so.Qr,{control:D,name:"requisitionStockOperationUuid",render:function(e){var t,n=e.field;return l().createElement(a.CtY,{id:"requisitionStockOperationUuid",items:S,onChange:function(e){n.onChange(e.selectedItem.uuid),Object.assign(u.stockOperationItems,e.selectedItem.stockOperationItems),k({stockItems:e.selectedItem.stockOperationItems})},itemToString:function(e){var t;return null!==(t="".concat(null==e?void 0:e.operationNumber))&&void 0!==t?t:""},titleText:y("requisitionStockOperation","Requisition"),invalid:!!I.requisitionStockOperationUuid,invalidText:null===(t=I.requisitionStockOperationUuid)||void 0===t?void 0:t.message,placeholder:y("chooseARequisition","Choose a requisition")})}}),p&&l().createElement(so.Qr,{control:D,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:!!I.operationDate,invalidText:null==I||null===(t=I.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:y("operationDate","Operation Date"),value:$(null==u?void 0:u.operationDate)}))},name:"operationDate"}),!p&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(null==u?void 0:u.operationDate),readOnly:!0,labelText:"Operation Date"})),A&&(null==u?void 0:u.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==u?void 0:u.operationNumber,readOnly:!0,labelText:"Operation Number"}),p&&!f&&(null==m?void 0:m.hasSource)&&l().createElement(fo,{controllerName:"sourceUuid",name:"sourceUuid",control:D,title:(null==m?void 0:m.hasDestination)?y("from","From"):y("location:","Location"),placeholder:m.hasDestination?y("chooseASource","Choose a source"):y("chooseALocation","Choose a location"),invalid:!!I.sourceUuid,invalidText:I.sourceUuid&&(null==I||null===(t=I.sourceUuid)||void 0===t?void 0:t.message),parties:b||[]}),(!p||A||f)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:null!==(M=null==u?void 0:u.sourceName)&&void 0!==M?M:"",readOnly:!0,labelText:(null==m||m.hasDestination,"From")}),p&&!v&&(null==m?void 0:m.hasDestination)&&l().createElement(fo,{controllerName:"destinationUuid",name:"destinationUuid",control:D,title:(null==m?void 0:m.hasSource)?"To":"Location",placeholder:(null==m?void 0:m.hasSource)?y("chooseADestination","Choose a destination"):"Location",invalid:!!I.destinationUuid,invalidText:I.destinationUuid&&(null==I||null===(n=I.destinationUuid)||void 0===n?void 0:n.message),parties:h||[]}),(!p||A||v)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:null!==(q=null==u?void 0:u.destinationName)&&void 0!==q?q:"",readOnly:!0,labelText:(null==m||m.hasSource,"To")}),p&&l().createElement(wo,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:D,title:y("responsiblePerson:","Responsible Person"),placeholder:y("filter","Filter ..."),invalid:!!I.responsiblePersonUuid,invalidText:I.responsiblePersonUuid&&(null==I||null===(o=I.responsiblePersonUuid)||void 0===o?void 0:o.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===Co.uuid&&L(!0)}}),j&&l().createElement(Bo,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:D,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(G=null==u?void 0:u.responsiblePersonOther)&&void 0!==G?G:""),labelText:y("responsiblePerson","Responsible Person"),placeholder:y("pleaseSpecify","Please Specify"),invalid:!!I.responsiblePersonOther,invalidText:I.responsiblePersonOther&&(null==I||null===(r=I.responsiblePersonOther)||void 0===r?void 0:r.message)}),!p&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(H=(null==u?void 0:u.responsiblePersonUuid)&&(null==u?void 0:u.responsiblePersonUuid)!==Co.uuid?"".concat(null==u?void 0:u.responsiblePersonFamilyName," ").concat(null==u?void 0:u.responsiblePersonGivenName):null==u?void 0:u.responsiblePersonOther)&&void 0!==H?H:"",readOnly:!0,labelText:"Responsible Person"}),_&&p&&l().createElement(Oo,{controllerName:"reasonUuid",name:"reasonUuid",control:D,placeholder:y("chooseAReason","Choose a reason"),title:y("reason","Reason"),invalid:!!I.reasonUuid,invalidText:I.reasonUuid&&(null==I||null===(s=I.reasonUuid)||void 0===s?void 0:s.message),onReasonChange:function(e){T("reasonUuid",e.uuid)}}),_&&!p&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(Z=null==u?void 0:u.reasonName)&&void 0!==Z?Z:"",readOnly:!0,labelText:"Reason:"}),l().createElement(Do,{id:"remarks",name:"remarks",control:D,controllerName:"remarks",maxLength:255,value:"".concat(null!==(Y=null==u?void 0:u.remarks)&&void 0!==Y?Y:""),labelText:y("remarks:","Remarks"),invalid:!!I.remarks,invalidText:I.remarks&&(null==I||null===(c=I.remarks)||void 0===c?void 0:c.message)}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:x(Q),kind:"primary",renderIcon:be.ol},z?l().createElement(a.lSo,null):y("next","Next")))))};var Mo={stockItemUuid:uo.z.string().min(1,{message:"Required"}),stockItemName:uo.z.string().min(1).nullish(),stockItemPackagingUOMUuid:uo.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:uo.z.string().min(1).nullish(),batchNo:uo.z.string().min(1,{message:"Required"}),stockBatchUuid:uo.z.string().optional(),expiration:uo.z.coerce.date({required_error:"Required"}),quantity:uo.z.coerce.number().min(1,{message:"Required"}),purchasePrice:uo.z.coerce.number().nullish(),hasExpiration:uo.z.boolean().nullish()},qo=uo.z.object(Mo),Go=(qo.omit({expiration:!0}),uo.z.object({stockItems:uo.z.array(qo)})),Ho=n(6781),Zo={};Zo.styleTagTransform=b(),Zo.setAttributes=g(),Zo.insert=p().bind(null,"head"),Zo.domAPI=d(),Zo.insertStyleElement=f(),c()(Ho.Z,Zo);const Yo=Ho.Z&&Ho.Z.locals?Ho.Z.locals:void 0;function Qo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Jo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qo(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 Wo(e){return e.drugName||e.conceptName}const Ko=function(e){var t=function(e){var t=Jo((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],o=t[1],r=He(n),a=r.items.results,l=r.isLoading,s=Jo((0,i.useState)(null),2),c=s[0],u=s[1],d=Jo((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Jo((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){o({startIndex:0,v:g,limit:m,q:c})}),[c,m,g]),{stockItemsList:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}({}),n=t.isLoading,o=t.stockItemsList,r=t.setSearchString,s=yo((function(e){r(e)}),500);return l().createElement("div",null,l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,i=r.onChange,c=(r.value,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:o||[],onChange:function(t){var n,o;null===(n=e.onStockItemChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:null!==(n=null==o?void 0:o.find((function(t){return t.uuid===e.stockItemUuid})))&&void 0!==n?n:"",itemToString:Wo,onInputChange:s,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Vo=function(e){var t,n=Je(e.stockItemUuid),o=n.isLoading,r=n.isError,s=n.item,c=(0,i.useMemo)((function(){var e;return(null==s||null===(e=s.packagingUnits)||void 0===e?void 0:e.length)>0?s.packagingUnits[0]:null}),[null==s?void 0:s.packagingUnits]);return o||r?l().createElement(a.N2B,null):l().createElement("div",null,l().createElement(so.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=c.uuid)&&void 0!==t?t:"",render:function(t){var n,o=t.field,r=o.onChange,i=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!==(n=null==s?void 0:s.packagingUnits)&&void 0!==n?n:[],onChange:function(t){var n,o;null===(n=e.onStockPackageChanged)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:c,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 Xo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xo(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 er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function tr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return er(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nr(e){var t=tr((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0,includeBatchNo:!0}),2),n=t[0],o=t[1],r=tr((0,i.useState)(10),2),a=r[0],l=r[1],s=tr((0,i.useState)(null),2),c=s[0],u=s[1],d=tr((0,i.useState)(1),2),m=d[0],p=d[1],A=tr((0,i.useState)(),2),g=A[0],_=A[1],f=tr((0,i.useState)(),2),v=f[0],b=f[1],h=tr((0,i.useState)(),2),y=h[0],k=h[1],C=tr((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){o({startIndex:m-1,v:U.Default,limit:a,q:c,totalCount:!0,stockItemUuid:g,partyUuid:v,locationUuid:y,stockBatchUuid:E,includeBatchNo:!0})}),[c,m,a,g,v,y,E]);var S,B=Ze(n),O=B.items,x=B.isLoading,D=B.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:D,setSearchString:u,setStockItemUuid:_,setLocationUuid:k,setPartyUuid:b,setStockBatchUuid:w}}function or(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const rr=function(e){var t=function(e){var t=$o((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],o=t[1],r=Ye(n),a=r.items.results,l=r.isLoading,s=$o((0,i.useState)(null),2),c=s[0],u=s[1],d=$o((0,i.useState)(10),2),m=d[0],p=d[1],A=$o((0,i.useState)(U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){o({startIndex:0,v:g,limit:m,q:c,stockItemUuid:e})}),[c,m,g,e]),{stockItemBatchNos:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}(e.stockItemUuid),n=t.isLoading,o=t.stockItemBatchNos,r=(0,i.useMemo)((function(){var t;return null!==(t=null==o?void 0:o.find((function(t){return t.uuid===e.batchUuid})))&&void 0!==t?t:""}),[o,e.batchUuid]),s=nr(U.Default),c=s.items,u=s.setStockItemUuid;(0,i.useEffect)((function(){u(e.stockItemUuid)}),[e.stockItemUuid,u]);var d=null==o?void 0:o.map((function(e){var t,n,o,r=null==c?void 0:c.find((function(t){return t.batchNumber===e.batchNo}));return r?(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){or(e,t,n[t])}))}return e}({},e),o=null!=(o={quantity:null!==(t=r.quantity)&&void 0!==t?t:""})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n):e}));return n?l().createElement(a.lSo,{status:"active"}):l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,o=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,r;null===(n=e.onBatchNoChanged)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:r,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 ar(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ir(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ar(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ar(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const lr=function(e){var t=e.canEdit,n=e.showQuantityRequested,r=e.requiresActualBatchInformation,s=e.requiresBatchUuid,c=e.canUpdateBatchInformation,u=e.canCapturePurchasePrice,d=e.batchBalance,m=e.control,p=e.setValue,A=e.errors,g=e.remove,_=e.fields,f=ir((0,i.useState)(),2),v=(f[0],f[1]),b=ir((0,i.useState)(),2),h=(b[0],b[1]);return l().createElement(l().Fragment,null,null==_?void 0:_.map((function(e,i){var f,b,y,k,C,E,w,S,B,O,x,D,N,I,T,P,U,j,L,F,z,R,M,q,G,H,Z,Y,Q,J,W,K,te,ne,oe="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:o.isDesktop?Yo.desktopRow:Yo.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(Ko,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:oe,control:m,invalid:!!(null==A||null===(b=A.stockItems)||void 0===b||null===(f=b[i])||void 0===f?void 0:f.stockItemUuid),onStockItemChanged:function(e){var t;!function(e,t){if(t){var n=_[e];if(n){var o,r,a,i;n.stockItemName=null!==(a=(null==t?void 0:t.drugName)?"".concat(null==t?void 0:t.drugName).concat((null!==(o=null==t?void 0:t.commonName)&&void 0!==o?o:null==t?void 0:t.conceptName)?" (".concat(null!==(r=null==t?void 0:t.commonName)&&void 0!==r?r: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),v(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:""),(r||s)&&l().createElement(a.pj1,null,r&&(t||c&&(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}),s&&!r&&t&&l().createElement(rr,{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}),!(c&&(null==e||null===(B=e.permission)||void 0===B?void 0:B.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(r||s)&&l().createElement(a.pj1,null,(t||c&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&r&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=ir(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===(D=A.stockItems)||void 0===D||null===(x=D[i])||void 0===x?void 0:x.expiration)})),(!(c&&(null==e||null===(N=e.permission)||void 0===N?void 0:N.canUpdateBatchInformation))&&!t||s)&&$(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===(T=P[i])||void 0===T||null===(I=T.quantity)||void 0===I?void 0:I.message,placeholder:s&&!r&&(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===(L=d[null==e?void 0:e.stockBatchUuid])||void 0===L?void 0:L.quantityUoM)&&void 0!==K?K:""):"",invalid:!!(null==A||null===(z=A.stockItems)||void 0===z||null===(F=z[i])||void 0===F?void 0:F.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Vo,{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 sr=n(6360),cr={};cr.styleTagTransform=b(),cr.setAttributes=g(),cr.insert=p().bind(null,"head"),cr.domAPI=d(),cr.insertStyleElement=f(),c()(sr.Z,cr);const ur=sr.Z&&sr.Z.locals?sr.Z.locals:void 0;function dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function mr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function pr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ar(e){return function(e){if(Array.isArray(e))return dr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||gr(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 gr(e,t){if(e){if("string"==typeof e)return dr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dr(e,t):void 0}}const _r=function(e){var t,n,r,s,c,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,_=u.batchNos,f=u.canUpdateItemsBatchInformation,v=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,B=To().formContext,O=function(e){if("requisition"===e){var t=qo.omit({batchNo:!0,expiration:!0});return uo.z.object({stockItems:uo.z.array(t)})}return Go}(S),x=(t=function(e){return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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,o.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(o,r){var a=t.apply(e,n);function i(e){mr(a,o,r,i,l,"next",e)}function l(e){mr(a,o,r,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),D=(0,so.cI)({resolver:(0,co.F)(O),defaultValues:{stockItems:null!==(r=null==y?void 0:y.stockOperationItems)&&void 0!==r?r:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),N=D.handleSubmit,I=D.control,T=D.setValue,P=D.formState.errors,U=(s=(0,i.useState)(!1),c=1,function(e){if(Array.isArray(e))return e}(s)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(s,c)||gr(s,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.")}())[0],j=(0,so.Dq)({name:"stockItems",control:I}),L=j.fields,F=j.append,z=j.remove;(0,i.useEffect)((function(){if(null==B?void 0:B.stockItems){var e=null==B?void 0:B.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==B?void 0:B.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(Ar(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),Ar(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),Ar(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),Ar(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")}],Ar(A?[{key:"purchaseprice",header:w("purchasePrice","Purchase Price")}]:[])),q=function(){var e="new-item-".concat("".concat((new Date).getTime(),"-").concat(Math.random().toString(36).substring(2,16)));F({uuid:e,id:e})};return l().createElement("div",{style:{margin:"10px"}},l().createElement("div",{className:ur.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,r=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,s;return l().createElement(a.xDH,(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){pr(e,t,n[t])}))}return e}({},r({header:e,isSortable:!1})),s=null!=(s={className:o.isDesktop?ur.desktopHeader:ur.tabletHeader,style:null==e?void 0:e.styles,key:"".concat(e.key)})?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(s)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(s)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(s,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:be.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return N(x)()},kind:"primary",renderIcon:be.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(lr,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:_,control:I,setValue:T,errors:P,remove:z,append:F,canEdit:h,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:f,canCapturePurchasePrice:A,itemUoM:v,fields:L})," ")))}})))};var fr=n(8808);function vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function br(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function hr(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){br(a,o,r,i,l,"next",e)}function l(e){br(a,o,r,i,l,"throw",e)}i(void 0)}))}}function yr(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vr(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,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const Cr=function(e){var t=e.canEdit,n=e.locked,o=e.model,r=e.requiresDispatchAcknowledgement,s=e.actions,c=(0,E.useTranslation)().t,u=yr((0,i.useState)(!1),2),d=u[0],m=u[1],p=yr((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:c("doesThisTransactionRequireApproval","Does the transaction require approval ?"),onChange:function(e){g(e)},defaultSelected:A},l().createElement(a.EUY,{value:!0,id:"rbgApprovelRequired-true",labelText:c("yes","Yes")}),l().createElement(a.EUY,{value:!1,id:"rbgApprovelRequired-false",labelText:c("no","No")}))),!t&&l().createElement(l().Fragment,null,l().createElement(a.oil,{style:{margin:"5px"},id:"rbgApproveRequiredLbl",value:A?c("yes","Yes"):c("no","No"),readOnly:!0,labelText:c("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,!r&&!A&&l().createElement(a.zxk,{name:"complete",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:hr((function(){return kr(this,(function(e){switch(e.label){case 0:return null==o||delete o.dateCreated,o.status="COMPLETED",m(!0),[4,s.onComplete(o)];case 1:return e.sent(),m(!1),[2]}}))})),renderIcon:ge.X4},c("complete","Complete")),r&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:s.onDispatch,renderIcon:ct.bS},c("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:s.onSubmit,renderIcon:fr.f5},c("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:hr((function(){return kr(this,(function(e){switch(e.label){case 0:return null==o||delete o.dateCreated,null==o||delete o.status,m(!0),[4,s.onSave(o)];case 1:return e.sent(),m(!1),[2]}}))})),kind:"secondary",renderIcon:fr.vc},d?l().createElement(a.lSo,null):c("save","Save")),!d&&l().createElement(a.zxk,{type:"button",style:{margin:"4px"},className:"cancelButton",kind:"tertiary",onClick:s.onGoBack,renderIcon:Zt.WP},c("goBack","Go Back"))))};var Er="Location",wr="Other";function Sr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Br(){var e;return e=function(e,t,n){var r,a,i,l,s,c,u,d,m,p,A,g,_,f,v,b,h,y,k,C,E,w,S,B,O,x,D,N,I,T,P,U,j,L,F,z,R,M,q,G,H;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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=[],_=!1,f=n,b=null!==(v=null==t||null===(r=t.permission)||void 0===r?void 0:r.isRequisitionAndCanIssueStock)&&void 0!==v&&v,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]===re,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]===re,S=null,A?(p=structuredClone(ko()),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,(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/party?v=default")]):[3,2];case 1:if(!(N=Z.sent()).ok)throw Error("Error loading parties");return B=null==N||null===(D=N.data)||void 0===D||null===(x=D.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Er&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wr})),(null==e?void 0:e.hasSource)&&A&&k&&(null==B?void 0:B.length)>0&&(I=B[0],p.sourceUuid=I.uuid,p.sourceName=I.name,S=null==I?void 0:I.locationUuid),(null==e?void 0:e.hasDestination)&&(O=null==N||null===(P=N.data)||void 0===P||null===(T=P.results)||void 0===T?void 0:T.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Er&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wr})),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,Bt()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");f=j.data.results,Z.label=4;case 4:return L=Vn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=L,"adjustment"===Y),requiresBatchUuid:$n(L),requiresActualBatchInfo:eo(L),isQuantityOptional:to(L),canCaptureQuantityPrice:no(L),requiresStockAdjustmentReason:Xn(L),requiresDispatchAcknowledgement:oo(L),allowExpiredBatchNumbers:null!==(F=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==F&&F,canEditModel:null!==(z=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==z&&z,canViewModel:null!==(R=null==t||null===(s=t.permission)||void 0===s?void 0:s.canView)&&void 0!==R&&R,canApproveModel:null!==(M=null==t||null===(c=t.permission)||void 0===c?void 0:c.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||ro(L),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Er&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wr},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Er&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wr},location:S,sourcePartyList:B,destinationPartyList:O,stockOperationTypes:f,hasQtyRequested:_}]}var Y}))},Br=function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Sr(a,o,r,i,l,"next",e)}function l(e){Sr(a,o,r,i,l,"throw",e)}i(void 0)}))},Br.apply(this,arguments)}function Or(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function xr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Or(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Or(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 Dr=n(3133);function Nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ir=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,renderIcon:function(e){return l().createElement(Dr.Wz,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Nr(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Tr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Pr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Reject",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Tr(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Ur(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Return",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,kind:"tertiary",renderIcon:function(e){return l().createElement(ve.eL,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Ur(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};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}const Fr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Cancel",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,kind:"danger--ghost",renderIcon:function(e){return l().createElement(dt.jj,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Lr(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function zr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}var Rr,Mr,qr=(Rr=function(e,t,n,o,r){var a,i,l,s,c,u,d,m,p,A,g;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(_){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!==(s=e.completedByFamilyName)&&void 0!==s?s:""," ").concat(null!==(c=e.completedByGivenName)&&void 0!==c?c:""):""),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),o){var i=o.find((function(e){return e.uuid===t.uuid}));i&&(a.unitCost=i.unitCost,a.unitCostUoM=i.unitCostUOMName,a.totalCost=i.totalCost)}if(r){var l=r.find((function(e){return e.stockItemUuid===t.stockItemUuid}));l&&(a.balanceOnHand=l.quantity,a.balanceOnHandUoM=l.quantityUoM)}return a})),[2,a]}))},Mr=function(){var e=this,t=arguments;return new Promise((function(n,o){var r=Rr.apply(e,t);function a(e){zr(r,n,o,a,i,"next",e)}function i(e){zr(r,n,o,a,i,"throw",e)}a(void 0)}))},function(e,t,n,o,r){return Mr.apply(this,arguments)});function Gr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Hr(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Gr(a,o,r,i,l,"next",e)}function l(e){Gr(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Zr(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Yr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(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(o?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Qr=function(){var e=Hr((function(){var e,t;return Zr(this,(function(n){switch(n.label){case 0:e=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(o=ne?"".concat(ae).concat(ne):"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",new Promise((function(e,t){var n;if(o){var r=document.getElementById("hdnTxtPrintLogo");if(r&&(null===(n=r.value)||void 0===n?void 0:n.length)>0){var a=r.getAttribute("isSvg");e({image:r.value,isSvg:"1"===a})}else if(o.toLowerCase().endsWith(".svg"))fetch(o,{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){r&&(r.value=t,r.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 o=n.getContext("2d");if(o){o.drawImage(i,0,0);var a=n.toDataURL("image/png");r&&(r.value=a,r.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=o}}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||oe?'\n<div class="logo" >\n '.concat(e?e.isSvg?e.image:"<img alt='' src='".concat(e.image,"' />"):"","\n ").concat(oe?"<span class='logo-text text'>".concat(oe,"</span>"):"","\n</div> \n "):""]}var o}))}));return function(){return e.apply(this,arguments)}}(),Jr=function(){var e=Hr((function(){var e;return Zr(this,(function(t){switch(t.label){case 0:return[4,Qr()];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)}}(),Wr=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 Kr(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Vr(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Kr(a,o,r,i,l,"next",e)}function l(e){Kr(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Xr(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var $r=function(){var e=Vr((function(e){var t,n,o,r,a,i,l,s,c;return Xr(this,(function(u){switch(u.label){case 0:return o=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,Jr()];case 1:return r=u.sent(),[2,"\n <div>\n ".concat(r,'\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,o,r,a,i,l,s;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(o=e.itemCode)&&void 0!==o?o:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</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!==(s=null===(n=e.purchasePrice)||void 0===n?void 0:n.toLocaleString())&&void 0!==s?s:"","</td>\n </tr> \n ")})).join(""):"","\n ").concat(o>0?Array(o).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!==(s=null==e?void 0:e.remarks)&&void 0!==s?s:"",'\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!==(c=null==e?void 0:e.responsiblePerson)&&void 0!==c?c:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Checked By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),ea=function(){var e=Vr((function(e){var t;return Xr(this,(function(n){switch(n.label){case 0:return[4,$r(e)];case 1:return t=n.sent(),Wr(Yr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ta(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function na(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){ta(a,o,r,i,l,"next",e)}function l(e){ta(a,o,r,i,l,"throw",e)}i(void 0)}))}}function oa(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var ra=function(){var e=na((function(e){var t,n,o,r,a,i,l,s,c;return oa(this,(function(u){switch(u.label){case 0:return o=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,Jr()];case 1:return r=u.sent(),[2,"\n <div>\n ".concat(r,'\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,o,r,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!==(o=e.itemDescription)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(null!==(r=e.batchNumber)&&void 0!==r?r:"",'</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(o>0?Array(o).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!==(s=null==e?void 0:e.remarks)&&void 0!==s?s:"",'\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!==(c=null==e?void 0:e.responsiblePerson)&&void 0!==c?c:"",'</b>\n </td>\n <td valign="middle" colspan="3" style="border:0;padding-top: 15pt;">\n Authorized By:<br/>\n \n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),aa=function(){var e=na((function(e){var t;return oa(this,(function(n){switch(n.label){case 0:return[4,ra(e)];case 1:return t=n.sent(),Wr(Yr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ia(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function la(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){ia(a,o,r,i,l,"next",e)}function l(e){ia(a,o,r,i,l,"throw",e)}i(void 0)}))}}function sa(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var ca=function(){var e=la((function(e){var t,n,o,r,a,i,l,s;return sa(this,(function(c){switch(c.label){case 0:return o=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,Jr()];case 1:return r=c.sent(),[2,"\n <div>\n ".concat(r,'\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!==(s=e.authorizedBy)&&void 0!==s?s:" ",'</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,o,r,a,i,l,s;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(o=e.itemCode)&&void 0!==o?o:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</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!==(s=e.quantityIssuedUoM)&&void 0!==s?s:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(o>0?Array(o).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle"> </td>\n <td valign="middle"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n <td valign="middle" class="center"> </td>\n </tr>'})).join(""):"",'\n <tr class="footer-field">\n <td valign="middle" colspan="3">Issue date:</td>\n <td valign="middle" colspan="4">Receipt date:</td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3">Name & Signature receiver:</td>\n <td valign="middle" colspan="4">Name & Signature issuer:</td>\n </tr>\n </table>\n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),ua=function(){var e=la((function(e){var t;return sa(this,(function(n){switch(n.label){case 0:return[4,ca(e)];case 1:return t=n.sent(),Wr(Yr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function da(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=((0,o.useConfig)().config,function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){da(a,o,r,i,l,"next",e)}function l(e){da(a,o,r,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,r,a,i,l,s,c;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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,r=null,t.requisitionStockOperationUuid&&(z(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="ws/rest/v1/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=".concat(d),p=new AbortController,(0,o.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="ws/rest/v1/stockmanagement/stockiteminventory".concat(L(e)),n=new AbortController;return(0,o.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(r=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,qr(t,t.stockOperationItems,e,n,r)]);case 1:return(s=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,ea(s)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,aa(s)];case 4:return u.sent(),[3,7];case 5:return[4,ua(s)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(s),u.label=9;case 9:return[3,11];case 10:return c=u.sent(),console.info(c),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}());return l().createElement(a.zxk,{onClick:r,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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){ma(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function Aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ga=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,renderIcon:function(e){return l().createElement(ct.bS,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Aa(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 fa=function(e){var t=e.operation,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:r,renderIcon:function(e){return l().createElement(be.aP,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){_a(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function va(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=e.operations,o=(0,E.useTranslation)().t,r={uuid:"",name:"Stock Issue",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(a.zxk,{onClick:function(){La(t,!1,r,n,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(ct.ei,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){va(e,t,n[t])}))}return e}({size:16},e))}},o("issueStock","Issue Stock "))};var ha=n(2496),ya={};ya.styleTagTransform=b(),ya.setAttributes=g(),ya.insert=p().bind(null,"head"),ya.domAPI=d(),ya.insertStyleElement=f(),c()(ha.Z,ya);const ka=ha.Z&&ha.Z.locals?ha.Z.locals:void 0;function Ca(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ea(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function wa(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Ea(a,o,r,i,l,"next",e)}function l(e){Ea(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Sa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Sa(e,t,n[t])}))}return e}function Oa(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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function xa(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ca(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ca(e,t):void 0}}(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 Da(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const Na=function(e){var t,n,r,s,c,u,d,m,p,A,g,_,f,v,b,h,y,k,C,w,S,B,O,x,D,N,I,T,P,U,j,L,F,z,R,M,G,H,Z,Y,J,W,K,V,X,$,ee,te,ne,oe,re,ae,ie,le,se,ce,ue,de,me,pe,Ae,ge,_e,fe,ve,be,he,ye,ke,Ce,Ee,we,Se,Be=(0,E.useTranslation)().t,Oe=e.isEditing,xe=e.canEdit,De=e.canPrint,Ne=function(e){var t=xr((0,i.useState)(!0),2),n=t[0],o=t[1],r=xr((0,i.useState)(!1),2),a=r[0],l=r[1],s=xr((0,i.useState)(),2),c=s[0],u=s[1];return(0,i.useEffect)((function(){o(!0),function(e,t,n){return Br.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),o(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:c}}(e),Ie=Ne.isLoading,Te=Ne.isError,Pe=Ne.result,Ue=xa((0,i.useState)(null==e?void 0:e.isEditing),2),je=Ue[0],Le=Ue[1],Fe=xa((0,i.useState)(null==e?void 0:e.isEditing),2),ze=Fe[0],Re=Fe[1],Me=xa((0,i.useState)(0),2),qe=Me[0],Ge=Me[1];if(Ie)return l().createElement(a.MHR,null);if(Te)return Q(),void(0,o.showToast)({kind:"error",title:Be("error","Error"),description:Be("errorLoadingStockOperation","Error loading stock item"),millis:5e3,critical:!0});var He=[{name:"".concat(Oe?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(Ro,Oa(Ba({},e),{isEditing:"Stock Issue"===(null==e||null===(r=e.operation)||void 0===r?void 0:r.name)?!Oe:Oe,setup:Pe,canEdit:"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?!xe:xe,model:Oe||"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,onSave:wa((function(){return Da(this,(function(e){return Le(!0),Ge(1),[2]}))})),operation:e.operation}))},{name:Be("stockItems","Stock Items"),component:l().createElement(_r,Oa(Ba({},e),{isEditing:Oe,setup:Pe,canEdit:xe,model:Oe||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,onSave:wa((function(){return Da(this,(function(e){return Re(!0),Ge(2),[2]}))}))})),disabled:!(Oe||je)},{name:(null==Pe?void 0:Pe.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(Cr,Oa(Ba({},e),{isEditing:Oe,setup:Pe,canEdit:xe,locked:!1,model:Oe?null==e?void 0:e.model:null==Pe?void 0:Pe.dto,requiresDispatchAcknowledgement:Oe?"return"===(null==e||null===(d=e.model)||void 0===d?void 0:d.operationType)||"issuestock"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType):Pe.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=wa((function(t){return Da(this,(function(n){switch(n.label){case 0:return[4,ja(t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){Ge(1)},onComplete:wa((function(){return Da(this,(function(t){switch(t.label){case 0:return[4,Fa("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:wa((function(){return Da(this,(function(t){switch(t.label){case 0:return[4,Fa("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:wa((function(){return Da(this,(function(t){switch(t.label){case 0:return[4,Fa("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||ze)}];return l().createElement(l().Fragment,null,Oe||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},Oe&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:ka.textHeading},Be("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(null==e||null===(p=e.model)||void 0===p?void 0:p.status))}},null==e||null===(A=e.model)||void 0===A?void 0:A.status)),l().createElement("div",{className:ka.statusContainer},(null==e||null===(g=e.model)||void 0===g?void 0:g.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("started","Started"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(_=e.model)||void 0===_?void 0:_.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(f=e.model)||void 0===f?void 0:f.creatorFamilyName," ",null==e||null===(v=e.model)||void 0===v?void 0:v.creatorGivenName))),(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("submitted","Submitted"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(h=e.model)||void 0===h?void 0:h.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(y=e.model)||void 0===y?void 0:y.submittedByFamilyName," ",null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByGivenName))),(null==e||null===(C=e.model)||void 0===C?void 0:C.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("dispatched","Dispatched"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedByFamilyName," ",null==e||null===(B=e.model)||void 0===B?void 0:B.dispatchedByGivenName))),(null==e||null===(O=e.model)||void 0===O?void 0:O.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("returned","Returned"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(D=e.model)||void 0===D?void 0:D.returnedByFamilyName," ",null==e||null===(N=e.model)||void 0===N?void 0:N.returnedByGivenName),l().createElement("span",{className:ka.text},null==e||null===(I=e.model)||void 0===I?void 0:I.returnReason))),(null==e||null===(T=e.model)||void 0===T?void 0:T.completedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("completed","Completed"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(U=e.model)||void 0===U?void 0:U.completedByFamilyName," ",null==e||null===(j=e.model)||void 0===j?void 0:j.completedByGivenName))),"CANCELLED"===(null==e||null===(L=e.model)||void 0===L?void 0:L.status)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("cancelled","Cancelled"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(F=e.model)||void 0===F?void 0:F.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(z=e.model)||void 0===z?void 0:z.cancelledByFamilyName," ",null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByGivenName,l().createElement("span",{className:ka.text},null==e||null===(M=e.model)||void 0===M?void 0:M.cancelReason)))),"REJECTED"===(null==e||null===(G=e.model)||void 0===G?void 0:G.status)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Be("rejected","Rejected"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,o.formatDate)((0,o.parseDate)(null==e||null===(H=e.model)||void 0===H?void 0:H.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedByFamilyName," ",null==e||null===(Y=e.model)||void 0===Y?void 0:Y.rejectedByGivenName,l().createElement("span",null,null==e||null===(J=e.model)||void 0===J?void 0:J.rejectionReason)))))),(!(null==e||null===(K=e.model)||void 0===K||null===(W=K.permission)||void 0===W?void 0:W.canEdit)&&((null==e||null===(X=e.model)||void 0===X||null===(V=X.permission)||void 0===V?void 0:V.canApprove)||(null==e||null===(ee=e.model)||void 0===ee||null===($=ee.permission)||void 0===$?void 0:$.canReceiveItems))||(null==e||null===(ne=e.model)||void 0===ne||null===(te=ne.permission)||void 0===te?void 0:te.canEdit)||De||(null==e||null===(re=e.model)||void 0===re||null===(oe=re.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===(ie=e.model)||void 0===ie||null===(ae=ie.permission)||void 0===ae?void 0:ae.canEdit)&&(null==e||null===(se=e.model)||void 0===se||null===(le=se.permission)||void 0===le?void 0:le.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(ce=e.model)||void 0===ce?void 0:ce.operationTypeName)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Ir,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ga,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Pr,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jr,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Fr,{operation:null==e?void 0:e.model}))),!(null==e||null===(Ae=e.model)||void 0===Ae||null===(pe=Ae.permission)||void 0===pe?void 0:pe.canEdit)&&(null==e||null===(_e=e.model)||void 0===_e||null===(ge=_e.permission)||void 0===ge?void 0:ge.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(fa,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jr,{operation:null==e?void 0:e.model}))),(null==e||null===(ve=e.model)||void 0===ve||null===(fe=ve.permission)||void 0===fe?void 0:fe.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Fr,{operation:null==e?void 0:e.model})),(null==e||null===(he=e.model)||void 0===he||null===(be=he.permission)||void 0===be?void 0:be.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ba,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(ke=e.model)||void 0===ke||null===(ye=ke.permission)||void 0===ye?void 0:ye.isRequisitionAndCanIssueStock)||(null==e||null===(Ce=e.model)||void 0===Ce?void 0:Ce.operationType)===Kn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Kn.REQUISITION_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Kn.RECEIPT_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Kn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(pa,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Po,null,l().createElement(Wn,{tabs:He,selectedIndex:qe,onChange:Ge})))};var Ia=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function Ta(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function Pa(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Ta(a,o,r,i,l,"next",e)}function l(e){Ta(a,o,r,i,l,"throw",e)}i(void 0)}))}}function Ua(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var ja=function(){var e=Pa((function(e,t,n,r,a){var i,l,s,c;return Ua(this,(function(r){switch(r.label){case 0:i=e,r.label=1;case 1:return r.trys.push([1,3,,4]),"requisition"===n.operationType&&delete i.destinationName,[4,(t?M:R)(i)];case 2:return(null==(l=r.sent())?void 0:l.data)&&(Ia("ws/rest/v1/stockmanagement/stockoperation"),(0,o.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 s=r.sent(),c=le(s),(0,o.showNotification)({description:c.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,o,r,a){return e.apply(this,arguments)}}(),La=function(e,t,n,o,r){Y("".concat(t?"Edit":"New: "," ").concat(t?null==e?void 0:e.operationTypeName:null==n?void 0:n.name),l().createElement(Na,{model:e,onSave:function(e){return ja(e,t,n,o,r)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},Fa=function(){var e=Pa((function(e,t,n){var r;return Ua(this,(function(a){return r=(0,o.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return r()}}),[2]}))}));return function(t,n,o){return e.apply(this,arguments)}}();function za(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Ra=function(e){var t,n,o=e.operationUuid,r=e.operationNumber,s=e.model,c=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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return za(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?za(e,t):void 0}}(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];o&&!d&&z(o).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!=s?s:d,!0,p,c,!1)}},r||"".concat(null==s?void 0:s.operationNumber)))};function Ma(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function qa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||Ga(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ga(e,t){if(e){if("string"==typeof e)return Ma(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ma(e,t):void 0}}const Ha=function(e){var t=e.conceptUuid,n=e.onFilterChange,o=e.filterName,r=xt(t),s=r.items,c=r.isLoading,u=qa((0,i.useState)(!1),2),d=u[0],m=u[1],p=qa((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),o){case te.STATUS:g(qn.map((function(e){return{uuid:e,display:e}})));break;case te.SOURCES:var e;(null==s||null===(e=s.answers)||void 0===e?void 0:e.length)&&(g(function(e){if(Array.isArray(e))return Ma(e)}(t=s.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Ga(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m(c));break;case te.OPERATION:Bt().then((function(e){var t;m(!0),(null===(t=e.data)||void 0===t?void 0:t.results.length)&&g(e.data.results.map((function(e){return{uuid:e.uuid,display:e.name}}))),m(!1)}))}var t;m(!1)}),[o,c,s.answers]),d?l().createElement(a.iTo,null):l().createElement(a.NUq,{className:Fn.filtersAlign,id:"multiSelect",label:o,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})),o)},placeholder:"Filter by ".concat(o),style:{minWidth:"auto",width:"auto"}})};function Za(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Ya(e,t,n[t])}))}return e}function Ja(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Wa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Za(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Za(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ka=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}}),[]),r=Un({v:U.Full,totalCount:!0}),s=r.items,c=r.tableHeaders,u=r.currentPage,d=r.pageSizes,m=r.totalItems,p=r.goTo,A=r.currentPageSize,g=r.setPageSize,_=r.isLoading,f=Wa((0,i.useState)(s),2),v=f[0],b=f[1],h=Wa((0,i.useState)(null),2),y=h[0],k=h[1],C=Wa((0,i.useState)(null),2),w=C[0],S=C[1],B=Wa((0,i.useState)([]),2),O=B[0],x=B[1],D=Wa((0,i.useState)([]),2),N=D[0],I=D[1],T=Wa((0,i.useState)([]),2),P=T[0],j=T[1],L=(0,o.useConfig)(),F=function(){var e=(0,o.showModal)("stock-operation-dialog",{title:"complete",operation:n,requireReason:"",closeModal:function(){return e()}});Ia("ws/rest/v1/stockmanagement/stockoperation")};(0,i.useEffect)((function(){R()}),[y,w,O,N,P,u,A]);var z=(0,i.useCallback)((function(e,t){t===te.SOURCES?x(e):t===te.OPERATION?j(e):I(e)}),[]),R=function(){var e=s;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)}))),N.length>0&&(e=e.filter((function(e){return N.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==v?void 0:v.map((function(t,o){var r,i,s,c,u,d,m,p,A,g,_,f,b,h,y,k,C,E,w;return Ja(Qa({},t),{id:null==t?void 0:t.uuid,key:"key-".concat(null==t?void 0:t.uuid),operationTypeName:"".concat(null==t?void 0:t.operationTypeName),operationNumber:l().createElement(Ra,{model:v[o],operations:e}),status:"".concat(null==t?void 0:t.status),source:"".concat(null!==(r=null==t?void 0:t.sourceName)&&void 0!==r?r:""),destination:"".concat(null!==(i=null==t?void 0:t.destinationName)&&void 0!==i?i:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==t?void 0:t.sourceName)&&void 0!==s?s:""," ",(null==t?void 0:t.sourceName)&&(null==t?void 0:t.destinationName)?l().createElement(be.ol,{size:16}):""," ",null!==(c=null==t?void 0:t.destinationName)&&void 0!==c?c:""," "),responsiblePerson:"".concat(null!==(d=null!==(u=null==t?void 0:t.responsiblePersonFamilyName)&&void 0!==u?u:null==t?void 0:t.responsiblePersonOther)&&void 0!==d?d:""," ").concat(null!==(m=null==t?void 0:t.responsiblePersonGivenName)&&void 0!==m?m:""),operationDate:K(null==t?void 0:t.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Created"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.dateCreated))," ","By",l().createElement("span",{className:"action-by"},null!==(p=t.creatorFamilyName)&&void 0!==p?p:""," ",null!==(A=t.creatorGivenName)&&void 0!==A?A:""))),"NEW"!==(null==t?void 0:t.status)&&(null==t?void 0:t.status)!==zn&&(null==t?void 0:t.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Submitted"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.submittedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(g=t.submittedByFamilyName)&&void 0!==g?g:""," ",null!==(_=t.submittedByGivenName)&&void 0!==_?_:""))),(null==t?void 0:t.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Completed"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.completedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(f=t.completedByFamilyName)&&void 0!==f?f:""," ",null!==(b=t.completedByGivenName)&&void 0!==b?b:""))),(null==t?void 0:t.status)===Rn&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Cancelled"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.cancelledDate))," ","By",l().createElement("span",{className:"action-by"},null!==(h=t.cancelledByFamilyName)&&void 0!==h?h:""," ",null!==(y=t.cancelledByGivenName)&&void 0!==y?y:""),l().createElement("p",null,t.cancelReason))),(null==t?void 0:t.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==t?void 0:t.rejectedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(k=t.rejectedByFamilyName)&&void 0!==k?k:""," ",null!==(C=t.rejectedByGivenName)&&void 0!==C?C:""),l().createElement("p",null,t.rejectionReason))),(null==t?void 0:t.status)===zn&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Returned"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(E=t.returnedByFamilyName)&&void 0!==E?E:""," ",null!==(w=t.returnedByGivenName)&&void 0!==w?w:""),l().createElement("p",null,t.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:F}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){La(v[o],!0,n,e,!1)}}))})}))}),[F,v,n,e]);return _?l().createElement(a.gqd,{className:Fn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:Fn.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:c,isSortable:!0,useZebraStyles:!0,render:function(n){var r=n.rows,i=n.headers,c=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:Fn.toolbarContent},l().createElement(a.Ys1,{className:Fn.patientListSearch,expanded:!0,onChange:m,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:Fn.filterContainer},l().createElement(a.Mtg,{className:Fn.dateAlign,datePickerType:"range",dateFormat:X,value:[y,w],onChange:function(e){var t=Wa(e,2);!function(e){var t=Wa(e,2),n=t[0],o=t[1];n&&(k(n),w&&n&&w<n&&S(n)),o&&(S(o),y&&o&&y>o&&k(o))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:V}),l().createElement(a.aj6,{placeholder:V})),l().createElement(Ha,{conceptUuid:L.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:z}),l().createElement(Ha,{filterName:te.STATUS,onFilterChange:z}),l().createElement(Ha,{filterName:te.OPERATION,onFilterChange:z})),l().createElement(Zn,{onOperationTypeSelected:function(t){La(ko(),!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,Ja(Qa({},c({header:e,isSortable:e.isSortable})),{className:o.isDesktop?Fn.desktopHeader:Fn.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,r.map((function(e,n){var r,c,u,m,p,A,g,_,f,b,h,y,k,C,E,w,S,B,O,x,D,N,I,T,P,U,j,L,F,z;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Qa({className:o.isDesktop?Fn.desktopRow:Fn.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===(r=v[n])||void 0===r?void 0:r.dateCreated)?K(null===(c=v[n])||void 0===c?void 0:c.dateCreated):""," ",(null===(u=v[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(m=v[n])||void 0===m?void 0:m.dateCreated)?null===(p=v[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=v[n])||void 0===A?void 0:A.completedDate)?K(null===(g=v[n])||void 0===g?void 0:g.completedDate):""," ",(null===(_=v[n])||void 0===_?void 0:_.completedDate)?"By":""," ",(null===(f=v[n])||void 0===f?void 0:f.completedDate)?null===(b=v[n])||void 0===b?void 0:b.creatorFamilyName:""),l().createElement(a.agF,null,(null===(h=v[n])||void 0===h?void 0:h.stockOperationItems)?null===(y=v[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=v[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=v[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=v[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?K(null===(w=v[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=v[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(B=v[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=v[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=v[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?K(null===(D=v[n])||void 0===D?void 0:D.completedDate):""," ",(null===(N=v[n])||void 0===N?void 0:N.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(I=v[n])||void 0===I?void 0:I.completedDate)?"By":""," ",(null===(T=v[n])||void 0===T?void 0:T.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=v[n])||void 0===P?void 0:P.completedDate)?null===(U=s[n])||void 0===U?void 0:U.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=v[n])||void 0===j?void 0:j.stockOperationItems)?null===(L=v[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=v[n])||void 0===F?void 0:F.stockOperationItems)?null===(z=v[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.quantity}))[1]:""))))))})))),0===r.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:Fn.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:Fn.paginationOverride}))},Va=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ka,null))};var Xa={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function $a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ei(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ni(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const oi=function(e){var t,n,r=function(e){var t=ei((0,i.useState)(e||{v:U.Default,startIndex:0}),2),n=t[0],r=(t[1],function(e){var t="ws/rest/v1/drug".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(n)),a=r.items.results,l=r.isLoading,s=ei((0,i.useState)(""),2),c=s[0],u=s[1],d=ei((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=ei((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],_=A[1];return(0,i.useEffect)((function(){}),[c,m,g]),{drugList:a,setLimit:p,setRepresentation:_,setSearchString:u,isLoading:l}}(),s=r.isLoading,c=r.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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ti(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ti(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.name.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return l().createElement("div",null,l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,r=o.onChange,i=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:p||[],initialSelectedItem:null!==(n=null==c?void 0:c.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:ni,onChange:function(t){var n;null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),s&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};var ri=uo.z.string().max(255).nullish(),ai=uo.z.object({isDrug:uo.z.boolean(),drugUuid:uo.z.string().nullish(),drugName:uo.z.string().nullish(),commonName:ri,acronym:ri,hasExpiration:uo.z.boolean(),expiryNotice:uo.z.coerce.number().nullish(),uuid:uo.z.string().nullish(),conceptUuid:uo.z.string().nullish(),conceptName:uo.z.string().nullish(),preferredVendorUuid:uo.z.string().nullish(),preferredVendorName:uo.z.string().nullish(),purchasePrice:uo.z.number().nullish(),purchasePriceUoMUuid:uo.z.string().nullish(),purchasePriceUoMName:uo.z.string().nullish(),categoryUuid:uo.z.string().nullish(),categoryName:uo.z.string().nullish(),dispensingUnitUuid:uo.z.string().nullish(),dispensingUnitName:uo.z.string().nullish(),dispensingUnitPackagingUoMUuid:uo.z.string().nullish(),dispensingUnitPackagingUoMName:uo.z.string().nullish(),defaultStockOperationsUoMUuid:uo.z.string().nullish(),defaultStockOperationsUoMName:uo.z.string().nullish(),reorderLevel:uo.z.number().nullish(),reorderLevelUoMUuid:uo.z.string().nullish(),reorderLevelUoMName:uo.z.string().nullish(),dateCreated:uo.z.coerce.date().nullish(),creatorGivenName:uo.z.string().nullish(),creatorFamilyName:uo.z.string().nullish(),voided:uo.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function ii(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const li=function(e){return l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r=t.field,i=r.onChange,s=r.value,c=r.ref;return l().createElement(a.SYO,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){ii(e,t,n[t])}))}return e}({},e),o=null!=(o={onChange:function(t,n,o){i(t,n,o),e.onChange&&e.onChange(t,n,o)},id:e.name,ref:c,defaultSelected:e.id,value:s})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,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:s===t.value,onChange:function(){return i(t.value)},ref:c})})))}})},si=function(e){return l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o,r,i,s=t.field,c=s.onChange,u=s.value,d=s.ref;return l().createElement(a.Y2U,{id:"".concat(e.name,"-").concat(null===(n=e.row)||void 0===n?void 0:n.id,"-").concat(null===(o=e.row)||void 0===o?void 0:o.uuid),value:null!==(i=null===(r=e.row)||void 0===r?void 0:r.factor)&&void 0!==i?i:u,ref:d,onChange:function(t,n){c(t,n),e.onChange&&e.onChange(t,n)}})}})},ci=function(e){var t=xt((0,o.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i=t.field,s=i.onChange,c=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),s(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!==(r=null==n||null===(o=n.find((function(e){return e.uuid===c})))||void 0===o?void 0:o.display)&&void 0!==r?r:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},ui=function(e){var t=nn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i=t.field,s=i.onChange,c=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,o;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),s(null===(o=t.selectedItem)||void 0===o?void 0:o.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!==(r=null==n||null===(o=n.find((function(e){return e.uuid===c})))||void 0===o?void 0:o.name)&&void 0!==r?r:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},di=function(e){var t=xt((0,o.useConfig)().stockItemCategoryUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i=t.field,s=i.onChange,c=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,o;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),s(null===(o=t.selectedItem)||void 0===o?void 0:o.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!==(r=null==n||null===(o=n.find((function(e){return e.uuid===c})))||void 0===o?void 0:o.display)&&void 0!==r?r:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},mi=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits[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(so.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=n.uuid)&&void 0!==t?t:"",render:function(t){var o,r=t.field,i=r.onChange,s=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!==(o=e.packagingUnits)&&void 0!==o?o:[],onChange:function(t){var n,o;null===(n=e.onDispensingUnitPackagingUoMUuidChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),i(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.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:s})}})):l().createElement(l().Fragment,null)},pi=function(e){var t,n,o,r,i,s,c,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=Je(d),_=g.item,f=g.isLoading;return _&&_.packagingUnits&&_.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(mi,{name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(mi,{name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),f?l().createElement(a.iJ5,null):l().createElement(si,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(c=_.reorderLevel)&&void 0!==c?c:"",invalidText:p.reorderLevel&&(null==p||null===(o=p.reorderLevel)||void 0===o?void 0:o.message)}),l().createElement(mi,{name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(r=p.reorderLevelUoMUuid)||void 0===r?void 0:r.message)}),f?l().createElement(a.iJ5,null):l().createElement(si,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price"),value:null!==(u=_.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(mi,{name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit"),placeholder:A("notSet","Not Set"),isLoading:f,packagingUnits:_.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(s=p.purchasePriceUoMUuid)||void 0===s?void 0:s.message)})):l().createElement(l().Fragment,null)};function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const gi=function(e){var t,n,r=function(e){var t="ws/rest/v1/concept".concat(L({})),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(),s=r.items.results,c=r.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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ai(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ai(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?s:s.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,s]);return c?l().createElement(a.znL,null):l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,o=n.onChange,r=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),o(t.selectedItem.uuid)},initialSelectedItem:(null==s?void 0:s.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:r,invalid:e.invalid,invalidText:e.invalidText})}})};var _i=[{label:"Drug",value:!0},{label:"Other",value:!1}],fi=[{label:"Yes",value:!0},{label:"No",value:!1}];function vi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function bi(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}function hi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var yi=(0,i.forwardRef)((function(e){var t,n,o,r,s,c,u,d,m,p,A,g=e.model,_=e.onSave,f=e.isEditing,v=e.handleTabChange,b=(0,E.useTranslation)().t,h=(0,so.cI)({defaultValues:g,mode:"all",resolver:(0,co.F)(ai)}),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(o,r){var a=e.apply(t,n);function i(e){bi(a,o,r,i,l,"next",e)}function l(e){bi(a,o,r,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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,_(e)];case 1:return t.sent(),v(1),Ia("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)}}(),B=hi((0,i.useState)(!1),2),O=B[0],x=B[1],D=hi((0,i.useState)(!1),2),I=D[0],T=D[1],P=hi((0,i.useState)(!1),2),U=P[0],j=P[1];return(0,i.useEffect)((function(){var e,t;T(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(N.formContainer," ").concat(N.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(li,{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){T(e)},options:_i})),I&&l().createElement(oi,{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!=I&&!I&&l().createElement(gi,{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===(o=w.drugUuid)||void 0===o?void 0:o.message)}),l().createElement(Bo,{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===(r=w.commonName)||void 0===r?void 0:r.message)}),l().createElement(Bo,{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===(s=w.acronym)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(li,{name:"hasExpiration",controllerName:"hasExpiration",control:k,legendText:"",invalid:!!w.hasExpiration,invalidText:w.hasExpiration&&(null==w||null===(c=w.hasExpiration)||void 0===c?void 0:c.message),onChange:function(e){j(e)},options:fi})),U&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(si,{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(ui,{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(di,{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)}),I&&l().createElement(ci,{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)}),I&&f&&l().createElement(pi,{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:fr.vc},O?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},b("cancel","Cancel"))))}));const ki=yi;function Ci(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ei(e){var t,n,r=function(e){console.warn("Rules filter: "+JSON.stringify(e));var t="ws/rest/v1/stockmanagement/stockrule".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(e),a=r.items,l=r.isLoading,s=r.isError,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ci(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ci(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,_=(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:s,setPageSize:d,tableHeaders:_}}var wi=n(4563),Si={};Si.styleTagTransform=b(),Si.setAttributes=g(),Si.insert=p().bind(null,"head"),Si.domAPI=d(),Si.insertStyleElement=f(),c()(wi.Z,Si);const Bi=wi.Z&&wi.Z.locals?wi.Z.locals:void 0;function Oi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Oi(e,t,n[t])}))}return e}function Di(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Ni(e,t,n[t])}))}return e}function Ti(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Pi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Di(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Di(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ui=function(e){var t,n,r=e.model,s=e.stockItemUuid,c=(0,E.useTranslation)().t;console.warn("Got stock id: ",s);var u=Pi((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),d=u[0],m=u[1];(0,i.useEffect)((function(){m({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:s})}),[s]);var p=Qe(d).items,A=Et({v:U.Default}).locations.results,g=wt({v:U.Default}),_=g.items,f=(g.isError,g.isLoading,Pi((0,i.useState)(),2)),v=f[0],b=f[1];(0,i.useEffect)((function(){if(null!=r&&0!=Object.keys(r).length){r.dateCreated,r.creatorGivenName,r.creatorFamilyName;var e=Ii({},function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(r,["dateCreated","creatorGivenName","creatorFamilyName"]));b(e)}}),[r]);var h=(0,i.useCallback)((function(e){e.preventDefault(),r&&(v.uuid=r.uuid),s&&(v.stockItemUuid=s),function(e){var t=null!=e.uuid,n="ws/rest/v1/stockmanagement/stockrule".concat(t?"/"+e.uuid:""),r=new AbortController;return(0,o.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:r.signal,body:xi({},e)})}(v).then((function(){(0,o.showToast)({critical:!0,title:c("addedRule","Add Rule"),kind:"success",description:c("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,o.showNotification)({title:c("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[v,r,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:Bi.section},l().createElement("section",{className:Bi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:c("location","Location"),id:"location",value:(null==v?void 0:v.locationUuid)?v.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.uuid===e.target.value}));b(Ti(Ii({},v),{locationUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))),l().createElement("section",{className:Bi.section},l().createElement(a.oil,{id:"name",type:"text",labelText:c("name","Rule Name"),size:"md",onChange:function(e){r&&(r.name=e.target.value),b(Ti(Ii({},v),{name:e.target.value}))},value:null==r?void 0:r.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Bi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:c("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==v?void 0:v.stockItemPackagingUOMUuid)?v.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));b(Ti(Ii({},v),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:Bi.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:c("quantity","Quantity Threshold"),size:"md",onChange:function(e){r&&(r.quantity=Number(e.target.value)),b(Ti(Ii({},v),{quantity:Number(e.target.value)}))},value:null==r?void 0:r.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:Bi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:c("alertRole","Alert Role"),id:"alertRole",value:(null==v?void 0:v.alertRole)?v.alertRole:"",onChange:function(e){var t=null==_?void 0:_.results.find((function(t){return t.display===e.target.value}));b(Ti(Ii({},v),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseAlertRole","Choose an Alert Role")}),null==_||null===(t=_.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:Bi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:c("mailRole","Mail Role"),id:"mailRole",value:(null==v?void 0:v.mailRole)?v.mailRole:"",onChange:function(e){var t=null==_?void 0:_.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),b(Ti(Ii({},v),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:c("chooseMailRole","Choose a Mail Role")}),null==_||null===(n=_.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:Bi.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:c("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){r&&(r.evaluationFrequency=Number(e.target.value)),b(Ti(Ii({},v),{evaluationFrequency:Number(e.target.value)}))},value:null==r?void 0:r.evaluationFrequency,placeholder:"e.g 30 Minutes"}),l().createElement(a.oil,{id:"actionFrequency",type:"number",labelText:c("actionFrequency","Notification Frequency (Minutes)"),size:"md",onChange:function(e){r&&(r.actionFrequency=Number(e.target.value)),b(Ti(Ii({},v),{actionFrequency:Number(e.target.value)}))},value:null==r?void 0:r.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:Bi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==v?void 0:v.enabled);b(Ti(Ii({},v),{enabled:n}))},checked:null==v?void 0:v.enabled,labelText:"Enabled ?",value:null==r?void 0:r.enabled,id:"chk-ruleEnabled"}))),l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Bi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==v?void 0:v.enableDescendants);b(Ti(Ii({},v),{enableDescendants:n}))},name:"appliesToChildren",checked:null==v?void 0:v.enableDescendants,value:null==r?void 0:r.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},c("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},c("save","Save")))))},ji=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Ui,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:o,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var Li=n(4907),Fi={};Fi.styleTagTransform=b(),Fi.setAttributes=g(),Fi.insert=p().bind(null,"head"),Fi.domAPI=d(),Fi.insertStyleElement=f(),c()(Li.Z,Fi);const zi=Li.Z&&Li.Z.locals?Li.Z.locals:void 0;function Ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Mi=function(e){var t,n=e.stockItemUuid,r=function(e){var t="ws/rest/v1/stockmanagement/stockrule".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}({v:U.Default,totalCount:!0,stockItemUuid:n}),i=r.items,s=r.isLoading,c=r.isError;return s||c?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:zi.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Ri(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Ri(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ri(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),itemToString:function(e){return e?e.display:"Not Set"},type:"inline",size:"sm"})))};function qi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hi=function(e){var t,n,r=e.uuid,s=(0,E.useTranslation)().t,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return qi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=l().useCallback((function(){var e=(0,o.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:r,onConfirmation:function(){var t,n,a;(t=r,n="ws/rest/v1/stockmanagement/stockrule/".concat(t),a=new AbortController,(0,o.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){d(!1),(0,o.showToast)({critical:!0,title:s("deletingRule","Delete Rule"),kind:"success",description:s("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,o.showNotification)({title:s("errorDeletingRule', 'error deleting a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[s,r]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:s("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]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Gi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Yi=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),o=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Ui,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return o()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Zi(e,t,n[t])}))}return e}({size:16},e))}})};function Qi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ji(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Qi(e,t,n[t])}))}return e}function Wi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ki=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t);console.warn("Found stock uuid: "+t);var r=Ei({v:U.Default,totalCount:!0,stockItemUuid:t}),s=r.isLoading,c=r.items,u=r.tableHeaders,d=r.currentPage,m=r.currentPageSize,p=r.pageSizes,A=r.totalItems,g=r.setPageSize,_=r.goTo,f=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(e,t){var n,o;return Wi(Ji({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated: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!==(o=null==e?void 0:e.packagingUomName)&&void 0!==o?o:""),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(Yi,{data:c[t],stockItemUuid:c[t].stockItemUuid}),l().createElement(Hi,{uuid:c[t].uuid}))})}))}),[c]);return s?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Fn.tableOverride},l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:f,headers:u,isSortable:!0,useZebraStyles:!0,render:function(e){var r=e.rows,i=e.headers,s=e.getHeaderProps,c=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:Fn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Mi,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(ji,{stockItemUuid:t}))),l().createElement(a.iA_,c(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Wi(Ji({},s({header:e,isSortable:e.isSortable})),{className:o.isDesktop?Fn.desktopHeader:Fn.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,r.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ji({className:o.isDesktop?Fn.desktopRow:Fn.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===r.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:Fn.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&&_(n)},className:Fn.paginationOverride}))};function Vi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function el(e){return function(e){if(Array.isArray(e))return $i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const tl=function(e){var t=xt((0,o.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(so.Qr,{name:e.controllerName,control:e.control,render:function(t){var o,r,i,s,c,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===(o=e.row)||void 0===o?void 0:o.packagingUomUuid)?el(n.some((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.packagingUomUuid)}))?[]:[{uuid:null===(r=e.row)||void 0===r?void 0:r.packagingUomUuid,display:null===(i=e.row)||void 0===i?void 0:i.packagingUomName}]).concat(el(null!=n?n:[])):n||[],onChange:function(t){var n,o;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),g((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)||"")},initialSelectedItem:void 0!==(null===(s=e.row)||void 0===s?void 0:s.packagingUomUuid)?{uuid:null===(c=e.row)||void 0===c?void 0:c.packagingUomUuid,display:null===(u=e.row)||void 0===u?void 0:u.packagingUomName}:null,selectedItem:void 0!==(null===(d=e.row)||void 0===d?void 0:d.packagingUomUuid)?{uuid:null===(m=e.row)||void 0===m?void 0:m.packagingUomUuid,display:null===(p=e.row)||void 0===p?void 0:p.packagingUomName}:null,itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText})}})};var nl=uo.z.object({id:uo.z.string().nullish(),uuid:uo.z.string().nullish(),stockItemUuid:uo.z.string().nullish(),packagingUomName:uo.z.string().nullish(),packagingUomUuid:uo.z.string().nullish(),factor:uo.z.coerce.number().nullish(),isDefaultStockOperationsUoM:uo.z.boolean().nullish(),isDispensingUnit:uo.z.boolean().nullish()}),ol=n(4158),rl={};rl.styleTagTransform=b(),rl.setAttributes=g(),rl.insert=p().bind(null,"head"),rl.domAPI=d(),rl.insertStyleElement=f(),c()(ol.Z,rl);const al=ol.Z&&ol.Z.locals?ol.Z.locals:void 0;function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ll(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){ll(e,t,n[t])}))}return e}function cl(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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ul=function(e){e.isEditing;var t=e.stockItemUuid,n=e.handleTabChange,r=function(e){var t=Xi((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],r=Xi((0,i.useState)(),2),a=r[0],l=r[1];(0,i.useEffect)((function(){o({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:a})}),[a]);var s=Qe(n),c=s.items,u=s.isLoading,d=s.isError;return{items:c.results,totalCount:c.totalCount,isLoading:u,isError:d,setStockItemUuid:l}}(),s=r.items,c=r.isLoading,u=r.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,so.cI)({defaultValues:{},mode:"all",resolver:(0,co.F)(nl)});return c?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(so.RV,A,l().createElement(a.wQF,{rows:(d=s,function(e){if(Array.isArray(e))return il(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 il(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?il(e,t):void 0}}(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,o=e.getTableProps;return l().createElement(a.xJi,{className:al.packagingTableContainer},l().createElement(a.iA_,cl(sl({},o()),{className:al.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,o;return l().createElement(a.xDH,cl(sl({},n({header:e,isSortable:!1})),{style:e.styles,key:e.key}),null!==(o=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==o?o:e.header)})),l().createElement(a.xDH,{style:{width:"70%"}}))),l().createElement(a.RMI,{className:al.packingTableBody},null==s?void 0:s.map((function(e,t){return l().createElement(dl,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(dl,{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=new AbortController;return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockitempackaginguom",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})})({factor:e.factor,packagingUomUuid:e.packagingUomUuid,stockItemUuid:t}).then((function(){return(0,o.showSnackbar)({title:m("savePackingUnitTitle","Package Unit"),subtitle:m("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"})}),(function(){(0,o.showSnackbar)({title:m("savePackagingUnitErrorTitle","Package Unit"),subtitle:m("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})),n(0)},kind:"primary",renderIcon:fr.vc},m("save","Save")))};var dl=function(e){var t=e.isEditing,n=e.row,r=e.key,i=(0,E.useTranslation)().t,s=(0,so.Gc)(),c=s.control,u=s.formState.errors;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(tl,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",control:c,invalid:!!u.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement("div",{className:al.packingTableCell},l().createElement(si,{row:n,controllerName:"factor",name:"factor",control:c,id:"".concat(n.uuid,"-").concat(r),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,r,a;e.preventDefault(),(t=n.uuid,r="ws/rest/v1/stockmanagement/stockitempackaginguom/".concat(t),a=new AbortController,(0,o.openmrsFetch)(r,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,o.showToast)({critical:!0,title:i("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:i("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,o.showNotification)({title:i("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}(e)}}))))};function ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function pl(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ml(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 Al=n(3162),gl=n(4655),_l={};_l.styleTagTransform=b(),_l.setAttributes=g(),_l.insert=p().bind(null,"head"),_l.domAPI=d(),_l.insertStyleElement=f(),c()(gl.Z,_l);const fl=gl.Z&&gl.Z.locals?gl.Z.locals:void 0;function vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function bl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function 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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||yl(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 yl(e,t){if(e){if("string"==typeof e)return vl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vl(e,t):void 0}}const kl=function(e){var t=e.columns,n=e.data,r=e.children,s=e.totalItems,c=e.goToPage,u=e.hasToolbar,d=void 0===u||u,m=(0,E.useTranslation)().t,p=(0,o.useLayoutType)(),A=hl((0,i.useState)([]),2),g=A[0],_=A[1],f="tablet"===(0,o.useLayoutType)(),v=hl((0,i.useState)(n),1)[0],b=[10,20,30,40,50],h=hl((0,i.useState)(10),2),y=h[0],k=h[1],C=(0,o.usePagination)(v,y),w=C.goTo,S=C.results,B=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){bl(e,t,n[t])}))}return e}({},t),r=null!=(r={id:n++})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))})),o));var o,r})),_(e)}),[S,g]);var O=function(e){var n=x(v,t);if("Download As CSV"==e.currentTarget.innerText){var o=new Blob([n],{type:"text/csv;charset=utf-8"});(0,Al.saveAs)(o,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var r=new Blob([n],{type:"application/json"});(0,Al.saveAs)(r,"data.json")}},x=function(e,t){var n,o=t.map((function(e){return e.header})).join(","),r=e.map((function(e){return t.map((function(t){return JSON.stringify(e[t.key])})).join(",")}));return[o].concat((n=r,function(e){if(Array.isArray(e))return vl(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||yl(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,o=e.cellsById,r=e.inputValue,a=e.getCellId;return t.filter((function(e){return n.some((function(t){var n=t.key,i=a(e,n),l=o[i].value,s=r.toLowerCase();return"boolean"!=typeof l&&(""+l).toLowerCase().includes(s)}))}))},overflowMenuOnHover:(0,o.isDesktop)(p),size:f?"lg":"md",useZebraStyles:!0},(function(e){var t=e.rows,n=e.headers,o=e.getHeaderProps,i=e.getTableProps,u=e.onInputChange;return l().createElement("div",null,l().createElement(a.xJi,{className:fl.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:fl.toolbarContent},r?r({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:dt.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:fl.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,o({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:fl.tileContainer},l().createElement(a.n9L,{className:fl.tile},l().createElement("div",{className:fl.tileContent},l().createElement("p",{className:fl.content},m("No data","No data to display")),l().createElement("p",{className:fl.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:B,pageSize:y,pageSizes:b,totalItems:s||(null==v?void 0:v.length),className:fl.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==B){if(c)return void c(n);w(n)}}})))})))};function Cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const El=function(e){var t,n=e.stockItemUuid,r=function(e){var t=pl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],a=pl((0,i.useState)(10),2),l=a[0],s=a[1],c=pl((0,i.useState)(null),2),u=c[0],d=c[1],m=pl((0,i.useState)(1),2),p=m[0],A=m[1],g=pl((0,i.useState)(),2),_=g[0],f=g[1],v=pl((0,i.useState)(),2),b=v[0],h=v[1],y=pl((0,i.useState)(),2),k=y[0],C=y[1],E=pl((0,i.useState)(),2),w=E[0],S=E[1];(0,i.useEffect)((function(){r({startIndex:p-1,v:U.Default,limit:l,q:u,totalCount:!0,stockItemUuid:_,partyUuid:b,locationUuid:k,stockBatchUuid:w})}),[u,p,l,_,b,k,w]);var B=function(e){var t="ws/rest/v1/stockmanagement/stockitemtransaction".concat(L(e)),n=(0,j.ZP)(t,o.openmrsFetch),r=n.data,a=n.error,i=n.isLoading;return{items:(null==r?void 0:r.data)||{},isLoading:i,isError:a}}(n),O=B.items,x=B.isLoading,D=B.isError,N=(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:s,pageSizes:[10,20,30,40,50],isLoading:x,isError:D,setSearchString:d,tableHeaders:N,setStockItemUuid:f,setLocationUuid:C,setPartyUuid:h,setStockBatchUuid:S}}(U.Default),s=r.isLoading,c=r.items,u=r.tableHeaders,d=r.totalCount,m=r.setCurrentPage,p=r.setStockItemUuid;(0,i.useEffect)((function(){p(n)}),[n,p]);var A=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(e){var n,o,r,a,i,s,c,u,d;return u=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Cl(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(be.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(be.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(Ra,{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===(o=e.quantity)||void 0===o?void 0:o.toLocaleString()," ").concat(null!==(s=null==e?void 0:e.packagingUomName)&&void 0!==s?s:""):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(r=-1*(null==e?void 0:e.quantity))||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""):""})?d:{},Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(d)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(d)).forEach((function(e){Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(d,e))})),u}))}),[c,t]);return s?l().createElement(a.gqd,{role:"progressbar"}):null!=(null==c?void 0:c.length)?l().createElement(kl,{columns:u,data:A,totalItems:d,goToPage:m,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},"No transactions to display")))};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=e.stockItemUuid,n=nr(U.Default),o=n.isLoading,r=n.items,s=n.totalCount,c=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==r?void 0:r.map((function(e,t){var n,o,r,a,i,l;return i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){wl(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!==(o=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==o?o:"",batch:null!==(r=e.batchNumber)&&void 0!==r?r:"",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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[r]);return o?l().createElement(a.gqd,{role:"progressbar"}):(null==r?void 0:r.length)>0?l().createElement(kl,{columns:m,data:p,totalItems:s,goToPage:c,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},d("batchInfoToDisplay","No batch information to display"))))};function Bl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ol(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||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}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Dl=function(e){var t=e.stockItemUuid,n=function(e){var t=Ol((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],o=t[1],r=Ol((0,i.useState)(10),2),a=r[0],l=r[1],s=Ol((0,i.useState)(null),2),c=s[0],u=s[1],d=Ol((0,i.useState)(1),2),m=d[0],p=d[1],A=Ol((0,i.useState)(),2),g=A[0],_=A[1],f=Ol((0,i.useState)(),2),v=f[0],b=f[1],h=Ol((0,i.useState)(),2),y=h[0],k=h[1],C=Ol((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){o({startIndex:m-1,v:U.Default,limit:a,q:c,totalCount:!0,stockItemUuid:g,partyUuid:v,locationUuid:y,stockBatchUuid:E})}),[c,m,a,g,v,y,E]);var S,B=Ze(n),O=B.items,x=B.isLoading,D=B.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:D,setSearchString:u,setStockItemUuid:_,setLocationUuid:k,setPartyUuid:b,setStockBatchUuid:w}}(U.Default),o=n.isLoading,r=n.items,s=n.totalCount,c=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==r?void 0:r.map((function(e,t){var n,o,r,a,i,l;return i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){xl(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!==(o=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==o?o:"",batch:null!==(r=e.batchNumber)&&void 0!==r?r:"",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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(l)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))})),i}))}),[r]);return o?l().createElement(a.gqd,{role:"progressbar"}):(null==r?void 0:r.length)>0?l().createElement(kl,{columns:m,data:p,totalItems:s,goToPage:c,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},d("quantityToDisplay","No quantity to display"))))};function Nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Il=function(e){var t,n,o=e.isEditing,r=e.model,a=e.onSave,s=(0,E.useTranslation)().t,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nl(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=c[0],d=c[1],m=function(e){d(e)},p=[{name:s("stockItemDetails","Stock Item Details"),component:l().createElement(ki,{handleTabChange:m,model:r,onSave:a,isEditing:o})},{name:s("packagingUnits","Packaging Units"),component:l().createElement(ul,{isEditing:!0,handleTabChange:m,stockItemUuid:r.uuid}),disabled:!o},{name:s("transactions","Transactions"),component:l().createElement(El,{stockItemUuid:r.uuid}),disabled:!o},{name:s("batchInformation","Batch Information"),component:l().createElement(Sl,{stockItemUuid:r.uuid}),disabled:!o},{name:s("quantities","Quantities"),component:l().createElement(Dl,{stockItemUuid:r.uuid}),disabled:!o},{name:s("stockRules","Stock Rules"),component:l().createElement(Ki,{stockItemUuid:r.uuid}),disabled:!o}];return l().createElement(Wn,{onChange:m,tabs:p,selectedIndex:u})};function Tl(e,t,n,o,r,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,r)}var Pl=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(o,r){var a=e.apply(t,n);function i(e){Tl(a,o,r,i,l,"next",e)}function l(e){Tl(a,o,r,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,r,a,i,l,s=arguments;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(c){switch(c.label){case 0:t=s.length>1&&void 0!==s[1]&&s[1],c.label=1;case 1:return c.trys.push([1,3,,4]),[4,(t?Ke:We)(e)];case 2:return(null==(n=c.sent())?void 0:n.data)&&((0,o.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Item"),kind:"success",description:"Stock Item ".concat(t?"Edited":"Added"," Successfully")}),t||(Q(),(r=n.data).isDrug=!!r.drugUuid,Ul(r,!0))),[3,4];case 3:return a=c.sent(),(0,o.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)}}(),Ul=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(Il,{model:e,onSave:function(e){return Pl(e,t)},isEditing:t}))};const jl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Ul(Xa,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var Ll=n(1048),Fl={};Fl.styleTagTransform=b(),Fl.setAttributes=g(),Fl.insert=p().bind(null,"head"),Fl.domAPI=d(),Fl.insertStyleElement=f(),c()(Ll.Z,Fl);const zl=Ll.Z&&Ll.Z.locals?Ll.Z.locals:void 0,Rl=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:zl.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 Ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ql(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ml(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 Gl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){var e=(0,o.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"))},Hl=function(e){var t,n=e.data,o=(0,E.useTranslation)().t;return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){n.isDrug=!!n.drugUuid,Ul(n,!0)},iconDescription:o("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function Zl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Zl(e,t,n[t])}))}return e}function Ql(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 o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Jl=function(){var e=(0,E.useTranslation)().t,t=function(e){(0,E.useTranslation)().t;var t=ql((0,i.useState)(1),2),n=t[0],r=t[1],a=ql((0,i.useState)(10),2),l=a[0],s=a[1],c=ql((0,i.useState)(null),2),u=c[0],d=c[1],m=ql((0,i.useState)(""),2),p=m[0],A=m[1],g=ql((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),_=g[0],f=g[1],v=He(_),b=v.items,h=v.isLoading,y=v.isError,k=(0,o.usePagination)(b.results,l);return(0,i.useEffect)((function(){f({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:r,setPageSize:s,pageSizes:[10,20,30,40,50],isLoading:h,isError:y,isDrug:p,setDrug:function(e){r(1),A(e)},setSearchString:d}}(U.Full),n=t.isLoading,r=t.items,s=t.totalCount,c=t.currentPageSize,u=t.pageSizes,d=t.currentPage,m=t.setCurrentPage,p=t.isDrug,A=t.setDrug,g=(0,i.useMemo)((function(){return[{id:0,header:e("type","Type"),key:"type"},{id:1,header:e("genericName","Generic Name"),key:"genericName"},{id:2,header:e("commonName","Common Name"),key:"commonName"},{id:3,header:e("tradeName","Trade Name"),key:"tradeName"},{id:4,header:e("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:e("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:e("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[e]),_=(0,i.useMemo)((function(){return null==r?void 0:r.map((function(t,n){var o;return Ql(Yl({},t),{id:null==t?void 0:t.uuid,key:"key-".concat(null==t?void 0:t.uuid),uuid:"".concat(null==t?void 0:t.uuid),type:(null==t?void 0:t.drugUuid)?e("drug","Drug"):e("other","Other"),genericName:l().createElement(Hl,{data:r[n]}),commonName:null==t?void 0:t.commonName,tradeName:(null==t?void 0:t.drugUuid)?null==t?void 0:t.conceptName:"",preferredVendorName:null==t?void 0:t.preferredVendorName,dispensingUoM:null==t?void 0:t.defaultStockOperationsUoMName,dispensingUnitName:null==t?void 0:t.dispensingUnitName,defaultStockOperationsUoMName:null==t?void 0:t.defaultStockOperationsUoMName,reorderLevel:(null==t?void 0:t.reorderLevelUoMName)&&(null==t?void 0:t.reorderLevel)?"".concat(null==t||null===(o=t.reorderLevel)||void 0===o?void 0:o.toLocaleString()," ").concat(null==t?void 0:t.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){t.isDrug=!!t.drugUuid,Ul(t,!0)},iconDescription:e("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(dt.I8,Yl({size:16},e))}}))})}))}),[r,e]);return n?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,e("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows:_,headers:g,isSortable:!0,useZebraStyles:!0,render:function(t){var n=t.rows,r=t.headers,i=t.getHeaderProps,s=t.getTableProps,c=t.getRowProps,u=t.getBatchActionProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,u()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(Rl,{filterType:p,changeFilterType:A}),l().createElement(Gl,null),l().createElement(jl,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,r.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ql(Yl({},i({header:e,isSortable:e.isSortable})),{className:o.isDesktop?Fn.desktopHeader:Fn.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,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ql(Yl({className:o.isDesktop?Fn.desktopRow:Fn.tabletRow},c({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===n.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},e("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:Fn.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:c,pageSizes:u,totalItems:s,onChange:function(e){var t=e.page;return m(t)},className:Fn.paginationOverride}))},Wl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Jl,null))},Kl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function Vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const Xl=function(){var e=(0,E.useTranslation)().t,t=function(e){var t,n,r=Et(e),a=r.locations,l=r.isErrorLocation,s=r.isLoadingLocations,c=(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 o,r,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Vl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vl(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],d=c[1],m=(0,o.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,_=(0,E.useTranslation)().t,f=(0,i.useMemo)((function(){return[{id:0,header:_("name","Name"),key:"name"},{id:1,header:_("tags","Tags"),key:"tags"},{id:2,header:_("childLocations","Child Locations"),key:"childLocations"},{id:3,header:_("actions","Actions"),key:"actions"}]}),[_]),v=(0,i.useMemo)((function(){var e;return null==a||null===(e=a.results)||void 0===e?void 0:e.map((function(e){var t,n,o,r,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.tags)||void 0===n||null===(t=n.map((function(e){return e.display})))||void 0===t?void 0:t.join(", "))&&void 0!==a?a:"",childLocations:null!==(i=null==e||null===(r=e.childLocations)||void 0===r||null===(o=r.map((function(e){return e.display})))||void 0===o?void 0:o.join(", "))&&void 0!==i?i:""}}))}),[null==a?void 0:a.results]);return{items:a.results,currentPage:g,currentPageSize:u,paginatedQueueEntries:A,goTo:p,pageSizes:[10,20,30,40,50],isLoadingLocations:s,isErrorLocation:l,setPageSize:d,tableHeaders:f,tableRows:v}}({v:U.Full}),n=t.tableHeaders,r=t.tableRows,s=t.items,c=t.isLoadingLocations,u=function(){},d=function(){};return c?l().createElement(a.gqd,{role:"progressbar"}):(null==s?void 0:s.length)?l().createElement(kl,{columns:n,data:r},(function(t){var n=t.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:n}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(a.zxk,{onClick:d,size:"md",kind:"primary"},e("stockmanagement.addnewlocation","Add Location")))})):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},"No stock items to display")))},$l=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Xl,null))};var es="@openmrs/esm-stock-management-app",ts={featureName:"stock-management",moduleName:es},ns=n(3979),os=(0,o.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(be.ol,{size:16}))))}),ts),rs=(0,o.getSyncLifecycle)((function(){return l().createElement(o.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),ts),as=(0,o.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Te.BrowserRouter,{basename:e},l().createElement("div",{className:Se.container},l().createElement(Ie,null),l().createElement("div",null,l().createElement(fe,null),l().createElement(Te.Routes,null,l().createElement(Te.Route,{path:"overview",element:l().createElement(At,null)}),l().createElement(Te.Route,{path:"",element:l().createElement(At,null)}),l().createElement(Te.Route,{path:"stock-items",element:l().createElement(Wl,null)}),l().createElement(Te.Route,{path:"stock-operations",element:l().createElement(Va,null)}),l().createElement(Te.Route,{path:"stock-user-scopes",element:l().createElement($t,null)}),l().createElement(Te.Route,{path:"stock-sources",element:l().createElement(Tn,null)}),l().createElement(Te.Route,{path:"stock-locations",element:l().createElement($l,null)}),l().createElement(Te.Route,{path:"stock-settings",element:l().createElement(Kl,null)}))),l().createElement(Ce,null)))}),ts),is=(0,o.getSyncLifecycle)((function(e){var t,n,r=e.title,s=e.requireReason,c=e.operation,u=e.closeModal,d=r.toLocaleLowerCase().trim(),m=(0,E.useTranslation)().t,p=ue((0,i.useState)(""),2),A=p[0],g=p[1],_=ue((0,i.useState)(!1),2),f=_[0],v=_[1],b=(t=function(e){var t;return function(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[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,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=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(),v(!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=new AbortController;return(0,o.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperationaction",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}({name:t,uuid:null==c?void 0:c.uuid,reason:A}).then((function(){v(!1),(0,o.showToast)({critical:!0,title:m("title","".concat(r," Operation")),kind:"success",description:m("successMessage","You have successfully ".concat(r," operation "))}),u(),Q()}),(function(e){v(!1);var t=le(e);(0,o.showNotification)({description:m("errorDescription",t.join(", ")),title:m("errorDescriptionTitle","Error on saving form"),kind:"error",critical:!0}),u(),Q()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(o,r){var a=t.apply(e,n);function i(e){ce(a,o,r,i,l,"next",e)}function l(e){ce(a,o,r,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(r," 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 ",r," the operation ?")),l().createElement("br",null),s&&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")),f?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),ts),ls=(0,o.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,o=e.uuid,r=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},r("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},r("deleteConfirmationText","Are you sure you want to delete this source? This action can't be undone.",{encounter:o}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},r("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},r("delete","Delete"))))}),{featureName:"delete-stock-modal",moduleName:es}),ss=(0,o.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,o=e.uuid,r=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:N.productiveHeading03},r("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:N.bodyLong01},r("deleteConfirmationText","Are you sure you want to delete this User Scope? This action can't be undone.",{encounter:o}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},r("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},r("delete","Delete"))))}),{featureName:"delete-stock-user-scope-modal",moduleName:es}),cs=(0,o.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,r=O((0,i.useState)(),2),s=r[0],c=r[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,o=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];o?(c(o),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(s){var e=new FormData;s&&(e.append("file",s,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,o.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,o.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")))))}),ts),us=(0,o.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"))}),ts);function ds(){(0,o.defineConfigSchema)(es,r)}},3979:(e,t,n)=>{var o={"./en.json":[3574,574]};function r(e){if(!n.o(o,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=o[e],r=t[0];return n.e(t[1]).then((()=>n(r)))}r.keys=()=>Object.keys(o),r.id=3979,e.exports=r}}]);
|
1
|
+
(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[220],{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},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},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},3880:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deleteStockModal:()=>lc,deleteUserScopeModal:()=>cc,importBulkStockItemsDialog:()=>sc,importTranslation:()=>nc,startupApp:()=>dc,stockManagement:()=>oc,stockManagementAdminCardLink:()=>rc,stockManagementAppMenuItem:()=>uc,stockManagementDashboard:()=>ac,stockOperationDialog:()=>ic});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(1009),i=n(1672),l=n.n(i),c=n(7410),s=n.n(c),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),f=n(2434),v=n.n(f),_=n(1422),h=n.n(_),b=n(7813),y={};y.styleTagTransform=h(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(b.Z,y);const k=b.Z&&b.Z.locals?b.Z.locals:void 0;var C=n(601);var E=n(3397);function w(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function S(){var e;return e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){return t=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){w(a,r,o,i,l,"next",e)}function l(e){w(a,r,o,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var x=n(49),N={};N.styleTagTransform=h(),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),P={};P.styleTagTransform=h(),P.setAttributes=g(),P.insert=p().bind(null,"head"),P.domAPI=d(),P.insertStyleElement=v(),s()(T.Z,P);const B=T.Z&&T.Z.locals?T.Z.locals:void 0;var U,j=n(9820);function z(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var r=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var r=e[t];return n&&(!1===r||!0===r||r)||!n&&(""===r||!1===r||!0===r||r)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r.toString())):null})).filter((function(e){return null!=e})).join("&");return r.length>0?"?"+r:""}function F(e){var t="ws/rest/v1/stockmanagement/stockoperation".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function L(e){var t="ws/rest/v1/stockmanagement/stockoperation/".concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function R(e){var t=new AbortController;return(0,r.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperation",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}function M(e){var t="ws/rest/v1/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]}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function se(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 ue(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 ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ce(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.")}()}"".concat(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var de=n(965),me={};me.styleTagTransform=h(),me.setAttributes=g(),me.insert=p().bind(null,"head"),me.domAPI=d(),me.insertStyleElement=v(),s()(de.Z,me);const pe=de.Z&&de.Z.locals?de.Z.locals:void 0,Ae=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 ge=n(9375),fe=n(2411),ve=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:pe.header},l().createElement("div",{className:pe["left-justified-items"]},l().createElement(Ae,null),l().createElement("div",{className:pe["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:pe["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:pe["right-justified-items"]},l().createElement("div",{className:pe["date-and-location"]},l().createElement(ge.Ye,{size:16}),l().createElement("span",{className:pe.value},o),l().createElement("span",{className:pe.middot},"·"),l().createElement(fe.f,{size:16}),l().createElement("span",{className:pe.value},(0,r.formatDate)(new Date,{mode:"standard"})))))},_e=n(6194),he=n(8115),be=n(2296),ye={};ye.styleTagTransform=h(),ye.setAttributes=g(),ye.insert=p().bind(null,"head"),ye.domAPI=d(),ye.insertStyleElement=v(),s()(be.Z,ye);const ke=be.Z&&be.Z.locals?be.Z.locals:void 0,Ce=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?ke.desktopOverlay:ke.tabletOverlay},"tablet"!==c?l().createElement("div",{className:ke.desktopHeader},l().createElement("div",{className:ke.headerContent},t),l().createElement(a.zxk,{className:ke.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(_e.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":s("tabletOverlay","Tablet overlay"),className:ke.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(he.Xd,{size:16})),l().createElement("div",{className:ke.headerContent},t)),l().createElement("div",null,n)))};var Ee=n(6919),we={};we.styleTagTransform=h(),we.setAttributes=g(),we.insert=p().bind(null,"head"),we.domAPI=d(),we.insertStyleElement=v(),s()(Ee.Z,we);const Se=Ee.Z&&Ee.Z.locals?Ee.Z.locals:void 0;var Oe=n(1940),De={};De.styleTagTransform=h(),De.setAttributes=g(),De.insert=p().bind(null,"head"),De.domAPI=d(),De.insertStyleElement=v(),s()(Oe.Z,De);const xe=Oe.Z&&Oe.Z.locals?Oe.Z.locals:void 0,Ne=function(e){var t=e.tabs,n=e.selectedIndex,o=e.onSelectTab;return l().createElement("div",{className:"\n ".concat(xe.cohortBuilder,"\n ")},l().createElement("div",{className:xe.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 Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Te=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 Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),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("stockManagementSettings","Stock Settings"),link:"admin/maintenance/settings.list?show=Stockmanagement"}];return l().createElement(Ne,{tabs:c,selectedIndex:o,onSelectTab:a})};var Pe=n(1914),Be=n(2426),Ue={};Ue.styleTagTransform=h(),Ue.setAttributes=g(),Ue.insert=p().bind(null,"head"),Ue.domAPI=d(),Ue.insertStyleElement=v(),s()(Be.Z,Ue);const je=Be.Z&&Be.Z.locals?Be.Z.locals:void 0;var ze=n(3432),Fe={};Fe.styleTagTransform=h(),Fe.setAttributes=g(),Fe.insert=p().bind(null,"head"),Fe.domAPI=d(),Fe.insertStyleElement=v(),s()(ze.Z,Fe);const Le=ze.Z&&ze.Z.locals?ze.Z.locals:void 0;var Re=n(9697),Me=n(7412),qe=n.n(Me);W().extend(qe());const Ge=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:Le.tileContainer},l().createElement("div",{className:Le.tileHeader},l().createElement("div",{className:Le.headerLabelContainer},l().createElement("label",{className:Le.headerLabel},m),p),A&&l().createElement(r.ConfigurableLink,{className:Le.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:Le.viewListBtn}))),l().createElement("div",{className:Le.metricsGrid},l().createElement("div",null,l().createElement("label",{className:Le.totalsLabel},u),l().createElement("p",{className:Le.totalsValue},d)),!(0,Re.Z)(g)&&l().createElement("div",{className:Le.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,Re.Z)(f)&&l().createElement("div",{className:Le.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,Re.Z)(v)&&l().createElement("div",{className:Le.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 He(e){var t="ws/rest/v1/stockmanagement/stockitem".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ze(e){var t="ws/rest/v1/stockmanagement/stockiteminventory".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ye(e){var t="ws/rest/v1/stockmanagement/stockbatch".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Qe(e){var t="ws/rest/v1/stockmanagement/stockitempackaginguom".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Je(e){var t="ws/rest/v1/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 We(e){var t=new AbortController;return delete e.isDrug,(0,r.openmrsFetch)("ws/rest/v1/stockmanagement/stockitem",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}function Ke(e){var t="ws/rest/v1/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 Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xe(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 Ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(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=He(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 $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function et(){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 $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$e(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=Ye(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 tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const nt=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=et(),u=s.items,d=(s.isLoading,Xe().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){tt(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=F(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(c)return l().createElement(r.ErrorState,{headerTitle:t("errorStockMetric"),error:c});var 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})),h=g&&g.filter((function(e){return"Poor Quality"===e.reasonName}));return l().createElement(l().Fragment,null,l().createElement("div",{className:je.cardContainer},l().createElement(Ge,{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(Ge,{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(Ge,{label:t("disposedstock","Disposed Stock"),value:(null==g?void 0:g.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:_,poorquality:h}})))};var rt=n(8629),ot={};ot.styleTagTransform=h(),ot.setAttributes=g(),ot.insert=p().bind(null,"head"),ot.domAPI=d(),ot.insertStyleElement=v(),s()(rt.Z,ot);const at=rt.Z&&rt.Z.locals?rt.Z.locals:void 0;var it=n(4797);function lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ct=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),et()),n=t.items,o=(t.isLoading,Xe()),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:at.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){lt(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:at.card,key:t},l().createElement("div",{className:at.colorLineRed}),l().createElement("div",{className:at.icon},l().createElement(it.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:at.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 st=n(8748);const ut=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=F(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"receipt"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0})),n=t.items;return t.isLoading?l().createElement(l().Fragment,null):0===(null==n?void 0:n.length)?l().createElement(l().Fragment,null,l().createElement("p",{className:at.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:at.card,key:t},l().createElement("div",{className:at.colorLineBlue}),l().createElement("div",{className:at.icon},l().createElement(st.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:at.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 dt=n(2327);const mt=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),function(e){var t,n=F(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"stockissue"===(null==e?void 0:e.operationType)&&"COMPLETED"!==(null==e?void 0:e.status)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0})),n=t.items;if(t.isLoading)return l().createElement(l().Fragment,null);if(0===(null==n?void 0:n.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:at.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:at.card,key:t},l().createElement("div",{className:at.colorLineGreen}),l().createElement("div",{className:at.icon},l().createElement(dt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:at.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"))},pt=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:at.cardContainer},l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(ct,null)))),l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(ut,null)))),l().createElement("div",{className:at.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?at.tabletHeading:at.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(mt,null)))))};function At(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(nt,null),l().createElement(pt,null))}var gt=n(5104),ft={};ft.styleTagTransform=h(),ft.setAttributes=g(),ft.insert=p().bind(null,"head"),ft.domAPI=d(),ft.insertStyleElement=v(),s()(gt.Z,ft);const vt=gt.Z&>.Z.locals?gt.Z.locals:void 0;function _t(e,t){(null==t||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="ws/rest/v1/stockmanagement/userrolescope".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return _t(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_t(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 bt=n(4300),yt={};yt.styleTagTransform=h(),yt.setAttributes=g(),yt.insert=p().bind(null,"head"),yt.domAPI=d(),yt.insertStyleElement=v(),s()(bt.Z,yt);const kt=bt.Z&&bt.Z.locals?bt.Z.locals:void 0;var Ct=n(9337);function Et(e){var t="ws/rest/v1/location".concat(z(e,!1)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{locations:(null==o?void 0:o.data)||{},isErrorLocation:a,isLoadingLocations:i}}function wt(e){var t="ws/rest/v1/role".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function St(){var e=(0,j.ZP)("ws/rest/v1/stockmanagement/stockoperationtype?v=default",r.openmrsFetch),t=e.data,n=e.isLoading,o=e.error;return{types:(null==t?void 0:t.data)||{},isLoading:n,isError:o}}function Ot(){return(0,r.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperationtype?v=default")}function Dt(e){var t="ws/rest/v1/user".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function xt(e){var t="ws/rest/v1/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 Nt=n(8891),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 Pt(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Bt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function 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){Bt(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 zt(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 Ft(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=e.model,m=(0,E.useTranslation)().t,p=zt((0,i.useState)(Ut({},d)),2),A=p[0],g=p[1],f=zt((0,i.useState)([]),2),v=f[0],_=f[1],h=function(e){var t="ws/rest/v1/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}}(null==d?void 0:d.uuid),b=h.data,y=St(),k=y.types.results,C=y.isLoading,w=Dt({v:U.Default}),S=w.items,O=w.isLoading,D=wt({v:U.Default}),x=(D.items,D.isLoading),N=function(){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,Ct.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}().stockLocations,I=(0,i.useMemo)((function(){return(0,Nt.Z)((function(e){Dt({v:U.Default,q:e})}),300)}),[]),T=function(e){var t,n;return(null==A||null===(n=A.operationTypes)||void 0===n||null===(t=n.filter((function(t){return t.operationTypeUuid===e.uuid})))||void 0===t?void 0:t.length)>0},P=(o=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="ws/rest/v1/stockmanagement/userrolescope".concat(n?"/"+e.uuid:"");return(0,r.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(e){It("ws/rest/v1/stockmanagement/userrolescope"),(0,r.showToast)({critical:!0,title:m("addUserRole","Add User role"),kind:"success",description:m("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,r.showNotification)({title:m("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",critical:!0,description:null==e?void 0:e.message}),Q()})),[2]}))},c=function(){var e=this,t=arguments;return new Promise((function(n,r){var a=o.apply(e,t);function i(e){Pt(a,n,r,i,l,"next",e)}function l(e){Pt(a,n,r,i,l,"throw",e)}i(void 0)}))},function(e){return c.apply(this,arguments)});return C||x||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:kt.section},l().createElement("div",null,(null==S||null===(t=S.results)||void 0===t?void 0:t.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:kt.subTitle},m("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:m("user","User"),items:null==S?void 0:S.results,onChange:function(e){var t,n,r=["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"],o=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return r.includes(e.uuid)}));g(jt(Ut({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),_(null!=o?o:[]),console.info(v)},shouldFilterItem:function(e){return!0},onFocus:function(){return(null==S?void 0:S.results)||I("")},onToggleClick:function(){return(null==S?void 0:S.results)||I("")},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:"")},placeholder:"Filter..."})))),l().createElement("section",{className:kt.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:m("role","Role"),id:"select-role",value:null!==(s=A.role)&&void 0!==s?s:"placeholder-item",onChange:function(e){var t,n,r,o=null==N||null===(t=N.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return!o||0===o.length||!o.some((function(t){return t===e.locationUuid}))})))&&void 0!==r?r:[];g(jt(Ut({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:m("Choose a role")}),null===(n=null!==(u=null==b?void 0:b.roles)&&void 0!==u?u:v)||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:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.enabled);g(jt(Ut({},A),{enabled:n}))},checked:null==A?void 0:A.enabled,labelText:m("Enabled ?"),value:null==d?void 0:d.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.permanent);g(jt(Ut({},A),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==d?void 0:d.permanent,labelText:m("Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(Rt),locale:"en",dateFormat:X,onChange:function(e){g(jt(Ut({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:V,labelText:m("activeFrom","Active From"),value:$(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:V,labelText:m("activeTo","Active To"),value:$(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:kt.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kt.sectionTitle}," ",m("stockOperation","Stock Operations")),l().createElement("div",{className:kt.hr}),l().createElement("span",{className:kt.subTitle},m("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},(null==k?void 0:k.length)>0&&k.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:T(e),onChange:function(t){return function(e,t,n){var r,o=null==A||null===(r=A.operationTypes)||void 0===r?void 0:r.find((function(t){var n;return t.operationTypeUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(o){var a=Ft(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==o?void 0:o.operationTypeUuid)})));g(jt(Ut({},A),{operationTypes:a}))}else{var i,l=null==k?void 0:k.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};g(jt(Ut({},A),{operationTypes:Ft(null!==(i=null==A?void 0:A.operationTypes)&&void 0!==i?i:[]).concat([c])}))}}(t,e.uuid,T(e))},className:kt.checkbox,labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:kt.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:kt.sectionTitle}," ",m("Locations")),l().createElement("div",{className:kt.hr}),l().createElement("span",{className:kt.subTitle},m("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:kt.section},l().createElement(a.cOn,{className:kt.checkboxGrid},(null==N?void 0:N.length)>0&&N.map((function(e){var t,n,r,o=(t=e,(r=null==A||null===(n=A.locations)||void 0===n?void 0:n.filter((function(e){return e.locationUuid===t.id})))&&r.length>0?r[0]:null);return l().createElement("div",{style:{display:"flex",flexDirection:"row",margin:"4px",padding:"5px"}},l().createElement(a.XZJ,{name:"location",key:"chk-loc-child-key-".concat(e.id),id:"chk-loc-child-".concat(e.id),value:e.id,onChange:function(t){return function(e,t){var n,r=null==A||null===(n=A.locations)||void 0===n?void 0:n.find((function(t){var n;return t.locationUuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)}));if(r){var o,a,i=Ft(null!==(a=null==A||null===(o=A.locations)||void 0===o?void 0:o.filter((function(e){return e.locationUuid!==(null==r?void 0:r.locationUuid)})))&&void 0!==a?a:[]);g(jt(Ut({},A),{locations:i}))}else{var l,c=null==N?void 0:N.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={locationName:null==c?void 0:c.name,locationUuid:null==c?void 0:c.id,enableDescendants:!1},u=Ft(null!==(l=null==A?void 0:A.locations)&&void 0!==l?l:[]).concat([s]);g(jt(Ut({},A),{locations:u}))}}(t,e.id)},className:kt.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:kt.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},m("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:P},m("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(dt.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="ws/rest/v1/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:vt.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:vt.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?vt.desktopHeader:vt.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?vt.desktopRow:vt.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:vt.tileContainer},l().createElement(a.n9L,{className:vt.tile},l().createElement("div",{className:vt.tileContent},l().createElement("p",{className:vt.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:vt.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:vt.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="ws/rest/v1/stockmanagement/stocksource".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function 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=h(),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=xt((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="ws/rest/v1/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=h(),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 hn=function(e){var t,n=e.onFilterChange,o=xt((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 bn=n(6940),yn={};yn.styleTagTransform=h(),yn.setAttributes=g(),yn.insert=p().bind(null,"head"),yn.domAPI=d(),yn.insertStyleElement=v(),s()(bn.Z,yn);const kn=bn.Z&&bn.Z.locals?bn.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="ws/rest/v1/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 On=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(dt.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 Dn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function 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 Dn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),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,h=u.isLoading,b=(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(On,{data:d[t]}),l().createElement(wn,{uuid:d[t].uuid}))})}))}),[d]),y=function(e){s(e)},k=(0,i.useMemo)((function(){return c?b.filter((function(e){return e.sourceType===c})):b}),[b,c]);return h?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(hn,{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}))},Pn=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Tn,null))};function Bn(e,t){(null==t||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=F(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bn(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),zn={};zn.styleTagTransform=h(),zn.setAttributes=g(),zn.insert=p().bind(null,"head"),zn.domAPI=d(),zn.insertStyleElement=v(),s()(jn.Z,zn);const Fn=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=St(),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=h(),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;function Vn(e){return"transferout"===(e=e.toLowerCase())?"transferout":"disposed"===e?"disposed":"stockissue"===e?"stockissue":"stocktake"===e?"stocktake":"requisition"===e?"requisition":"receipt"===e?"receipt":"return"===e?"return":"adjustment"===e?"adjustment":"initial"===e?"initial":void 0}!function(e){e.TRANSFER_OUT_OPERATION_TYPE="transferout",e.DISPOSED_OPERATION_TYPE="disposed",e.STOCK_ISSUE_OPERATION_TYPE="stockissue",e.STOCK_TAKE_OPERATION_TYPE="stocktake",e.REQUISITION_OPERATION_TYPE="requisition",e.OPENING_STOCK_OPERATION_TYPE="initial",e.RECEIPT_OPERATION_TYPE="receipt",e.RETURN_OPERATION_TYPE="return",e.ADJUSTMENT_OPERATION_TYPE="adjustment"}(Kn||(Kn={}));var Xn=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},$n=function(e){return!er(e)&&"requisition"!==e},er=function(e){return"receipt"===e||"initial"===e},tr=function(e){return"requisition"===e},nr=function(e){return"receipt"===e||"initial"===e},rr=function(e){return"stockissue"===e||"return"===e},or=function(e){return"stockissue"===e||ar(e)||ir(e)||lr(e)},ar=function(e){return"requisition"===e},ir=function(e){return"receipt"===e},lr=function(e){return"transferout"===e},cr=n(7536),sr=n(6312),ur=n(1604),dr=ur.z.object({id:ur.z.string().nullish(),uuid:ur.z.string().nullish(),stockItemUuid:ur.z.string().nullish(),packagingUomName:ur.z.string().nullish(),packagingUomUuid:ur.z.string().nullish(),factor:ur.z.number().nullish(),isDefaultStockOperationsUoM:ur.z.boolean().nullish(),isDispensingUnit:ur.z.boolean().nullish()}),mr=ur.z.object({canView:ur.z.boolean(),canEdit:ur.z.boolean(),canApprove:ur.z.boolean().nullish(),canReceiveItems:ur.z.boolean().nullish(),canDisplayReceivedItems:ur.z.boolean().nullish(),isRequisitionAndCanIssueStock:ur.z.boolean().nullish(),canUpdateBatchInformation:ur.z.boolean().nullish()}),pr=ur.z.object({itemIndex:ur.z.number().nullish(),id:ur.z.string().nullish(),uuid:ur.z.string().nullish(),stockItemUuid:ur.z.string().nullish(),stockItemName:ur.z.string().nullish(),stockItemPackagingUOMUuid:ur.z.string().nullish(),stockItemPackagingUOMName:ur.z.string().nullish(),stockBatchUuid:ur.z.string().nullish(),batchNo:ur.z.string().nullish(),expiration:ur.z.coerce.date().nullish(),quantity:ur.z.number().nullish(),purchasePrice:ur.z.number().nullish(),permission:mr.nullish(),edit:ur.z.boolean().nullish(),hasExpiration:ur.z.boolean().nullish(),packagingUnits:dr.array(),quantityReceived:ur.z.number().nullish(),quantityReceivedPackagingUOMName:ur.z.string().nullish(),quantityReceivedPackagingUOMUuid:ur.z.string().nullish(),quantityRequested:ur.z.number().nullish(),quantityRequestedPackagingUOMUuid:ur.z.string().nullish(),quantityRequestedPackagingUOMName:ur.z.string().nullish(),commonName:ur.z.string().nullish(),acronym:ur.z.string().nullish()}),Ar=(ur.z.object({uuid:ur.z.string().nullish(),cancelReason:ur.z.string().nullish(),cancelledBy:ur.z.coerce.number(),cancelledByGivenName:ur.z.string().nullish(),cancelledByFamilyName:ur.z.string().nullish(),cancelledDate:ur.z.coerce.date(),completedBy:ur.z.coerce.number(),completedByGivenName:ur.z.string().nullish(),completedByFamilyName:ur.z.string().nullish(),completedDate:ur.z.coerce.date(),destinationUuid:ur.z.string().nullish(),destinationName:ur.z.string().nullish(),externalReference:ur.z.string().nullish(),atLocationUuid:ur.z.string().nullish(),atLocationName:ur.z.string().nullish(),operationDate:ur.z.coerce.date(),submitted:ur.z.boolean(),submittedBy:ur.z.string().nullish(),submittedByGivenName:ur.z.string().nullish(),submittedByFamilyName:ur.z.string().nullish(),locked:ur.z.boolean(),operationNumber:ur.z.string().nullish(),operationOrder:ur.z.coerce.number(),remarks:ur.z.string().nullish(),sourceUuid:ur.z.string().nullish(),sourceName:ur.z.string().nullish(),status:ur.z.enum(qn),returnReason:ur.z.string().nullish(),rejectionReason:ur.z.string().nullish(),operationTypeUuid:ur.z.string().nullish(),operationType:ur.z.string().nullish(),operationTypeName:ur.z.string().nullish(),responsiblePerson:ur.z.coerce.number(),responsiblePersonUuid:ur.z.string().nullish(),responsiblePersonGivenName:ur.z.string().nullish(),responsiblePersonFamilyName:ur.z.string().nullish(),responsiblePersonOther:ur.z.string().nullish(),creator:ur.z.coerce.number(),dateCreated:ur.z.coerce.date(),creatorGivenName:ur.z.string().nullish(),creatorFamilyName:ur.z.string().nullish(),permission:mr.nullish(),reasonUuid:ur.z.string().nullish(),reasonName:ur.z.string().nullish(),approvalRequired:ur.z.boolean().nullish(),stockOperationItems:pr.array(),submittedDate:ur.z.coerce.date(),returnedByGivenName:ur.z.string().nullish(),returnedByFamilyName:ur.z.string().nullish(),returnedDate:ur.z.coerce.date(),rejectedByGivenName:ur.z.string().nullish(),rejectedByFamilyName:ur.z.string().nullish(),rejectedDate:ur.z.coerce.date(),dispatchedByGivenName:ur.z.string().nullish(),dispatchedByFamilyName:ur.z.string().nullish(),dispatchedDate:ur.z.coerce.date(),requisitionStockOperationUuid:ur.z.string()}),ur.z.object({operationDate:ur.z.coerce.date(),sourceUuid:ur.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:ur.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:ur.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:ur.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:ur.z.string().nullish(),remarks:ur.z.string().nullish()})),gr=function(e){switch(e){case Kn.OPENING_STOCK_OPERATION_TYPE:return Ar.omit({destinationUuid:!0,reasonUuid:!0});case Kn.STOCK_TAKE_OPERATION_TYPE:case Kn.ADJUSTMENT_OPERATION_TYPE:case Kn.DISPOSED_OPERATION_TYPE:return Ar.omit({destinationUuid:!0});case Kn.TRANSFER_OUT_OPERATION_TYPE:case Kn.STOCK_ISSUE_OPERATION_TYPE:return Ar.omit({reasonUuid:!0}).merge(ur.z.object({destinationUuid:ur.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"}),requisitionStockOperationUuid:ur.z.string({required_error:"Requisition stock uuid required"})}));case Kn.RETURN_OPERATION_TYPE:case Kn.REQUISITION_OPERATION_TYPE:case Kn.RECEIPT_OPERATION_TYPE:return Ar.omit({reasonUuid:!0}).merge(ur.z.object({sourceUuid:ur.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const fr=function(e){return l().createElement(cr.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 vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _r(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 vr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vr(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 br(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(0,i.useRef)();return(0,i.useEffect)((function(){return function(){n.current&&clearTimeout(n.current)}}),[]),function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var i=setTimeout((function(){var t;e.apply(void 0,function(e){if(Array.isArray(e))return 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 yr=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:""}},kr={uuid:"Other",display:"Other",person:{display:"Other"}};function Cr(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const Er=function(e){var t=function(e){var t=_r((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=Dt(n),a=o.items.results,l=o.isLoading,c=_r((0,i.useState)(null),2),s=c[0],u=c[1],d=_r((0,i.useState)(10),2),m=d[0],p=d[1],A=_r((0,i.useState)(U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s})}),[s,m,g]),{userList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(),n=t.isLoading,r=t.userList,o=t.setSearchString,c=br((function(e){o(e)}),1e3);return r&&r.push(kr),l().createElement("div",null,l().createElement(cr.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:Cr,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 wr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sr=function(e){return l().createElement(cr.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){wr(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=xt((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(cr.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 Dr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xr=function(e){return l().createElement(cr.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){Dr(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 Nr(e,t){(null==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 Ir=(0,i.createContext)(null),Tr=function(){return(0,i.useContext)(Ir)},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 Nr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nr(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(Ir.Provider,{value:a},r)},Br=[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],Ur=[Kn.ADJUSTMENT_OPERATION_TYPE,Kn.DISPOSED_OPERATION_TYPE,Kn.STOCK_TAKE_OPERATION_TYPE,Kn.OPENING_STOCK_OPERATION_TYPE];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 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 Fr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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.")}()}const Lr=function(e){var t,n,r,o,c,s,u=e.model,d=e.onSave,m=e.operation,p=e.canEdit,A=e.isEditing,g=e.setup,f=g.requiresStockAdjustmentReason,v=g.shouldLockSource,_=g.shouldLockDestination,h=g.sourcePartyList,b=g.destinationPartyList,y=(0,E.useTranslation)().t,k=Tr().setFormContext,C=Un({v:U.Full,totalCount:!0}),w=C.isLoading,S=function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=null!==(e=null==n?void 0:n.filter((function(e){return e.operationType===Kn.STOCK_ISSUE_OPERATION_TYPE})).map((function(e){return e.requisitionStockOperationUuid})))&&void 0!==e?e:[],o=null!==(t=null==n?void 0:n.filter((function(e){return e.operationType===Kn.REQUISITION_OPERATION_TYPE&&!r.includes(e.uuid)})))&&void 0!==t?t:[];return o}(C.items),O=Vn(m.operationType),D=(0,cr.cI)({defaultValues:u,mode:"all",resolver:(0,sr.F)(gr(O))}),x=D.handleSubmit,N=D.control,T=D.formState.errors,P=D.setValue,B=Fr((0,i.useState)(),2),j=B[0],z=B[1],F=Fr((0,i.useState)(!1),2),L=F[0],R=F[1];if(w)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var M,q,G,H,Z,Y,Q=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]),R(!0),t=function(e,t,n){var r=Object.assign(e,t);return function(e,t){["submitted","cancelledByFamilyName","atLocationName","completedByGivenName","cancelledBy","submittedByFamilyName","operationOrder","dispatchedByGivenName","submittedByGivenName","returnedByGivenName","operationNumber","responsiblePersonFamilyName","returnReason","atLocationUuid","cancelReason","rejectedByGivenName","reasonName","submittedBy","creator","completedByFamilyName","operationTypeName","rejectedByFamilyName","responsiblePerson","creatorFamilyName","returnedByFamilyName","cancelledByGivenName","operationType","responsiblePersonGivenName","sourceName","rejectionReason","completedBy","creatorGivenName","dispatchedByFamilyName","uuid"].forEach((function(t){delete e[t]}))}(r),function(e){return Br.includes(e)}(n)&&delete r.destinationName,function(e){return Ur.includes(e)}(n)&&delete r.destinationUuid,r}(u,e,O),[4,d(t)];case 1:case 2:return n.sent(),[3,4];case 3:return R(!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)},O===Kn.STOCK_ISSUE_OPERATION_TYPE&&l().createElement(cr.Qr,{control:N,name:"requisitionStockOperationUuid",render:function(e){var t,n=e.field;return l().createElement(a.CtY,{id:"requisitionStockOperationUuid",items:S,onChange:function(e){n.onChange(e.selectedItem.uuid),Object.assign(u.stockOperationItems,e.selectedItem.stockOperationItems),k({stockItems:e.selectedItem.stockOperationItems})},itemToString:function(e){var t;return null!==(t="".concat(null==e?void 0:e.operationNumber))&&void 0!==t?t:""},titleText:y("requisitionStockOperation","Requisition"),invalid:!!T.requisitionStockOperationUuid,invalidText:null===(t=T.requisitionStockOperationUuid)||void 0===t?void 0:t.message,placeholder:y("chooseARequisition","Choose a requisition")})}}),p&&l().createElement(cr.Qr,{control:N,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:!!T.operationDate,invalidText:null==T||null===(t=T.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:V,labelText:y("operationDate","Operation Date"),value:$(null==u?void 0:u.operationDate)}))},name:"operationDate"}),!p&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(null==u?void 0:u.operationDate),readOnly:!0,labelText:"Operation Date"})),A&&(null==u?void 0:u.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==u?void 0:u.operationNumber,readOnly:!0,labelText:"Operation Number"}),p&&!v&&(null==m?void 0:m.hasSource)&&l().createElement(fr,{controllerName:"sourceUuid",name:"sourceUuid",control:N,title:(null==m?void 0:m.hasDestination)?y("from","From"):y("location:","Location"),placeholder:m.hasDestination?y("chooseASource","Choose a source"):y("chooseALocation","Choose a location"),invalid:!!T.sourceUuid,invalidText:T.sourceUuid&&(null==T||null===(t=T.sourceUuid)||void 0===t?void 0:t.message),parties:h||[]}),(!p||A||v)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:null!==(M=null==u?void 0:u.sourceName)&&void 0!==M?M:"",readOnly:!0,labelText:(null==m||m.hasDestination,"From")}),p&&!_&&(null==m?void 0:m.hasDestination)&&l().createElement(fr,{controllerName:"destinationUuid",name:"destinationUuid",control:N,title:(null==m?void 0:m.hasSource)?"To":"Location",placeholder:(null==m?void 0:m.hasSource)?y("chooseADestination","Choose a destination"):"Location",invalid:!!T.destinationUuid,invalidText:T.destinationUuid&&(null==T||null===(n=T.destinationUuid)||void 0===n?void 0:n.message),parties:b||[]}),(!p||A||_)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:null!==(q=null==u?void 0:u.destinationName)&&void 0!==q?q:"",readOnly:!0,labelText:(null==m||m.hasSource,"To")}),p&&l().createElement(Er,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:N,title:y("responsiblePerson:","Responsible Person"),placeholder:y("filter","Filter ..."),invalid:!!T.responsiblePersonUuid,invalidText:T.responsiblePersonUuid&&(null==T||null===(r=T.responsiblePersonUuid)||void 0===r?void 0:r.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===kr.uuid&&z(!0)}}),j&&l().createElement(Sr,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:N,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(G=null==u?void 0:u.responsiblePersonOther)&&void 0!==G?G:""),labelText:y("responsiblePerson","Responsible Person"),placeholder:y("pleaseSpecify","Please Specify"),invalid:!!T.responsiblePersonOther,invalidText:T.responsiblePersonOther&&(null==T||null===(o=T.responsiblePersonOther)||void 0===o?void 0:o.message)}),!p&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(H=(null==u?void 0:u.responsiblePersonUuid)&&(null==u?void 0:u.responsiblePersonUuid)!==kr.uuid?"".concat(null==u?void 0:u.responsiblePersonFamilyName," ").concat(null==u?void 0:u.responsiblePersonGivenName):null==u?void 0:u.responsiblePersonOther)&&void 0!==H?H:"",readOnly:!0,labelText:"Responsible Person"}),f&&p&&l().createElement(Or,{controllerName:"reasonUuid",name:"reasonUuid",control:N,placeholder:y("chooseAReason","Choose a reason"),title:y("reason","Reason"),invalid:!!T.reasonUuid,invalidText:T.reasonUuid&&(null==T||null===(c=T.reasonUuid)||void 0===c?void 0:c.message),onReasonChange:function(e){P("reasonUuid",e.uuid)}}),f&&!p&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(Z=null==u?void 0:u.reasonName)&&void 0!==Z?Z:"",readOnly:!0,labelText:"Reason:"}),l().createElement(xr,{id:"remarks",name:"remarks",control:N,controllerName:"remarks",maxLength:255,value:"".concat(null!==(Y=null==u?void 0:u.remarks)&&void 0!==Y?Y:""),labelText:y("remarks:","Remarks"),invalid:!!T.remarks,invalidText:T.remarks&&(null==T||null===(s=T.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:x(Q),kind:"primary",renderIcon:he.ol},L?l().createElement(a.lSo,null):y("next","Next")))))};var Rr={stockItemUuid:ur.z.string().min(1,{message:"Required"}),stockItemName:ur.z.string().min(1).nullish(),stockItemPackagingUOMUuid:ur.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:ur.z.string().min(1).nullish(),batchNo:ur.z.string().min(1,{message:"Required"}),stockBatchUuid:ur.z.string().optional(),expiration:ur.z.coerce.date({required_error:"Required"}),quantity:ur.z.coerce.number().min(1,{message:"Required"}),purchasePrice:ur.z.coerce.number().nullish(),hasExpiration:ur.z.boolean().nullish()},Mr=ur.z.object(Rr),qr=(Mr.omit({expiration:!0}),ur.z.object({stockItems:ur.z.array(Mr)})),Gr=n(6781),Hr={};Hr.styleTagTransform=h(),Hr.setAttributes=g(),Hr.insert=p().bind(null,"head"),Hr.domAPI=d(),Hr.insertStyleElement=v(),s()(Gr.Z,Hr);const Zr=Gr.Z&&Gr.Z.locals?Gr.Z.locals:void 0;function Yr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jr(e){return e.drugName||e.conceptName}const Wr=function(e){var t=function(e){var t=Qr((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=He(n),a=o.items.results,l=o.isLoading,c=Qr((0,i.useState)(null),2),s=c[0],u=c[1],d=Qr((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Qr((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s})}),[s,m,g]),{stockItemsList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}({}),n=t.isLoading,r=t.stockItemsList,o=t.setSearchString,c=br((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,s=(o.value,o.ref);return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:r||[],onChange:function(t){var n,r;null===(n=e.onStockItemChanged)||void 0===n||n.call(e,t.selectedItem),i(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:null!==(n=null==r?void 0:r.find((function(t){return t.uuid===e.stockItemUuid})))&&void 0!==n?n:"",itemToString:Jr,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Kr=function(e){var t,n=Je(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(cr.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 Vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vr(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function eo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function to(e){var t=eo((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=eo((0,i.useState)(10),2),a=o[0],l=o[1],c=eo((0,i.useState)(null),2),s=c[0],u=c[1],d=eo((0,i.useState)(1),2),m=d[0],p=d[1],A=eo((0,i.useState)(),2),g=A[0],f=A[1],v=eo((0,i.useState)(),2),_=v[0],h=v[1],b=eo((0,i.useState)(),2),y=b[0],k=b[1],C=eo((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,O=Ze(n),D=O.items,x=O.isLoading,N=O.isError;return{items:null!==(S=D.results)&&void 0!==S?S:[],totalCount:D.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}function no(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ro=function(e){var t=function(e){var t=Xr((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=Ye(n),a=o.items.results,l=o.isLoading,c=Xr((0,i.useState)(null),2),s=c[0],u=c[1],d=Xr((0,i.useState)(10),2),m=d[0],p=d[1],A=Xr((0,i.useState)(U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){r({startIndex:0,v:g,limit:m,q:s,stockItemUuid:e})}),[s,m,g,e]),{stockItemBatchNos:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(e.stockItemUuid),n=t.isLoading,r=t.stockItemBatchNos,o=(0,i.useMemo)((function(){var t;return null!==(t=null==r?void 0:r.find((function(t){return t.uuid===e.batchUuid})))&&void 0!==t?t:""}),[r,e.batchUuid]),c=to(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){no(e,t,n[t])}))}return e}({},e),r=null!=(r={quantity:null!==(t=o.quantity)&&void 0!==t?t:""})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n):e}));return n?l().createElement(a.lSo,{status:"active"}):l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,i=n.ref;return l().createElement(a.CtY,{style:{flexGrow:"1"},titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:d||[],onChange:function(t){var n,o;null===(n=e.onBatchNoChanged)||void 0===n||n.call(e,t.selectedItem),r(null===(o=t.selectedItem)||void 0===o?void 0:o.uuid)},initialSelectedItem:o,itemToString:function(e){var t;return(null==e?void 0:e.batchNo)?"".concat(null==e?void 0:e.batchNo," | Qty: ").concat(null!==(t=null==e?void 0:e.quantity)&&void 0!==t?t:""):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),n&&l().createElement(a.lSo,{status:"active"}))};function oo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ao(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const io=function(e){var t=e.canEdit,n=e.showQuantityRequested,o=e.requiresActualBatchInformation,c=e.requiresBatchUuid,s=e.canUpdateBatchInformation,u=e.canCapturePurchasePrice,d=e.batchBalance,m=e.control,p=e.setValue,A=e.errors,g=e.remove,f=e.fields,v=ao((0,i.useState)(),2),_=(v[0],v[1]),h=ao((0,i.useState)(),2),b=(h[0],h[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,h,y,k,C,E,w,S,O,D,x,N,I,T,P,B,U,j,z,F,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?Zr.desktopRow:Zr.tabletRow,key:null==e?void 0:e.uuid},l().createElement(a.pj1,null,t&&(null==e?void 0:e.uuid.startsWith("new-item"))&&l().createElement(Wr,{placeholder:"Select an item",controllerName:"stockItems.".concat(i,".stockItemUuid"),name:re,control:m,invalid:!!(null==A||null===(h=A.stockItems)||void 0===h||null===(v=h[i])||void 0===v?void 0:v.stockItemUuid),onStockItemChanged:function(e){var t;!function(e,t){if(t){var n=f[e];if(n){var r,o,a,i;n.stockItemName=null!==(a=(null==t?void 0:t.drugName)?"".concat(null==t?void 0:t.drugName).concat((null!==(r=null==t?void 0:t.commonName)&&void 0!==r?r:null==t?void 0:t.conceptName)?" (".concat(null!==(o=null==t?void 0:t.commonName)&&void 0!==o?o:null==t?void 0:t.conceptName,")"):""):null)&&void 0!==a?a:null==t?void 0:t.conceptName;var l=null===(i=null==t?void 0:t.hasExpiration)||void 0===i||i;n.hasExpiration=l,l||(n.expiration=null),n.stockItemUuid=null==t?void 0:t.uuid,n.stockItemPackagingUOMUuid=null,n.stockItemPackagingUOMName=null,n.stockBatchUuid=null}}}(i,e),p("stockItems.".concat(i,".packagingUnits"),null==e?void 0:e.packagingUnits),_(null!==(t=null==e?void 0:e.uuid)&&void 0!==t?t:"")}}),(!t||!e.uuid.startsWith("new-item"))&&l().createElement(a.rUS,{target:"_blank",to:(ne=null==e?void 0:e.stockItemUuid,"".concat("/stock-items","/").concat(ne).concat(""))},"".concat(null==e?void 0:e.stockItemName))),n&&l().createElement(a.pj1,null,null!==(Y=null==e||null===(y=e.quantityRequested)||void 0===y?void 0:y.toLocaleString())&&void 0!==Y?Y:""," ",null!==(Q=null==e?void 0:e.quantityRequestedPackagingUOMName)&&void 0!==Q?Q:""),(o||c)&&l().createElement(a.pj1,null,o&&(t||s&&(null==e||null===(k=e.permission)||void 0===k?void 0:k.canUpdateBatchInformation))&&l().createElement(a.oil,{size:"sm",maxLength:50,onChange:function(e){return p("stockItems.".concat(i,".batchNo"),e.target.value)},defaultValue:e.batchNo,invalidText:"",invalid:null==A||null===(E=A.stockItems)||void 0===E||null===(C=E[i])||void 0===C?void 0:C.batchNo}),c&&!o&&t&&l().createElement(ro,{batchUuid:null==e?void 0:e.stockBatchUuid,onBatchNoChanged:function(e){p("stockItems.".concat(i,".batchNo"),null==e?void 0:e.batchNo),p("stockItems.".concat(i,".expiration"),null==e?void 0:e.expiration),b(null==e?void 0:e.expiration)},placeholder:"Filter...",invalid:!!(null==A||null===(S=A.stockItems)||void 0===S||null===(w=S[i])||void 0===w?void 0:w.stockBatchUuid),control:m,controllerName:"stockItems.".concat(i,".stockBatchUuid"),name:"stockItems.".concat(i,".stockBatchUuid"),stockItemUuid:e.stockItemUuid}),!(s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=ao(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder: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===(B=A.stockItems)||void 0===B||null===(P=B[i])||void 0===P||null===(T=P.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===(z=d[null==e?void 0:e.stockBatchUuid])||void 0===z?void 0:z.quantityUoM)&&void 0!==K?K:""):"",invalid:!!(null==A||null===(L=A.stockItems)||void 0===L||null===(F=L[i])||void 0===F?void 0:F.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Kr,{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 lo=n(6360),co={};co.styleTagTransform=h(),co.setAttributes=g(),co.insert=p().bind(null,"head"),co.domAPI=d(),co.insertStyleElement=v(),s()(lo.Z,co);const so=lo.Z&&lo.Z.locals?lo.Z.locals:void 0;function uo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ao(e){return function(e){if(Array.isArray(e))return uo(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||go(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function go(e,t){if(e){if("string"==typeof e)return uo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uo(e,t):void 0}}const fo=function(e){var t,n,o,c,s,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,f=u.batchNos,v=u.canUpdateItemsBatchInformation,_=u.itemUoM,h=e.canEdit,b=void 0===h||h,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,O=Tr().formContext,D=function(e){if("requisition"===e){var t=Mr.omit({batchNo:!0,expiration:!0});return ur.z.object({stockItems:ur.z.array(t)})}return qr}(S),x=(t=function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return 0==e.stockItems.length?("No stock items","You haven't added any stock items, tap the add button to add some.",(0,r.showToast)({critical:!0,title:"No stock items",kind:"error",description:"You haven't added any stock items, tap the add button to add some."}),[2]):(y.stockOperationItems=null==e?void 0:e.stockItems,[4,null==k?void 0:k(y)]);case 1:return t.sent(),[2]}}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){mo(a,r,o,i,l,"next",e)}function l(e){mo(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,cr.cI)({resolver:(0,sr.F)(D),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,P=N.setValue,B=N.formState.errors,U=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||go(c,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],j=(0,cr.Dq)({name:"stockItems",control:T}),z=j.fields,F=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==O?void 0:O.stockItems){var e=null==O?void 0:O.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==O?void 0:O.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(Ao(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),Ao(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),Ao(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),Ao(m?[{key:"expiry",header:w("expiry","Expiry")}]:[]),[{key:"quantity",header:d?w("qtyIssued","Qty Issued"):w("qty","Qty")},{key:"quantityuom",header:w("quantityUom","Qty UoM")}],Ao(A?[{key:"purchaseprice",header:w("purchasePrice","Purchase Price")}]:[])),q=function(){var e="new-item-".concat("".concat((new Date).getTime(),"-").concat(Math.random().toString(36).substring(2,16)));F({uuid:e,id:e})};return l().createElement("div",{style:{margin:"10px"}},l().createElement("div",{className:so.tableContainer},l().createElement(a.wQF,{rows:null!==(R=null==y?void 0:y.stockOperationItems)&&void 0!==R?R:[{uuid:"new-item-1",id:"new-item-1"}],headers:M,isSortable:!1,useZebraStyles:!0,styles:{width:"100%"},render:function(e){var t,n=e.headers,o=e.getHeaderProps,i=e.getTableProps;return l().createElement(a.xJi,null,l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){var t,n,i,c;return l().createElement(a.xDH,(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){po(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?so.desktopHeader:so.tabletHeader,style:null==e?void 0:e.styles,key:"".concat(e.key)})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(c,e))})),i),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:null==e?void 0:e.header)})),b&&l().createElement(a.xDH,{style:{width:"3% !important"}},l().createElement("div",{style:{width:"3% !important",display:"flex",flexDirection:"row",gap:"8px"}},l().createElement(a.zxk,{renderIcon:he.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:he.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(io,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:f,control:T,setValue:P,errors:B,remove:L,append:F,canEdit:b,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:z})," ")))}})))};var vo=n(8808);function _o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ho(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function bo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ho(a,r,o,i,l,"next",e)}function l(e){ho(a,r,o,i,l,"throw",e)}i(void 0)}))}}function yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ko(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const Co=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=yo((0,i.useState)(!1),2),d=u[0],m=u[1],p=yo((0,i.useState)(null),2),A=p[0],g=p[1];return l().createElement("div",{style:{margin:"10px"}},t&&!n&&l().createElement("div",{style:{margin:"10px"}},l().createElement(a.SYO,{name:"rbgApprovelRequired",legendText:s("doesThisTransactionRequireApproval","Does the transaction require approval ?"),onChange:function(e){g(e)},defaultSelected:A},l().createElement(a.EUY,{value:!0,id:"rbgApprovelRequired-true",labelText:s("yes","Yes")}),l().createElement(a.EUY,{value:!1,id:"rbgApprovelRequired-false",labelText:s("no","No")}))),!t&&l().createElement(l().Fragment,null,l().createElement(a.oil,{style:{margin:"5px"},id:"rbgApproveRequiredLbl",value:A?s("yes","Yes"):s("no","No"),readOnly:!0,labelText:s("doesThisTransactionRequireApproval","Does the transaction require approval ?")})),t&&!n&&l().createElement("div",{className:"stkpg-form-buttons",style:{margin:"10px"}},null!=A&&l().createElement(l().Fragment,null,!o&&!A&&l().createElement(a.zxk,{name:"complete",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:bo((function(){return ko(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:ge.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:st.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:vo.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:bo((function(){return ko(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r)];case 1:return e.sent(),m(!1),[2]}}))})),kind:"secondary",renderIcon:vo.vc},d?l().createElement(a.lSo,null):s("save","Save")),!d&&l().createElement(a.zxk,{type:"button",style:{margin:"4px"},className:"cancelButton",kind:"tertiary",onClick:c.onGoBack,renderIcon:Zt.WP},s("goBack","Go Back"))))};var Eo="Location",wo="Other";function So(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Oo(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,E,w,S,O,D,x,N,I,T,P,B,U,j,z,F,L,R,M,q,G,H;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(Z){switch(Z.label){case 0:return A=!!t,g=[],f=!1,v=n,h=null!==(_=null==t||null===(o=t.permission)||void 0===o?void 0:o.isRequisitionAndCanIssueStock)&&void 0!==_&&_,y=null!==(b=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!==b?b:[],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(yr()),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,(0,r.openmrsFetch)("ws/rest/v1/stockmanagement/party?v=default")]):[3,2];case 1:if(!(I=Z.sent()).ok)throw Error("Error loading parties");return O=null==I||null===(N=I.data)||void 0===N||null===(x=N.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Eo&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wo})),(null==e?void 0:e.hasSource)&&A&&k&&(null==O?void 0:O.length)>0&&(T=O[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(D=null==I||null===(B=I.data)||void 0===B||null===(P=B.results)||void 0===P?void 0:P.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Eo&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wo})),A&&w&&(null==D?void 0:D.length)>0&&(U=D[0],p.destinationUuid=U.uuid,p.destinationName=U.name)),[3,4];case 2:return[4,Ot()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return z=Vn(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=z,"adjustment"===Y),requiresBatchUuid:$n(z),requiresActualBatchInfo:er(z),isQuantityOptional:tr(z),canCaptureQuantityPrice:nr(z),requiresStockAdjustmentReason:Xn(z),requiresDispatchAcknowledgement:rr(z),allowExpiredBatchNumbers:null!==(F=null==e?void 0:e.allowExpiredBatchNumbers)&&void 0!==F&&F,canEditModel:null!==(L=null==t||null===(l=t.permission)||void 0===l?void 0:l.canEdit)&&void 0!==L&&L,canViewModel:null!==(R=null==t||null===(c=t.permission)||void 0===c?void 0:c.canView)&&void 0!==R&&R,canApproveModel:null!==(M=null==t||null===(s=t.permission)||void 0===s?void 0:s.canApprove)&&void 0!==M&&M,canIssueStock:h,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:h||or(z),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===Eo&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===wo},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===Eo&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===wo},location:S,sourcePartyList:O,destinationPartyList:D,stockOperationTypes:v,hasQtyRequested:f}]}var Y}))},Oo=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){So(a,r,o,i,l,"next",e)}function l(e){So(a,r,o,i,l,"throw",e)}i(void 0)}))},Oo.apply(this,arguments)}function Do(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Do(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Do(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var No=n(3133);function Io(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const To=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(No.Wz,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Io(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Po(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Bo=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){Po(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Uo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Return",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(_e.eL,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Uo(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};function zo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Fo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Cancel",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,kind:"danger--ghost",renderIcon:function(e){return l().createElement(dt.jj,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){zo(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function Lo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var Ro,Mo,qo=(Ro=function(e,t,n,r,o){var a,i,l,c,s,u,d,m,p,A,g;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(f){return a={},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]}))},Mo=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=Ro.apply(e,t);function a(e){Lo(o,n,r,a,i,"next",e)}function i(e){Lo(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Mo.apply(this,arguments)});function Go(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Go(a,r,o,i,l,"next",e)}function l(e){Go(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Zo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Yo=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return'<html>\n<head>\n<meta http-equiv=Content-Type content="text/html; charset=utf8">\n<title>'.concat(null!=t?t:"","</title>\n<style>\n").concat('\n/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the main element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on h1 elements within section and\n * article contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent sub and sup elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type="button"],\n[type="reset"],\n[type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type="button"]::-moz-focus-inner,\n[type="reset"]::-moz-focus-inner,\n[type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type="button"]:-moz-focusring,\n[type="reset"]:-moz-focusring,\n[type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from fieldset elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * fieldset elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type="checkbox"],\n[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type="number"]::-webkit-inner-spin-button,\n[type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to inherit in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n/*!\n * Gutenberg\n *\n * MIT Fabien Sa\n * https://github.com/BafS/Gutenberg\n */\n\n* {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n *,\n *:before,\n *:after,\n p:first-letter,\n div:first-letter,\n blockquote:first-letter,\n li:first-letter,\n p:first-line,\n div:first-line,\n blockquote:first-line,\n li:first-line {\n background: transparent !important;\n box-shadow: none !important;\n text-shadow: none !important;\n }\n \n html {\n font-size: 16px;\n margin: 0;\n padding: 0;\n }\n \n body {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n background: #fff !important;\n color: #000 !important;\n font-family: Arial, sans-serif, "Helvetica Neue", Helvetica;\n font-size: 1rem;\n line-height: 1.5;\n margin: 0 auto;\n text-rendering: optimizeLegibility;\n }\n \n p,\n blockquote,\n table,\n ul,\n ol,\n dl {\n margin-bottom: 1.5rem;\n margin-top: 0;\n }\n \n p:last-child,\n ul:last-child,\n ol:last-child {\n margin-bottom: 0;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: #000;\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n line-height: 1.2;\n margin-bottom: 0.75rem;\n margin-top: 0;\n }\n \n h1 {\n font-size: 2.5rem;\n }\n \n h2 {\n font-size: 2rem;\n }\n \n h3 {\n font-size: 1.75rem;\n }\n \n h4 {\n font-size: 1.5rem;\n }\n \n h5 {\n font-size: 1.25rem;\n }\n \n h6 {\n font-size: 1rem;\n }\n \n a,\n a:visited {\n color: #000;\n text-decoration: underline;\n word-wrap: break-word;\n }\n \n table {\n border-collapse: collapse;\n }\n \n thead {\n display: table-header-group;\n }\n \n table,\n th,\n td {\n border-bottom: 1px solid #000;\n }\n \n td,\n th {\n padding: 0px;\n page-break-inside: avoid;\n }\n \n code,\n pre,\n kbd {\n border: 1px solid #bbb;\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n font-size: 85%;\n }\n \n code,\n kbd {\n padding: 3px;\n }\n \n pre {\n margin-bottom: 1.5rem;\n padding: 10px 12px;\n }\n \n pre code,\n pre kbd {\n border: 0;\n }\n \n ::-webkit-input-placeholder {\n color: transparent;\n }\n \n :-moz-placeholder {\n color: transparent;\n }\n \n ::-moz-placeholder {\n color: transparent;\n }\n \n :-ms-input-placeholder {\n color: transparent;\n }\n \n blockquote {\n border: 0;\n border-left: 5px solid #bbb;\n margin-left: 1px;\n padding: 12px 1.5rem;\n }\n \n [dir=\'rtl\'] blockquote {\n border-left: 0;\n border-right: 5px solid #bbb;\n margin-left: 0;\n margin-right: 1px;\n }\n \n blockquote:first-child {\n margin-top: 0;\n }\n \n blockquote p:last-child,\n blockquote ul:last-child,\n blockquote ol:last-child {\n margin-bottom: 0;\n }\n \n blockquote footer {\n display: block;\n font-size: 80%;\n }\n \n img {\n border: 0;\n display: block;\n max-width: 100% !important;\n vertical-align: middle;\n }\n \n hr {\n border: 0;\n border-bottom: 2px solid #bbb;\n height: 0;\n margin: 2.25rem 0;\n padding: 0;\n }\n \n dt {\n font-weight: bold;\n }\n \n dd {\n margin: 0;\n margin-bottom: 0.75rem;\n }\n \n abbr[title],\n acronym[title] {\n border: 0;\n text-decoration: none;\n }\n \n table,\n blockquote,\n pre,\n code,\n figure,\n li,\n hr,\n ul,\n ol,\n a,\n tr {\n page-break-inside: avoid;\n }\n \n h2,\n h3,\n h4,\n p,\n a {\n orphans: 3;\n widows: 3;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n page-break-after: avoid;\n page-break-inside: avoid;\n }\n \n h1+p,\n h2+p,\n h3+p {\n page-break-before: avoid;\n }\n \n img {\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: avoid;\n }\n \n pre {\n white-space: pre-wrap !important;\n word-wrap: break-word;\n }\n \n body {\n padding-bottom: 1cm;\n padding-left: 1cm;\n padding-right: 1cm;\n padding-top: 0.5cm;\n }\n \n a[href^=\'http\']:after,\n a[href^=\'ftp\']:after {\n content: " (" attr(href) ")";\n font-size: 80%;\n }\n \n a[href$=\'.jpg\']:after,\n a[href$=\'.jpeg\']:after,\n a[href$=\'.gif\']:after,\n a[href$=\'.png\']:after {\n display: none;\n }\n \n abbr[title]:after,\n acronym[title]:after {\n content: " (" attr(title) ")";\n }\n \n .page-break,\n .break-before,\n .page-break-before {\n page-break-before: always;\n }\n \n .break-after,\n .page-break-after {\n page-break-after: always;\n }\n \n .avoid-break-inside {\n page-break-inside: avoid;\n }\n \n .no-print {\n display: none;\n }\n \n a.no-reformat:after {\n content: \'\';\n }\n \n abbr[title].no-reformat:after,\n acronym[title].no-reformat:after {\n content: \'\';\n }\n \n .no-reformat abbr:after,\n .no-reformat acronym:after,\n .no-reformat a:after {\n content: \'\';\n }\n /*Custom CSS*/\n .right {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n margin-right: 0;\n } \n .text {\n margin-top:0in;\n margin-right:0in;\n margin-bottom:3.0pt;\n margin-left:0in;\n line-height:106%;\n font-size:12.5pt;\n } \n .logo-row {\n width: 99%;\n }\n .logo {\n width: 120; \n line-height:110%;\n text-align: center;\n margin-top: 4pt;\n }\n .logo img, .logo svg {\n width: 52;\n height: auto;\n }\n span.logo-text {\n font-size:8.0pt;\n display: block;\n white-space:nowrap;\n line-height: 110%;\n margin-top: 4pt;\n } \n .heading, .heading-row {\n margin-left:12.75pt;\n clear: both;\n }\n .heading {\n font-size:14.5pt;\n line-height:102%;\n }\n .heading-row, .heading-row table { \n font-size: 13.5pt;\n }\n .heading-row {\n margin-top: 14pt;\n }\n .heading table, .heading-row table, .heading-row td {\n border: 0;\n }\n .table-data {\n border: 0;\n border-collapse:collapse;\n margin-left:6.95pt;\n font-size:12.5pt;\n width: 99%;\n page-break-inside: auto;\n }\n .table-data td, .table-data th {\n padding:0 5.75pt 0 5.15pt;\n }\n .table-data td, .table-data th {\n border-top:none;\n border-left:none;\n border-right:solid black 1.0pt;\n vertical-align: middle;\n height: 30pt;\n }\n .table-data th {\n border-bottom:double black 1.5pt;\n } \n .table-data td {\n border-bottom:solid black 1.0pt;\n }\n .table-data th:first-child, .table-data td:first-child {\n border-left:solid black 1.0pt;\n } \n .center {\n text-align: center;\n } \n .left {\n text-align: left;\n }\n .table-data tr.footer-field td {\n height:32pt;\n vertical-align: middle;\n }\n @page { size: auto; margin: 0mm; }\n','\n</style>\n</head>\n<body onload="').concat(n?"window.print()":"","\" style='word-wrap:break-word' ").concat(r?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Qo=function(){var e=Ho((function(){var e,t;return Zo(this,(function(n){switch(n.label){case 0:e=null,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(r=ne?"".concat(ae).concat(ne):"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",new Promise((function(e,t){var n;if(r){var o=document.getElementById("hdnTxtPrintLogo");if(o&&(null===(n=o.value)||void 0===n?void 0:n.length)>0){var a=o.getAttribute("isSvg");e({image:o.value,isSvg:"1"===a})}else if(r.toLowerCase().endsWith(".svg"))fetch(r,{headers:{"Disable-WWW-Authenticate":"true"}}).then((function(e){if(!e.ok)throw new Error("Print logo fetch network response was not OK");return e.text()})).then((function(t){o&&(o.value=t,o.setAttribute("isSvg","1")),e({image:t,isSvg:!0})})).catch((function(e){console.error("Error fetching print logo: ",e),t("Error fetching print logo")}));else{var i=new Image;i.addEventListener("load",(function(){try{var n=document.createElement("canvas");n.width=i.width,n.height=i.height;var r=n.getContext("2d");if(r){r.drawImage(i,0,0);var a=n.toDataURL("image/png");o&&(o.value=a,o.setAttribute("isSvg","0")),e({image:a,isSvg:!1})}else t("Failed to allocate canvas context for print logo")}catch(e){t(e)}})),i.addEventListener("error",(function(e){t(e)})),i.src=r}}else e(null)})))];case 2:return e=n.sent(),[3,4];case 3:return t=n.sent(),console.info(t),[3,4];case 4:return[2,e||re?'\n<div class="logo" >\n '.concat(e?e.isSvg?e.image:"<img alt='' src='".concat(e.image,"' />"):"","\n ").concat(re?"<span class='logo-text text'>".concat(re,"</span>"):"","\n</div> \n "):""]}var r}))}));return function(){return e.apply(this,arguments)}}(),Jo=function(){var e=Ho((function(){var e;return Zo(this,(function(t){switch(t.label){case 0:return[4,Qo()];case 1:return e=t.sent(),[2,'\n<div class="logo-row right">\n'.concat(e,"\n</div> \n ")]}}))}));return function(){return e.apply(this,arguments)}}(),Wo=function(e){setTimeout((function(){!function(e){var t=window.open("","Print-Window");t&&(t.document.open(),t.document.write(e),t.document.close())}(e)}),300)};function Ko(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 Vo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ko(a,r,o,i,l,"next",e)}function l(e){Ko(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Xo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var $o=function(){var e=Vo((function(e){var t,n,r,o,a,i,l,c,s;return Xo(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Jo()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Goods Received Note</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Delivered To: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>GRN#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Received From: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.source)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(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)}}(),ea=function(){var e=Vo((function(e){var t;return Xo(this,(function(n){switch(n.label){case 0:return[4,$o(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ta(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function na(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ta(a,r,o,i,l,"next",e)}function l(e){ta(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ra(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var oa=function(){var e=na((function(e){var t,n,r,o,a,i,l,c,s;return ra(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Jo()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Inventory Transfer</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer From: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>Transfer#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer To: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.destination)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(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)}}(),aa=function(){var e=na((function(e){var t;return ra(this,(function(n){switch(n.label){case 0:return[4,oa(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ia(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function la(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ia(a,r,o,i,l,"next",e)}function l(e){ia(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ca(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var sa=function(){var e=la((function(e){var t,n,r,o,a,i,l,c;return ca(this,(function(s){switch(s.label){case 0:return r=Math.max(0,28-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Jo()];case 1:return o=s.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text">\n <b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Dept/section/ward/dispensary: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(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)}}(),ua=function(){var e=la((function(e){var t;return ca(this,(function(n){switch(n.label){case 0:return[4,sa(e)];case 1:return t=n.sent(),Wo(Yo(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function da(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ma(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const pa=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=((0,r.useConfig)().config,function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){da(a,r,o,i,l,"next",e)}function l(e){da(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,o,a,i,l,c,s;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),n=null,o=null,t.requisitionStockOperationUuid&&(L(t.requisitionStockOperationUuid).then((function(t){t.error||(e=t)})).catch((function(e){e.error})),!e)?[2,null]:((e||"stockissue"===(null==e?void 0:e.operationType)||"transferout"===(null==e?void 0:e.operationType))&&(a={},(null==t?void 0:t.uuid)&&(a.stockOperationUuid=t.uuid),(d=a,m="ws/rest/v1/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="ws/rest/v1/stockmanagement/stockiteminventory".concat(z(e)),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(o=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,qo(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,ea(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,aa(c)];case 4:return u.sent(),[3,7];case 5:return[4,ua(c)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(c),u.label=9;case 9:return[3,11];case 10:return s=u.sent(),console.info(s),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}());return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(C.FB,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ma(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function Aa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ga=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(st.bS,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Aa(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function fa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const va=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(he.aP,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){fa(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function _a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ha=function(e){var t=e.operation,n=e.operations,r=(0,E.useTranslation)().t,o={uuid:"",name:"Stock Issue",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(a.zxk,{onClick:function(){za(t,!1,o,n,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(st.ei,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))}},r("issueStock","Issue Stock "))};var ba=n(2496),ya={};ya.styleTagTransform=h(),ya.setAttributes=g(),ya.insert=p().bind(null,"head"),ya.domAPI=d(),ya.insertStyleElement=v(),s()(ba.Z,ya);const ka=ba.Z&&ba.Z.locals?ba.Z.locals:void 0;function Ca(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ea(e,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 wa(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ea(a,r,o,i,l,"next",e)}function l(e){Ea(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Sa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Sa(e,t,n[t])}))}return e}function Da(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 xa(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 Ca(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ca(e,t):void 0}}(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 Na(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 Ia=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,w,S,O,D,x,N,I,T,P,B,U,j,z,F,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,he,be,ye,ke,Ce,Ee,we,Se,Oe=(0,E.useTranslation)().t,De=e.isEditing,xe=e.canEdit,Ne=e.canPrint,Ie=function(e){var t=xo((0,i.useState)(!0),2),n=t[0],r=t[1],o=xo((0,i.useState)(!1),2),a=o[0],l=o[1],c=xo((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return Oo.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),r(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:s}}(e),Te=Ie.isLoading,Pe=Ie.isError,Be=Ie.result,Ue=xa((0,i.useState)(null==e?void 0:e.isEditing),2),je=Ue[0],ze=Ue[1],Fe=xa((0,i.useState)(null==e?void 0:e.isEditing),2),Le=Fe[0],Re=Fe[1],Me=xa((0,i.useState)(0),2),qe=Me[0],Ge=Me[1];if(Te)return l().createElement(a.MHR,null);if(Pe)return Q(),void(0,r.showToast)({kind:"error",title:Oe("error","Error"),description:Oe("errorLoadingStockOperation","Error loading stock item"),millis:5e3,critical:!0});var He=[{name:"".concat(De?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(Lr,Da(Oa({},e),{isEditing:"Stock Issue"===(null==e||null===(o=e.operation)||void 0===o?void 0:o.name)?!De:De,setup:Be,canEdit:"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?!xe:xe,model:De||"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?null==e?void 0:e.model:null==Be?void 0:Be.dto,onSave:wa((function(){return Na(this,(function(e){return ze(!0),Ge(1),[2]}))})),operation:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(fo,Da(Oa({},e),{isEditing:De,setup:Be,canEdit:xe,model:De||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Be?void 0:Be.dto,onSave:wa((function(){return Na(this,(function(e){return Re(!0),Ge(2),[2]}))}))})),disabled:!(De||je)},{name:(null==Be?void 0:Be.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(Co,Da(Oa({},e),{isEditing:De,setup:Be,canEdit:xe,locked:!1,model:De?null==e?void 0:e.model:null==Be?void 0:Be.dto,requiresDispatchAcknowledgement:De?"return"===(null==e||null===(d=e.model)||void 0===d?void 0:d.operationType)||"issuestock"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType):Be.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=wa((function(t){return Na(this,(function(n){switch(n.label){case 0:return[4,ja(t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){Ge(1)},onComplete:wa((function(){return Na(this,(function(t){switch(t.label){case 0:return[4,Fa("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:wa((function(){return Na(this,(function(t){switch(t.label){case 0:return[4,Fa("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:wa((function(){return Na(this,(function(t){switch(t.label){case 0:return[4,Fa("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||Le)}];return l().createElement(l().Fragment,null,De||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},De&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:ka.textHeading},Oe("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(null==e||null===(p=e.model)||void 0===p?void 0:p.status))}},null==e||null===(A=e.model)||void 0===A?void 0:A.status)),l().createElement("div",{className:ka.statusContainer},(null==e||null===(g=e.model)||void 0===g?void 0:g.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(v=e.model)||void 0===v?void 0:v.creatorFamilyName," ",null==e||null===(_=e.model)||void 0===_?void 0:_.creatorGivenName))),(null==e||null===(h=e.model)||void 0===h?void 0:h.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(y=e.model)||void 0===y?void 0:y.submittedByFamilyName," ",null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByGivenName))),(null==e||null===(C=e.model)||void 0===C?void 0:C.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedByFamilyName," ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(D=e.model)||void 0===D?void 0:D.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(N=e.model)||void 0===N?void 0:N.returnedByFamilyName," ",null==e||null===(I=e.model)||void 0===I?void 0:I.returnedByGivenName),l().createElement("span",{className:ka.text},null==e||null===(T=e.model)||void 0===T?void 0:T.returnReason))),(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(B=e.model)||void 0===B?void 0:B.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(U=e.model)||void 0===U?void 0:U.completedByFamilyName," ",null==e||null===(j=e.model)||void 0===j?void 0:j.completedByGivenName))),"CANCELLED"===(null==e||null===(z=e.model)||void 0===z?void 0:z.status)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(F=e.model)||void 0===F?void 0:F.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(L=e.model)||void 0===L?void 0:L.cancelledByFamilyName," ",null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByGivenName,l().createElement("span",{className:ka.text},null==e||null===(M=e.model)||void 0===M?void 0:M.cancelReason)))),"REJECTED"===(null==e||null===(G=e.model)||void 0===G?void 0:G.status)&&l().createElement("div",null,l().createElement("span",{className:ka.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:ka.statusDescriptions},l().createElement("span",{className:ka.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(H=e.model)||void 0===H?void 0:H.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:ka.text},"By"),l().createElement("span",{className:ka.text},null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedByFamilyName," ",null==e||null===(Y=e.model)||void 0===Y?void 0:Y.rejectedByGivenName,l().createElement("span",null,null==e||null===(J=e.model)||void 0===J?void 0:J.rejectionReason)))))),(!(null==e||null===(K=e.model)||void 0===K||null===(W=K.permission)||void 0===W?void 0:W.canEdit)&&((null==e||null===(X=e.model)||void 0===X||null===(V=X.permission)||void 0===V?void 0:V.canApprove)||(null==e||null===(ee=e.model)||void 0===ee||null===($=ee.permission)||void 0===$?void 0:$.canReceiveItems))||(null==e||null===(ne=e.model)||void 0===ne||null===(te=ne.permission)||void 0===te?void 0:te.canEdit)||Ne||(null==e||null===(oe=e.model)||void 0===oe||null===(re=oe.permission)||void 0===re?void 0:re.isRequisitionAndCanIssueStock))&&l().createElement("div",{style:{margin:"10px",display:"flex",flexDirection:"row"}},l().createElement(l().Fragment,null,!(null==e||null===(ie=e.model)||void 0===ie||null===(ae=ie.permission)||void 0===ae?void 0:ae.canEdit)&&(null==e||null===(ce=e.model)||void 0===ce||null===(le=ce.permission)||void 0===le?void 0:le.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(se=e.model)||void 0===se?void 0:se.operationTypeName)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(To,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Kn.RETURN_OPERATION_TYPE||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Kn.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ga,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Bo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jo,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Fo,{operation:null==e?void 0:e.model}))),!(null==e||null===(Ae=e.model)||void 0===Ae||null===(pe=Ae.permission)||void 0===pe?void 0:pe.canEdit)&&(null==e||null===(fe=e.model)||void 0===fe||null===(ge=fe.permission)||void 0===ge?void 0:ge.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(va,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(jo,{operation:null==e?void 0:e.model}))),(null==e||null===(_e=e.model)||void 0===_e||null===(ve=_e.permission)||void 0===ve?void 0:ve.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Fo,{operation:null==e?void 0:e.model})),(null==e||null===(be=e.model)||void 0===be||null===(he=be.permission)||void 0===he?void 0:he.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(ha,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(ke=e.model)||void 0===ke||null===(ye=ke.permission)||void 0===ye?void 0:ye.isRequisitionAndCanIssueStock)||(null==e||null===(Ce=e.model)||void 0===Ce?void 0:Ce.operationType)===Kn.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Kn.REQUISITION_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Kn.RECEIPT_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Kn.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(pa,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Pr,null,l().createElement(Wn,{tabs:He,selectedIndex:qe,onChange:Ge})))};var Ta=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};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 Ba(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 Ua(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var ja=function(){var e=Ba((function(e,t,n,o,a){var i,l,c,s;return Ua(this,(function(o){switch(o.label){case 0:i=e,o.label=1;case 1:return o.trys.push([1,3,,4]),"requisition"===n.operationType&&delete i.destinationName,[4,(t?M:R)(i)];case 2:return(null==(l=o.sent())?void 0:l.data)&&(Ta("ws/rest/v1/stockmanagement/stockoperation"),(0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",description:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Q()),[3,4];case 3:return c=o.sent(),s=le(c),(0,r.showNotification)({description:s.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),za=function(e,t,n,r,o){Y("".concat(t?"Edit":"New: "," ").concat(t?null==e?void 0:e.operationTypeName:null==n?void 0:n.name),l().createElement(Ia,{model:e,onSave:function(e){return ja(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},Fa=function(){var e=Ba((function(e,t,n){var o;return Ua(this,(function(a){return o=(0,r.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return o()}}),[2]}))}));return function(t,n,r){return e.apply(this,arguments)}}();function La(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Ra=function(e){var t,n,r=e.operationUuid,o=e.operationNumber,c=e.model,s=e.operations,u=(t=(0,i.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return La(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?La(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1];r&&!d&&L(r).then((function(e){return m(e.data)})).catch((function(e){return console.error("Error fetching stock operation:",e)}));var p={uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1};return l().createElement(l().Fragment,null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"View",kind:"ghost",onClick:function(){za(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Ma(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Ga(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ga(e,t){if(e){if("string"==typeof e)return Ma(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ma(e,t):void 0}}const Ha=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=xt(t),c=o.items,s=o.isLoading,u=qa((0,i.useState)(!1),2),d=u[0],m=u[1],p=qa((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(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 Ma(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Ga(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m(s));break;case te.OPERATION: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:Fn.filtersAlign,id:"multiSelect",label:r,size:"md",labelInline:!0,items:A,itemToString:function(e){return e?e.display:"Not Set"},onChange:function(e){var t=e.selectedItems;t&&n(t.map((function(e){return e.display})),r)},placeholder:"Filter by ".concat(r),style:{minWidth:"auto",width:"auto"}})};function Za(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ya(e,t,n[t])}))}return e}function Ja(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Wa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Za(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Za(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ka=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=Wa((0,i.useState)(c),2),_=v[0],h=v[1],b=Wa((0,i.useState)(null),2),y=b[0],k=b[1],C=Wa((0,i.useState)(null),2),w=C[0],S=C[1],O=Wa((0,i.useState)([]),2),D=O[0],x=O[1],N=Wa((0,i.useState)([]),2),I=N[0],T=N[1],P=Wa((0,i.useState)([]),2),B=P[0],j=P[1],z=(0,r.useConfig)(),F=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",operation:n,requireReason:"",closeModal:function(){return e()}});Ta("ws/rest/v1/stockmanagement/stockoperation")};(0,i.useEffect)((function(){R()}),[y,w,D,I,B,u,A]);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;D.length>0&&(e=e.filter((function(e){return D.includes(e.sourceName)}))),B.length>0&&(e=e.filter((function(e){return B.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}))),h(e)},M=(0,i.useMemo)((function(){return null==_?void 0:_.map((function(t,r){var o,i,c,s,u,d,m,p,A,g,f,v,h,b,y,k,C,E,w;return Ja(Qa({},t),{id:null==t?void 0:t.uuid,key:"key-".concat(null==t?void 0:t.uuid),operationTypeName:"".concat(null==t?void 0:t.operationTypeName),operationNumber:l().createElement(Ra,{model:_[r],operations:e}),status:"".concat(null==t?void 0:t.status),source:"".concat(null!==(o=null==t?void 0:t.sourceName)&&void 0!==o?o:""),destination:"".concat(null!==(i=null==t?void 0:t.destinationName)&&void 0!==i?i:""),location:l().createElement(l().Fragment,null," ",null!==(c=null==t?void 0:t.sourceName)&&void 0!==c?c:""," ",(null==t?void 0:t.sourceName)&&(null==t?void 0:t.destinationName)?l().createElement(he.ol,{size:16}):""," ",null!==(s=null==t?void 0:t.destinationName)&&void 0!==s?s:""," "),responsiblePerson:"".concat(null!==(d=null!==(u=null==t?void 0:t.responsiblePersonFamilyName)&&void 0!==u?u:null==t?void 0:t.responsiblePersonOther)&&void 0!==d?d:""," ").concat(null!==(m=null==t?void 0:t.responsiblePersonGivenName)&&void 0!==m?m:""),operationDate:K(null==t?void 0:t.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Created"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.dateCreated))," ","By",l().createElement("span",{className:"action-by"},null!==(p=t.creatorFamilyName)&&void 0!==p?p:""," ",null!==(A=t.creatorGivenName)&&void 0!==A?A:""))),"NEW"!==(null==t?void 0:t.status)&&(null==t?void 0:t.status)!==Ln&&(null==t?void 0:t.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Submitted"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.submittedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(g=t.submittedByFamilyName)&&void 0!==g?g:""," ",null!==(f=t.submittedByGivenName)&&void 0!==f?f:""))),(null==t?void 0:t.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Completed"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.completedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(v=t.completedByFamilyName)&&void 0!==v?v:""," ",null!==(h=t.completedByGivenName)&&void 0!==h?h:""))),(null==t?void 0:t.status)===Rn&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Cancelled"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},K(null==t?void 0:t.cancelledDate))," ","By",l().createElement("span",{className:"action-by"},null!==(b=t.cancelledByFamilyName)&&void 0!==b?b:""," ",null!==(y=t.cancelledByGivenName)&&void 0!==y?y:""),l().createElement("p",null,t.cancelReason))),(null==t?void 0:t.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==t?void 0:t.rejectedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(k=t.rejectedByFamilyName)&&void 0!==k?k:""," ",null!==(C=t.rejectedByGivenName)&&void 0!==C?C:""),l().createElement("p",null,t.rejectionReason))),(null==t?void 0:t.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==t?void 0:t.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(E=t.returnedByFamilyName)&&void 0!==E?E:""," ",null!==(w=t.returnedByGivenName)&&void 0!==w?w:""),l().createElement("p",null,t.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:F}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){za(_[r],!0,n,e,!1)}}))})}))}),[F,_,n,e]);return f?l().createElement(a.gqd,{className:Fn.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:Fn.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:Fn.toolbarContent},l().createElement(a.Ys1,{className:Fn.patientListSearch,expanded:!0,onChange:m,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:Fn.filterContainer},l().createElement(a.Mtg,{className:Fn.dateAlign,datePickerType:"range",dateFormat:X,value:[y,w],onChange:function(e){var t=Wa(e,2);!function(e){var t=Wa(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(Ha,{conceptUuid:z.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:L}),l().createElement(Ha,{filterName:te.STATUS,onFilterChange:L}),l().createElement(Ha,{filterName:te.OPERATION,onFilterChange:L})),l().createElement(Zn,{onOperationTypeSelected:function(t){za(yr(),!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,Ja(Qa({},s({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Fn.desktopHeader:Fn.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,h,b,y,k,C,E,w,S,O,D,x,N,I,T,P,B,U,j,z,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Qa({className:r.isDesktop?Fn.desktopRow:Fn.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===(h=_[n])||void 0===h?void 0:h.creatorFamilyName:""),l().createElement(a.agF,null,(null===(b=_[n])||void 0===b?void 0:b.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===(O=_[n])||void 0===O?void 0:O.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(D=_[n])||void 0===D?void 0:D.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===(P=_[n])||void 0===P?void 0:P.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(B=_[n])||void 0===B?void 0:B.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===(z=_[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=_[n])||void 0===F?void 0:F.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:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:Fn.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:Fn.paginationOverride}))},Va=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ka,null))};var Xa={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function $a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ei(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ti(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ni(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const ri=function(e){var t,n,o=function(e){var t=ei((0,i.useState)(e||{v:U.Default,startIndex:0}),2),n=t[0],o=(t[1],function(e){var t="ws/rest/v1/drug".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n)),a=o.items.results,l=o.isLoading,c=ei((0,i.useState)(""),2),s=c[0],u=c[1],d=ei((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=ei((0,i.useState)((null==e?void 0:e.v)||U.Default),2),g=A[0],f=A[1];return(0,i.useEffect)((function(){}),[s,m,g]),{drugList:a,setLimit:p,setRepresentation:f,setSearchString:u,isLoading:l}}(),c=o.isLoading,s=o.drugList,u=(t=(0,i.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ti(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ti(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?s:s.filter((function(e){return e.name.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,s]);return l().createElement("div",null,l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p||[],initialSelectedItem:null!==(n=null==s?void 0:s.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:ni,onChange:function(t){var n;null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),o(t.selectedItem.uuid)},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}),c&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))};var oi=ur.z.string().max(255).nullish(),ai=ur.z.object({isDrug:ur.z.boolean(),drugUuid:ur.z.string().nullish(),drugName:ur.z.string().nullish(),commonName:oi,acronym:oi,hasExpiration:ur.z.boolean(),expiryNotice:ur.z.coerce.number().nullish(),uuid:ur.z.string().nullish(),conceptUuid:ur.z.string().nullish(),conceptName:ur.z.string().nullish(),preferredVendorUuid:ur.z.string().nullish(),preferredVendorName:ur.z.string().nullish(),purchasePrice:ur.z.number().nullish(),purchasePriceUoMUuid:ur.z.string().nullish(),purchasePriceUoMName:ur.z.string().nullish(),categoryUuid:ur.z.string().nullish(),categoryName:ur.z.string().nullish(),dispensingUnitUuid:ur.z.string().nullish(),dispensingUnitName:ur.z.string().nullish(),dispensingUnitPackagingUoMUuid:ur.z.string().nullish(),dispensingUnitPackagingUoMName:ur.z.string().nullish(),defaultStockOperationsUoMUuid:ur.z.string().nullish(),defaultStockOperationsUoMName:ur.z.string().nullish(),reorderLevel:ur.z.number().nullish(),reorderLevelUoMUuid:ur.z.string().nullish(),reorderLevelUoMName:ur.z.string().nullish(),dateCreated:ur.z.coerce.date().nullish(),creatorGivenName:ur.z.string().nullish(),creatorFamilyName:ur.z.string().nullish(),voided:ur.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function ii(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const li=function(e){return l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.SYO,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ii(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t,n,r){i(t,n,r),e.onChange&&e.onChange(t,n,r)},id:e.name,ref:s,defaultSelected:e.id,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),e.options.map((function(t,n){return l().createElement(a.EUY,{key:"".concat(n,"-").concat(e.name,"-").concat(t.value),id:"".concat(e.name,"-").concat(t.value),labelText:t.label,value:t.value,checked:c===t.value,onChange:function(){return i(t.value)},ref:s})})))}})},ci=function(e){return l().createElement(cr.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)}})}})},si=function(e){var t=xt((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n;null===(n=e.onDispensingUnitChange)||void 0===n||n.call(e,t.selectedItem),c(t.selectedItem.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.dispensingUnitUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.display)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},ui=function(e){var t=nn({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.preferredVendorUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},di=function(e){var t=xt((0,r.useConfig)().stockItemCategoryUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(cr.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})}})},mi=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits[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(cr.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)},pi=function(e){var t,n,r,o,i,c,s,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=Je(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(mi,{name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(mi,{name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),v?l().createElement(a.iJ5,null):l().createElement(ci,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(s=f.reorderLevel)&&void 0!==s?s:"",invalidText:p.reorderLevel&&(null==p||null===(r=p.reorderLevel)||void 0===r?void 0:r.message)}),l().createElement(mi,{name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(o=p.reorderLevelUoMUuid)||void 0===o?void 0:o.message)}),v?l().createElement(a.iJ5,null):l().createElement(ci,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price"),value:null!==(u=f.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(mi,{name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(c=p.purchasePriceUoMUuid)||void 0===c?void 0:c.message)})):l().createElement(l().Fragment,null)};function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const gi=function(e){var t,n,o=function(e){var t="ws/rest/v1/concept".concat(z({})),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(),c=o.items.results,s=o.isLoading,u=(t=(0,i.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ai(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ai(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return s?l().createElement(a.znL,null):l().createElement(cr.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p,onChange:function(t){var n;null===(n=e.onConceptUuidChange)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},initialSelectedItem:(null==c?void 0:c.find((function(t){return t.uuid===e.conceptUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};var fi=[{label:"Drug",value:!0},{label:"Other",value:!1}],vi=[{label:"Yes",value:!0},{label:"No",value:!1}];function _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hi(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 bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var yi=(0,i.forwardRef)((function(e){var t,n,r,o,c,s,u,d,m,p,A,g=e.model,f=e.onSave,v=e.isEditing,_=e.handleTabChange,h=(0,E.useTranslation)().t,b=(0,cr.cI)({defaultValues:g,mode:"all",resolver:(0,sr.F)(ai)}),y=b.handleSubmit,k=b.control,C=b.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){hi(a,r,o,i,l,"next",e)}function l(e){hi(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),Ta("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)}}(),O=bi((0,i.useState)(!1),2),D=O[0],x=O[1],N=bi((0,i.useState)(!1),2),T=N[0],P=N[1],B=bi((0,i.useState)(!1),2),U=B[0],j=B[1];return(0,i.useEffect)((function(){var e,t;P(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:h("itemType","Item Type"),title:h("itemType","Item Type")},l().createElement(li,{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){P(e)},options:fi})),T&&l().createElement(ri,{name:"drugUuid",controllerName:"drugUuid",control:k,title:h("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(gi,{name:"conceptUuid",controllerName:"conceptUuid",control:k,title:h("pleaseSpecify","Please specify:"),placeholder:h("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(Sr,{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:h("commonName","Common name:"),invalid:!!w.commonName,invalidText:w.commonName&&(null==w||null===(o=w.commonName)||void 0===o?void 0:o.message)}),l().createElement(Sr,{id:"acronym",maxLength:255,name:"acronym",control:k,controllerName:"acronym",size:"md",labelText:h("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:h("hasExpiration","Does the item expire?"),title:h("hasExpiration","Does the item expire?")},l().createElement(li,{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:vi})),U&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:h("expirationNotice","Expiration Notice (days)"),title:h("expirationNotice","Expiration Notice (days)")},l().createElement(ci,{id:"expiryNotice",name:"expiryNotice",control:k,controllerName:"expiryNotice",size:"md",allowEmpty:!0,label:h("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(ui,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:k,title:h("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:h("chooseVendor","Choose vendor"),invalid:!!w.preferredVendorUuid,invalidText:w.preferredVendorUuid&&(null==w||null===(d=w.preferredVendorUuid)||void 0===d?void 0:d.message)}),l().createElement(di,{name:"categoryUuid",controllerName:"categoryUuid",control:k,title:h("category:","Category:"),placeholder:h("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(si,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:k,title:h("dispensingUnit","Dispensing Unit:"),placeholder:h("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(pi,{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:vo.vc},D?l().createElement(a.lSo,null):h("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},h("cancel","Cancel"))))}));const ki=yi;function Ci(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ei(e){var t,n,o=function(e){console.warn("Rules filter: "+JSON.stringify(e));var t="ws/rest/v1/stockmanagement/stockrule".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Ci(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ci(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,i.useMemo)((function(){return[{key:"location",header:"Location"},{key:"name",header:"Name"},{key:"quantity",header:"Quantity Threshold"},{key:"evaluationFrequency",header:"Frequency Check"},{key:"actionFrequency",header:"Notification Frequency"},{key:"alertRole",header:"Alert Role"},{key:"mailRole",header:"Mail Role"},{key:"enabled",header:"Enabled?"},{header:"actions",key:"actions"}]}),[]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:f}}var wi=n(4563),Si={};Si.styleTagTransform=h(),Si.setAttributes=g(),Si.insert=p().bind(null,"head"),Si.domAPI=d(),Si.insertStyleElement=v(),s()(wi.Z,Si);const Oi=wi.Z&&wi.Z.locals?wi.Z.locals:void 0;function Di(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Di(e,t,n[t])}))}return e}function Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ii(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ti(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ii(e,t,n[t])}))}return e}function Pi(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 Bi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ni(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ni(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ui=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t;console.warn("Got stock id: ",c);var u=Bi((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=Qe(d).items,A=Et({v:U.Default}).locations.results,g=wt({v:U.Default}),f=g.items,v=(g.isError,g.isLoading,Bi((0,i.useState)(),2)),_=v[0],h=v[1];(0,i.useEffect)((function(){if(null!=o&&0!=Object.keys(o).length){o.dateCreated,o.creatorGivenName,o.creatorFamilyName;var e=Ti({},function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(o,["dateCreated","creatorGivenName","creatorFamilyName"]));h(e)}}),[o]);var b=(0,i.useCallback)((function(e){e.preventDefault(),o&&(_.uuid=o.uuid),c&&(_.stockItemUuid=c),function(e){var t=null!=e.uuid,n="ws/rest/v1/stockmanagement/stockrule".concat(t?"/"+e.uuid:""),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:xi({},e)})}(_).then((function(){(0,r.showToast)({critical:!0,title:s("addedRule","Add Rule"),kind:"success",description:s("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[_,o,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:b},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:Oi.section},l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==_?void 0:_.locationUuid)?_.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.uuid===e.target.value}));h(Pi(Ti({},_),{locationUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.display})})))),l().createElement("section",{className:Oi.section},l().createElement(a.oil,{id:"name",type:"text",labelText:s("name","Rule Name"),size:"md",onChange:function(e){o&&(o.name=e.target.value),h(Pi(Ti({},_),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==_?void 0:_.stockItemPackagingUOMUuid)?_.stockItemPackagingUOMUuid:"",onChange:function(e){var t=null==p?void 0:p.results.find((function(t){return t.uuid===e.target.value}));h(Pi(Ti({},_),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:Oi.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:s("quantity","Quantity Threshold"),size:"md",onChange:function(e){o&&(o.quantity=Number(e.target.value)),h(Pi(Ti({},_),{quantity:Number(e.target.value)}))},value:null==o?void 0:o.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==_?void 0:_.alertRole)?_.alertRole:"",onChange:function(e){var t=null==f?void 0:f.results.find((function(t){return t.display===e.target.value}));h(Pi(Ti({},_),{alertRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseAlertRole","Choose an Alert Role")}),null==f||null===(t=f.results)||void 0===t?void 0:t.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:Oi.section},l().createElement(a.PhF,{name:"mailRole",className:"select-field",labelText:s("mailRole","Mail Role"),id:"mailRole",value:(null==_?void 0:_.mailRole)?_.mailRole:"",onChange:function(e){var t=null==f?void 0:f.results.find((function(t){return t.display===e.target.value}));console.warn("Setting mail role to: ",t),h(Pi(Ti({},_),{mailRole:t.display}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseMailRole","Choose a Mail Role")}),null==f||null===(n=f.results)||void 0===n?void 0:n.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})})))),l().createElement("section",{className:Oi.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:s("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){o&&(o.evaluationFrequency=Number(e.target.value)),h(Pi(Ti({},_),{evaluationFrequency:Number(e.target.value)}))},value:null==o?void 0:o.evaluationFrequency,placeholder:"e.g 30 Minutes"}),l().createElement(a.oil,{id:"actionFrequency",type:"number",labelText:s("actionFrequency","Notification Frequency (Minutes)"),size:"md",onChange:function(e){o&&(o.actionFrequency=Number(e.target.value)),h(Pi(Ti({},_),{actionFrequency:Number(e.target.value)}))},value:null==o?void 0:o.actionFrequency,placeholder:"e.g 3600 Minutes"}))),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Oi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enabled);h(Pi(Ti({},_),{enabled:n}))},checked:null==_?void 0:_.enabled,labelText:"Enabled ?",value:null==o?void 0:o.enabled,id:"chk-ruleEnabled"}))),l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Oi.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enableDescendants);h(Pi(Ti({},_),{enableDescendants:n}))},name:"appliesToChildren",checked:null==_?void 0:_.enableDescendants,value:null==o?void 0:o.enableDescendants,labelText:"Applies to child locations?",id:"chk-ruleAppliesToChildren"})))),l().createElement("div",null,"This stock rule will be evaluated by checking if the stock quantities have lowered to the threshold or below and a notification will be sent to the personnel with the specified role in the given location. The notification will only be sent once per specified notification frequency.")),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:Q},s("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},s("save","Save")))))},ji=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Ui,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var zi=n(4907),Fi={};Fi.styleTagTransform=h(),Fi.setAttributes=g(),Fi.insert=p().bind(null,"head"),Fi.domAPI=d(),Fi.insertStyleElement=v(),s()(zi.Z,Fi);const Li=zi.Z&&zi.Z.locals?zi.Z.locals:void 0;function Ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Mi=function(e){var t,n=e.stockItemUuid,o=function(e){var t="ws/rest/v1/stockmanagement/stockrule".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}({v:U.Default,totalCount:!0,stockItemUuid:n}),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:Li.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return Ri(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Ri(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ri(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),itemToString:function(e){return e?e.display:"Not Set"},type:"inline",size:"sm"})))};function qi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Hi=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return qi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t,n,a;(t=o,n="ws/rest/v1/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){Gi(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Zi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Yi=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Ui,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(dt.I8,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Zi(e,t,n[t])}))}return e}({size:16},e))}})};function Qi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ji(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Qi(e,t,n[t])}))}return e}function Wi(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Ki=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t);console.warn("Found stock uuid: "+t);var o=Ei({v:U.Default,totalCount:!0,stockItemUuid:t}),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.currentPage,m=o.currentPageSize,p=o.pageSizes,A=o.totalItems,g=o.setPageSize,f=o.goTo,v=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e,t){var n,r;return Wi(Ji({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated: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(Yi,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Hi,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Fn.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:Fn.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Mi,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(ji,{stockItemUuid:t}))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Wi(Ji({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Fn.desktopHeader:Fn.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,o.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ji({className:r.isDesktop?Fn.desktopRow:Fn.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:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:Fn.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:Fn.paginationOverride}))};function Vi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function el(e){return function(e){if(Array.isArray(e))return $i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const tl=function(e){var t=xt((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(cr.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)?el(n.some((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.packagingUomUuid)}))?[]:[{uuid:null===(o=e.row)||void 0===o?void 0:o.packagingUomUuid,display:null===(i=e.row)||void 0===i?void 0:i.packagingUomName}]).concat(el(null!=n?n:[])):n||[],onChange:function(t){var n,r;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),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 nl=ur.z.object({id:ur.z.string().nullish(),uuid:ur.z.string().nullish(),stockItemUuid:ur.z.string().nullish(),packagingUomName:ur.z.string().nullish(),packagingUomUuid:ur.z.string().nullish(),factor:ur.z.coerce.number().nullish(),isDefaultStockOperationsUoM:ur.z.boolean().nullish(),isDispensingUnit:ur.z.boolean().nullish()}),rl=n(4158),ol={};ol.styleTagTransform=h(),ol.setAttributes=g(),ol.insert=p().bind(null,"head"),ol.domAPI=d(),ol.insertStyleElement=v(),s()(rl.Z,ol);const al=rl.Z&&rl.Z.locals?rl.Z.locals:void 0;function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ll(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ll(e,t,n[t])}))}return e}function sl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ul=function(e){e.isEditing;var t=e.stockItemUuid,n=e.handleTabChange,o=function(e){var t=Xi((0,i.useState)({startIndex:0,v:U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Xi((0,i.useState)(),2),a=o[0],l=o[1];(0,i.useEffect)((function(){r({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:a})}),[a]);var c=Qe(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,cr.cI)({defaultValues:{},mode:"all",resolver:(0,sr.F)(nl)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(cr.RV,A,l().createElement(a.wQF,{rows:(d=c,function(e){if(Array.isArray(e))return il(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 il(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?il(e,t):void 0}}(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:al.packagingTableContainer},l().createElement(a.iA_,sl(cl({},r()),{className:al.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,sl(cl({},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:al.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(dl,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(dl,{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=new AbortController;return(0,r.openmrsFetch)("ws/rest/v1/stockmanagement/stockitempackaginguom",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.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:vo.vc},m("save","Save")))};var dl=function(e){var t=e.isEditing,n=e.row,o=e.key,i=(0,E.useTranslation)().t,c=(0,cr.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(tl,{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:al.packingTableCell},l().createElement(ci,{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="ws/rest/v1/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 ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function pl(e,t){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 ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ml(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 Al=n(3162),gl=n(4655),fl={};fl.styleTagTransform=h(),fl.setAttributes=g(),fl.insert=p().bind(null,"head"),fl.domAPI=d(),fl.insertStyleElement=v(),s()(gl.Z,fl);const vl=gl.Z&&gl.Z.locals?gl.Z.locals:void 0;function _l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bl(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)||yl(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 yl(e,t){if(e){if("string"==typeof e)return _l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_l(e,t):void 0}}const kl=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=bl((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=bl((0,i.useState)(n),1)[0],h=[10,20,30,40,50],b=bl((0,i.useState)(10),2),y=b[0],k=b[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,O=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){hl(e,t,n[t])}))}return e}({},t),o=null!=(o={id:n++})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r));var r,o})),f(e)}),[S,g]);var D=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,Al.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,Al.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 _l(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||yl(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:vl.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:vl.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:dt.rT,iconDescription:"Download As",focusTrap:!1},l().createElement(a.laM,{itemText:"Download As CSV",onClick:D}),l().createElement(a.laM,{itemText:"Download As PDF",onClick:D}),l().createElement(a.laM,{itemText:"Download As Json",onClick:D})),l().createElement(a.Ys1,{className:vl.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:vl.tileContainer},l().createElement(a.n9L,{className:vl.tile},l().createElement("div",{className:vl.tileContent},l().createElement("p",{className:vl.content},m("No data","No data to display")),l().createElement("p",{className:vl.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:O,pageSize:y,pageSizes:h,totalItems:c||(null==_?void 0:_.length),className:vl.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==O){if(s)return void s(n);w(n)}}})))})))};function Cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const El=function(e){var t,n=e.stockItemUuid,o=function(e){var t=pl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=pl((0,i.useState)(10),2),l=a[0],c=a[1],s=pl((0,i.useState)(null),2),u=s[0],d=s[1],m=pl((0,i.useState)(1),2),p=m[0],A=m[1],g=pl((0,i.useState)(),2),f=g[0],v=g[1],_=pl((0,i.useState)(),2),h=_[0],b=_[1],y=pl((0,i.useState)(),2),k=y[0],C=y[1],E=pl((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:h,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,h,k,w]);var O=function(e){var t="ws/rest/v1/stockmanagement/stockitemtransaction".concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),D=O.items,x=O.isLoading,N=O.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:D.results,totalCount:D.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:b,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){Cl(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(Ra,{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(kl,{columns:u,data:A,totalItems:d,goToPage:m,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},"No transactions to display")))};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=e.stockItemUuid,n=to(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){wl(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(kl,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},d("batchInfoToDisplay","No batch information to display"))))};function Ol(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dl(e,t){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 Ol(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ol(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 xl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nl=function(e){var t=e.stockItemUuid,n=function(e){var t=Dl((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Dl((0,i.useState)(10),2),a=o[0],l=o[1],c=Dl((0,i.useState)(null),2),s=c[0],u=c[1],d=Dl((0,i.useState)(1),2),m=d[0],p=d[1],A=Dl((0,i.useState)(),2),g=A[0],f=A[1],v=Dl((0,i.useState)(),2),_=v[0],h=v[1],b=Dl((0,i.useState)(),2),y=b[0],k=b[1],C=Dl((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,O=Ze(n),D=O.items,x=O.isLoading,N=O.isError;return{items:null!==(S=D.results)&&void 0!==S?S:[],totalCount:D.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}(U.Default),r=n.isLoading,o=n.items,c=n.totalCount,s=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l;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){xl(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(kl,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1}):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},d("quantityToDisplay","No quantity to display"))))};function Il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Tl=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 Il(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Il(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(ki,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(ul,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(El,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Sl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(Nl,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Stock Rules"),component:l().createElement(Ki,{stockItemUuid:o.uuid}),disabled:!r}];return l().createElement(Wn,{onChange:m,tabs:p,selectedIndex:u})};function Pl(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 Bl=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){Pl(a,r,o,i,l,"next",e)}function l(e){Pl(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o,a,i,l,c=arguments;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(s){switch(s.label){case 0:t=c.length>1&&void 0!==c[1]&&c[1],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(t?Ke:We)(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,Ul(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)}}(),Ul=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(Tl,{model:e,onSave:function(e){return Bl(e,t)},isEditing:t}))};const jl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Ul(Xa,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var zl=n(1048),Fl={};Fl.styleTagTransform=h(),Fl.setAttributes=g(),Fl.insert=p().bind(null,"head"),Fl.domAPI=d(),Fl.insertStyleElement=v(),s()(zl.Z,Fl);const Ll=zl.Z&&zl.Z.locals?zl.Z.locals:void 0,Rl=function(e){var t=e.filterType,n=e.changeFilterType;return l().createElement(a.SYO,{name:"is-drug",defaultSelected:t,onChange:n,className:Ll.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 Ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ql(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ml(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 Gl=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"))},Hl=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,Ul(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function Zl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Zl(e,t,n[t])}))}return e}function Ql(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Jl=function(){var e=(0,E.useTranslation)().t,t=function(e){(0,E.useTranslation)().t;var t=ql((0,i.useState)(1),2),n=t[0],o=t[1],a=ql((0,i.useState)(10),2),l=a[0],c=a[1],s=ql((0,i.useState)(null),2),u=s[0],d=s[1],m=ql((0,i.useState)(""),2),p=m[0],A=m[1],g=ql((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=He(f),h=_.items,b=_.isLoading,y=_.isError,k=(0,r.usePagination)(h.results,l);return(0,i.useEffect)((function(){v({startIndex:n-1,v:U.Default,limit:l,q:u,totalCount:!0,isDrug:p})}),[u,n,l,p]),{items:k.results,pagination:k,totalCount:h.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:b,isError:y,isDrug:p,setDrug:function(e){o(1),A(e)},setSearchString:d}}(U.Full),n=t.isLoading,o=t.items,c=t.totalCount,s=t.currentPageSize,u=t.pageSizes,d=t.currentPage,m=t.setCurrentPage,p=t.isDrug,A=t.setDrug,g=(0,i.useMemo)((function(){return[{id:0,header:e("type","Type"),key:"type"},{id:1,header:e("genericName","Generic Name"),key:"genericName"},{id:2,header:e("commonName","Common Name"),key:"commonName"},{id:3,header:e("tradeName","Trade Name"),key:"tradeName"},{id:4,header:e("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:e("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:e("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[e]),f=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(t,n){var r;return Ql(Yl({},t),{id:null==t?void 0:t.uuid,key:"key-".concat(null==t?void 0:t.uuid),uuid:"".concat(null==t?void 0:t.uuid),type:(null==t?void 0:t.drugUuid)?e("drug","Drug"):e("other","Other"),genericName:l().createElement(Hl,{data:o[n]}),commonName:null==t?void 0:t.commonName,tradeName:(null==t?void 0:t.drugUuid)?null==t?void 0:t.conceptName:"",preferredVendorName:null==t?void 0:t.preferredVendorName,dispensingUoM:null==t?void 0:t.defaultStockOperationsUoMName,dispensingUnitName:null==t?void 0:t.dispensingUnitName,defaultStockOperationsUoMName:null==t?void 0:t.defaultStockOperationsUoMName,reorderLevel:(null==t?void 0:t.reorderLevelUoMName)&&(null==t?void 0:t.reorderLevel)?"".concat(null==t||null===(r=t.reorderLevel)||void 0===r?void 0:r.toLocaleString()," ").concat(null==t?void 0:t.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){t.isDrug=!!t.drugUuid,Ul(t,!0)},iconDescription:e("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(dt.I8,Yl({size:16},e))}}))})}))}),[o,e]);return n?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,e("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows: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.getBatchActionProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,u()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(Rl,{filterType:p,changeFilterType:A}),l().createElement(Gl,null),l().createElement(jl,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,Ql(Yl({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Fn.desktopHeader:Fn.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,n.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,Ql(Yl({className:r.isDesktop?Fn.desktopRow:Fn.tabletRow},s({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===n.length?l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("div",{className:Fn.tileContent},l().createElement("p",{className:Fn.content},e("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:Fn.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:s,pageSizes:u,totalItems:c,onChange:function(e){var t=e.page;return m(t)},className:Fn.paginationOverride}))},Wl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Jl,null))},Kl=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement("span",null,"Coming Soon..."))};function Vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Xl=function(){var e=(0,E.useTranslation)().t,t=function(e){var t,n,o=Et(e),a=o.locations,l=o.isErrorLocation,c=o.isLoadingLocations,s=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Vl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vl(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,E.useTranslation)().t,v=(0,i.useMemo)((function(){return[{id:0,header:f("name","Name"),key:"name"},{id:1,header:f("tags","Tags"),key:"tags"},{id:2,header:f("childLocations","Child Locations"),key:"childLocations"},{id:3,header:f("actions","Actions"),key:"actions"}]}),[f]),_=(0,i.useMemo)((function(){var e;return null==a||null===(e=a.results)||void 0===e?void 0:e.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.tags)||void 0===n||null===(t=n.map((function(e){return e.display})))||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:""}}))}),[null==a?void 0:a.results]);return{items:a.results,currentPage:g,currentPageSize:u,paginatedQueueEntries:A,goTo:p,pageSizes:[10,20,30,40,50],isLoadingLocations:c,isErrorLocation:l,setPageSize:d,tableHeaders:v,tableRows:_}}({v:U.Full}),n=t.tableHeaders,o=t.tableRows,c=t.items,s=t.isLoadingLocations,u=function(){},d=function(){};return s?l().createElement(a.gqd,{role:"progressbar"}):(null==c?void 0:c.length)?l().createElement(kl,{columns:n,data:o},(function(t){var n=t.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:n}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(a.zxk,{onClick:d,size:"md",kind:"primary"},e("stockmanagement.addnewlocation","Add Location")))})):l().createElement("div",{className:Fn.tileContainer},l().createElement(a.n9L,{className:Fn.tile},l().createElement("p",{className:Fn.content},"No stock items to display")))},$l=function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Xl,null))};var ec="@openmrs/esm-stock-management-app",tc={featureName:"stock-management",moduleName:ec},nc=n(3979),rc=(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}))))}),tc),oc=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),tc),ac=(0,r.getSyncLifecycle)((function(){var e="".concat(window.getOpenmrsSpaBase(),"stock-management");return l().createElement(Pe.BrowserRouter,{basename:e},l().createElement("div",{className:Se.container},l().createElement(Te,null),l().createElement("div",null,l().createElement(ve,null),l().createElement(Pe.Routes,null,l().createElement(Pe.Route,{path:"overview",element:l().createElement(At,null)}),l().createElement(Pe.Route,{path:"",element:l().createElement(At,null)}),l().createElement(Pe.Route,{path:"stock-items",element:l().createElement(Wl,null)}),l().createElement(Pe.Route,{path:"stock-operations",element:l().createElement(Va,null)}),l().createElement(Pe.Route,{path:"stock-user-scopes",element:l().createElement($t,null)}),l().createElement(Pe.Route,{path:"stock-sources",element:l().createElement(Pn,null)}),l().createElement(Pe.Route,{path:"stock-locations",element:l().createElement($l,null)}),l().createElement(Pe.Route,{path:"stock-settings",element:l().createElement(Kl,null)}))),l().createElement(Ce,null)))}),tc),ic=(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=ue((0,i.useState)(""),2),A=p[0],g=p[1],f=ue((0,i.useState)(!1),2),v=f[0],_=f[1],h=(t=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(e.preventDefault(),_(!0),t=null,d){case"submit":t="SUBMIT";break;case"dispatch":case"dispatchapproval":t="DISPATCH";break;case"complete":case"completedispatch":t="COMPLETE";break;case"cancel":t="CANCEL";break;case"reject":t="REJECT";break;case"return":t="RETURN";break;case"approve":t="APPROVE"}return t?(function(e){var t=new AbortController;return(0,r.openmrsFetch)("ws/rest/v1/stockmanagement/stockoperationaction",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}({name:t,uuid:null==s?void 0:s.uuid,reason:A}).then((function(){_(!1),(0,r.showToast)({critical:!0,title:m("title","".concat(o," Operation")),kind:"success",description:m("successMessage","You have successfully ".concat(o," operation "))}),u(),Q()}),(function(e){_(!1);var t=le(e);(0,r.showNotification)({description:m("errorDescription",t.join(", ")),title:m("errorDescriptionTitle","Error on saving form"),kind:"error",critical:!0}),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){se(a,r,o,i,l,"next",e)}function l(e){se(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)});return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:B.modalBody},l().createElement("section",{className:B.section},l().createElement("h5",{className:B.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:B.section},l().createElement(a.Kx8,{labelText:m("notes","Please explain the reason:"),id:"nextNotes",name:"nextNotes",invalidText:"Required",maxCount:500,enableCounter:!0,onChange:function(e){return g(e.target.value)}})))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:u},m("cancel","Cancel")),v?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),tc),lc=(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:ec}),cc=(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:ec}),sc=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=D((0,i.useState)(),2),c=o[0],s=o[1],u=D((0,i.useState)(!0),2),d=u[0],m=(u[1],D((0,i.useState)(!0),2)),p=(m[0],m[1]);return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:t,title:n("importStockItems","Import Stock Items")}),l().createElement(a.fef,null,l().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"small",onChange:function(e){var t,n,r=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];r?(s(r),p(!1)):e.preventDefault()},onDelete:function(){p(!0)}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:t},n("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(c){var e=new FormData;c&&(e.append("file",c,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,r.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,r.showNotification)({title:n("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}}},n("uploadStockItems","Upload StockItems")))))}),tc),uc=(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"))}),tc);function dc(){(0,r.defineConfigSchema)(ec,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}}]);
|