@openmrs/esm-stock-management-app 1.0.1-pre.464 → 1.0.1-pre.465

Sign up to get free protection for your applications and to get access to all the features.
package/dist/474.js CHANGED
@@ -1 +1 @@
1
- (globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[474],{3432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__metrics-card__tileContainer___SG_bT{border:.0625rem solid #e0e0e0;flex-grow:1;height:7.875rem;padding:0 .75rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;margin-bottom:20px}.-esm-stock-management__metrics-card__tileHeader___sMfyg{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.-esm-stock-management__metrics-card__headerLabel___HyNJ3{font-size:var(--cds-label-02-font-size, 0.875rem);font-weight:var(--cds-label-02-font-weight, 400);line-height:var(--cds-label-02-line-height, 1.28572);letter-spacing:var(--cds-label-02-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__metrics-card__totalsLabel___hyLWP{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-stock-management__metrics-card__totalsValue___CCj27{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);color:#161616}.-esm-stock-management__metrics-card__headerLabelContainer___bVkOu{display:flex;align-items:center;height:2rem;justify-content:space-between;width:100%}.-esm-stock-management__metrics-card__link___qIBqZ{text-decoration:none;display:flex;align-items:flex-end}.-esm-stock-management__metrics-card__metricsGrid___sM6gq{display:grid;grid-template-columns:1fr 1fr}.-esm-stock-management__metrics-card__countGrid___XC66g{display:grid;grid-template-columns:1fr 1fr;justify-self:flex-end;column-gap:.5rem}.-esm-stock-management__metrics-card__countGrid___XC66g>span{font-size:.625rem !important;margin:0;color:#525252}.-esm-stock-management__metrics-card__countGrid___XC66g>p{margin:0}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/card/metrics-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,4DACE,6BAAA,CACA,WAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,kBAAA,CAGF,yDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,mBCCW,CDCb,0DE40BI,iDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF10BF,aGwBQ,CHtBV,0DEw0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CFt0BF,aDvBQ,CCyBV,0DEo0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CFl0BF,aD5BM,CC8BR,mEACE,YAAA,CACA,kBAAA,CACA,WCIW,CDHX,6BAAA,CACA,UAAA,CAEF,mDACE,oBAAA,CACA,YAAA,CACA,oBAAA,CAEF,0DACE,YAAA,CACA,6BAAA,CAEF,wDACE,YAAA,CACA,6BAAA,CACA,qBAAA,CACA,gBCjCW,CDkCX,6DACE,4BAAA,CACA,QAAA,CACA,aGVM,CHYR,0DACE,QAAA",sourceRoot:""}]),i.locals={tileContainer:"-esm-stock-management__metrics-card__tileContainer___SG_bT",tileHeader:"-esm-stock-management__metrics-card__tileHeader___sMfyg",headerLabel:"-esm-stock-management__metrics-card__headerLabel___HyNJ3",totalsLabel:"-esm-stock-management__metrics-card__totalsLabel___hyLWP",totalsValue:"-esm-stock-management__metrics-card__totalsValue___CCj27",headerLabelContainer:"-esm-stock-management__metrics-card__headerLabelContainer___bVkOu",link:"-esm-stock-management__metrics-card__link___qIBqZ",metricsGrid:"-esm-stock-management__metrics-card__metricsGrid___sM6gq",countGrid:"-esm-stock-management__metrics-card__countGrid___XC66g"};const l=i},2296:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__overlay__desktopOverlay___lvJaK{position:fixed;top:3rem;width:100%;right:0;bottom:0;z-index:9;border-left:1px solid #a8a8a8;background-color:#fff;overflow-y:auto;height:calc(100vh - 3rem)}.-esm-stock-management__overlay__desktopOverlay___lvJaK::after{height:100%;border-left:1px solid #a8a8a8}.-esm-stock-management__overlay__tabletOverlay___ThdtE{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#f4f4f4;overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none}.-esm-stock-management__overlay__tabletOverlay___ThdtE::-webkit-scrollbar{width:0}.-esm-stock-management__overlay__tabletOverlay___ThdtE>div{margin-top:3rem}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O button{background-color:#005d5d;background-color:var(--brand-01)}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O .-esm-stock-management__overlay__headerContent___YYBKM{color:#fff}.-esm-stock-management__overlay__desktopHeader___Ueq0h{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8;position:sticky;position:-webkit-sticky;width:100%;z-index:1000;top:0}.-esm-stock-management__overlay__headerContent___YYBKM{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-stock-management__overlay__closeButton___JYFSq{background-color:#fff;color:#161616;fill:#161616}.omrs-breakpoint-gt-tablet .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.omrs-breakpoint-lt-desktop .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.cds--list-box__menu{z-index:20000}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/overlay/overlay.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,wDACE,cAAA,CACA,QC6CW,CD5CX,UAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,6BAAA,CACA,qBAAA,CACA,eAAA,CACA,yBAAA,CAGF,+DACE,WAAA,CACA,6BAAA,CAGF,uDACE,cAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,wBD7BM,CC8BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCYS,CDPX,oEDNA,wBAAA,CACA,gCAAA,CCSA,oHACE,UDhDI,CCoDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDvDM,CCwDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEgyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF9xBF,cAAA,CACA,aDjEM,CCoER,qDACE,qBDlEc,CCmEd,aDtEM,CCuEN,YDvEM,CC4EN,mFACE,eAAA,CACA,eAAA,CAMF,oFACE,eAAA,CACA,eAAA,CAKJ,qBACE,aAAA",sourceRoot:""}]),i.locals={desktopOverlay:"-esm-stock-management__overlay__desktopOverlay___lvJaK",tabletOverlay:"-esm-stock-management__overlay__tabletOverlay___ThdtE",tabletOverlayHeader:"-esm-stock-management__overlay__tabletOverlayHeader___T3x8O",headerContent:"-esm-stock-management__overlay__headerContent___YYBKM",desktopHeader:"-esm-stock-management__overlay__desktopHeader___Ueq0h",closeButton:"-esm-stock-management__overlay__closeButton___JYFSq",overlayContent:"-esm-stock-management__overlay__overlayContent___QyXjy"};const l=i},7149:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__privilages__content___UE9bQ{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__privilages__helper___EblpR{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__privilages__tileContainer___K6_qc{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__privilages__tile___zojuU{margin:auto;width:fit-content}.-esm-stock-management__privilages__tileContent___hG2dp{display:flex;flex-direction:column;align-items:center}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/privilages-component/privilages.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,oDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,mDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,0DACE,qBDfM,CCgBN,4BAAA,CACA,cAAA,CAGF,iDACE,WAAA,CACA,iBAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__privilages__content___UE9bQ",helper:"-esm-stock-management__privilages__helper___EblpR",tileContainer:"-esm-stock-management__privilages__tileContainer___K6_qc",tile:"-esm-stock-management__privilages__tile___zojuU",tileContent:"-esm-stock-management__privilages__tileContent___hG2dp"};const l=i},4655:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__table__widgetContainer___cZm_L{background-color:#fff}.-esm-stock-management__table__widgetHeaderContainer___mn6uH{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem}.-esm-stock-management__table__widgetHeaderContainer___mn6uH>h4:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-01)}.-esm-stock-management__table__toggleButtons___cvBSx{width:fit-content;margin:0 .5rem}.-esm-stock-management__table__searchField___XUf8e{width:100%;max-width:250px;border:0px !important}.-esm-stock-management__table__searchBox___pXQzl{width:100%;display:flex;justify-content:right}.-esm-stock-management__table__container___Kypy0{margin-top:16px;margin-left:inherit;width:100%;overflow-y:hidden}.-esm-stock-management__table__tabContainer___E9h5_{margin-top:16px;padding-left:1rem;background-color:#fff}.-esm-stock-management__table__itemListSearch___I6xcT{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__itemListSearch___I6xcT input{background-color:#fff !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tileContainer___ZrvLt{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__table__tile___peYeA{margin:auto;width:fit-content}.-esm-stock-management__table__tileContent___WuPqi{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__table__menuItem___Sy4dM{max-width:none}.-esm-stock-management__table__radioButtonGroup___jCXKy{display:flex;flex-direction:column;align-items:flex-start;margin-top:.5rem;min-height:4rem;width:100%;font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-stock-management__table__radioButton____RBAw{padding:.25rem .25rem;margin:.5rem 0}.-esm-stock-management__table__section___tNn_U{margin:.5rem}.-esm-stock-management__table__sectionTitle___UBtqA{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__table__modalBody___QNIO4{padding-bottom:1rem}.-esm-stock-management__table__tabContainer___E9h5_ div[role=tabpanel]{padding:0 !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tableContainer___rZgtk{margin:0;padding:0}.-esm-stock-management__table__search___ybQU1{max-width:16rem}.-esm-stock-management__table__search___ybQU1 input{background-color:#fff !important}.-esm-stock-management__table__tableContainer___rZgtk{background-color:#f4f4f4}.-esm-stock-management__table__tableContainer___rZgtk a{text-decoration:none}.-esm-stock-management__table__tableContainer___rZgtk tr{width:.125rem}.-esm-stock-management__table__tableContainer___rZgtk .-esm-stock-management__table__toolbarContent___XsHBI{height:3rem}.-esm-stock-management__table__cds--table-sort__description___Gup5c{display:none}.-esm-stock-management__table__itemListDownload___loZ4q{margin-top:10px}.-esm-stock-management__table__content___qLKKH{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__table__helper___ZKdW1{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/table/table.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDACE,qBDCc,CCEhB,6DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CAGF,sEACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,qDACE,iBAAA,CACA,cAAA,CAGF,mDACE,UAAA,CACA,eAAA,CACA,qBAAA,CAGF,iDACE,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,iDACE,eAAA,CACA,mBAAA,CACA,UAAA,CACA,iBAAA,CAGF,oDACE,eAAA,CACA,iBAAA,CACA,qBAAA,CAGF,sDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,qBAAA,CAGF,qDACE,qBDpEM,CCqEN,4BAAA,CACA,cAAA,CAGF,4CACE,WAAA,CACA,iBAAA,CAGF,mDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,gDACE,cAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,gBCxEW,CDyEX,eCtCW,CDuCX,UAAA,CEmwBE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CF/vBJ,mDACE,qBAAA,CACA,cAAA,CAGF,+CACE,YCpFW,CDuFb,oDEsvBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFpvBF,aG9DQ,CH+DR,oBCrFW,CDwFb,iDACE,mBCpFW,CDuFb,uEACE,oBAAA,CAGF,8DACE,qBAAA,CAGF,sDACE,QAAA,CACA,SAAA,CAGF,8CACE,eAAA,CAEA,oDACE,gCAAA,CAIJ,sDACE,wBD5IM,CC8IN,wDACE,oBAAA,CAGF,yDACE,aCxIS,CD2IX,4GACE,WCpGS,CDwGb,oEACE,YAAA,CAGF,wDACE,eAAA,CAGF,+CE+rBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF7rBF,aDhKQ,CCiKR,mBAAA,CAGF,8CEyrBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFvrBF,aDtKQ",sourceRoot:""}]),i.locals={widgetContainer:"-esm-stock-management__table__widgetContainer___cZm_L",widgetHeaderContainer:"-esm-stock-management__table__widgetHeaderContainer___mn6uH",toggleButtons:"-esm-stock-management__table__toggleButtons___cvBSx",searchField:"-esm-stock-management__table__searchField___XUf8e",searchBox:"-esm-stock-management__table__searchBox___pXQzl",container:"-esm-stock-management__table__container___Kypy0",tabContainer:"-esm-stock-management__table__tabContainer___E9h5_",itemListSearch:"-esm-stock-management__table__itemListSearch___I6xcT",tileContainer:"-esm-stock-management__table__tileContainer___ZrvLt",tile:"-esm-stock-management__table__tile___peYeA",tileContent:"-esm-stock-management__table__tileContent___WuPqi",menuItem:"-esm-stock-management__table__menuItem___Sy4dM",radioButtonGroup:"-esm-stock-management__table__radioButtonGroup___jCXKy",radioButton:"-esm-stock-management__table__radioButton____RBAw",section:"-esm-stock-management__table__section___tNn_U",sectionTitle:"-esm-stock-management__table__sectionTitle___UBtqA",modalBody:"-esm-stock-management__table__modalBody___QNIO4",tableContainer:"-esm-stock-management__table__tableContainer___rZgtk",search:"-esm-stock-management__table__search___ybQU1",toolbarContent:"-esm-stock-management__table__toolbarContent___XsHBI","cds--table-sort__description":"-esm-stock-management__table__cds--table-sort__description___Gup5c",itemListDownload:"-esm-stock-management__table__itemListDownload___loZ4q",content:"-esm-stock-management__table__content___qLKKH",helper:"-esm-stock-management__table__helper___ZKdW1"};const l=i},5260:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__vertical-tabs__heading___dsNAK{font-size:var(--cds-productive-heading-02-font-size, 1rem);font-weight:var(--cds-productive-heading-02-font-weight, 600);line-height:var(--cds-productive-heading-02-line-height, 1.375);letter-spacing:var(--cds-productive-heading-02-letter-spacing, 0);color:#525252;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__heading___dsNAK:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__vertical-tabs__mainContainer___V_jej{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__vertical-tabs__title___hZ4AW{padding:1rem;font-size:1.2rem}.-esm-stock-management__vertical-tabs__desktopContainer____twGN{width:50%}.-esm-stock-management__vertical-tabs__tabletContainer___FQsU6{width:90%}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab-content{width:100% !important;padding:0}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab--list{flex-direction:column}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:active,.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--col{padding-left:0;width:100%}.-esm-stock-management__vertical-tabs__tabletTab___PHxHJ{width:25%}.-esm-stock-management__vertical-tabs__desktopTab___jh9Dp{width:20%}.-esm-stock-management__vertical-tabs__tab___IFWR5{display:flex}.-esm-stock-management__vertical-tabs__tabContainer___hu3KQ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__optionCell___oFvY9{padding:0 !important}.-esm-stock-management__vertical-tabs__optionHeader___avuuO{width:1.5rem !important}.-esm-stock-management__vertical-tabs__text___VSinM{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/tabs/vertical-tabs.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHnBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDtBM,CCuBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,SAAA,CAGF,6EACE,qBAAA,CAGF,wEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,+EACE,WAAA,CACA,eAAA,CAGF,6FACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,uGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,kFAQE,eAAA,CANA,iLAEE,oBAAA,CACA,2BAAA,CAMJ,uEACE,cAAA,CACA,UAAA,CAIJ,yDACE,SAAA,CAGF,0DACE,SAAA,CAGF,mDACE,YAAA,CAGF,4DACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,0DACE,oBAAA,CAGF,4DACE,uBAAA,CAGF,oDACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__vertical-tabs__heading___dsNAK",mainContainer:"-esm-stock-management__vertical-tabs__mainContainer___V_jej",title:"-esm-stock-management__vertical-tabs__title___hZ4AW",desktopContainer:"-esm-stock-management__vertical-tabs__desktopContainer____twGN",tabletContainer:"-esm-stock-management__vertical-tabs__tabletContainer___FQsU6",cohortBuilder:"-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy",tabletTab:"-esm-stock-management__vertical-tabs__tabletTab___PHxHJ",desktopTab:"-esm-stock-management__vertical-tabs__desktopTab___jh9Dp",tab:"-esm-stock-management__vertical-tabs__tab___IFWR5",tabContainer:"-esm-stock-management__vertical-tabs__tabContainer___hu3KQ",optionCell:"-esm-stock-management__vertical-tabs__optionCell___oFvY9",optionHeader:"-esm-stock-management__vertical-tabs__optionHeader___avuuO",text:"-esm-stock-management__vertical-tabs__text___VSinM"};const l=i},3011:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ{display:flex}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD{display:flex;flex-grow:1;flex-direction:column;margin:0;margin-left:16rem;background-color:#f4f4f4}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD a{width:100%}.-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx{flex-grow:1}.-esm-stock-management__home-dashboard__logoSection___oYB2c{display:flex;justify-content:center}","",{version:3,sources:["webpack://./src/dashboard/home-dashboard.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAGA,gEACE,YAAA,CAGF,mEACE,YAAA,CACA,WAAA,CACA,qBAAA,CACA,QAAA,CACA,iBAAA,CACA,wBC6BQ,CD3BR,qEACE,UAAA,CAIJ,yEACE,WAAA,CAGF,4DACE,YAAA,CACA,sBAAA",sourceRoot:""}]),i.locals={homePageWrapper:"-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ",dashboardContainer:"-esm-stock-management__home-dashboard__dashboardContainer___FvpUD",dashboardContainerTablet:"-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx",logoSection:"-esm-stock-management__home-dashboard__logoSection___oYB2c"};const l=i},49:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__root__productiveHeading01___qz04k{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__root__productiveHeading02___P86oI{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading03___ad2Jr{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading04____lfRk{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading05___BiHXj{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading06___fCUbs{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__root__bodyShort01___qFZKo{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__root__helperText01___l9eBE{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__root__bodyShort02___e318z{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__root__bodyLong01___hajrO{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__root__bodyLong02___rbPh9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__root__label01___B9Vra{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__root__text02___HK43C{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__root__container___Rf8rX{padding:2rem}.-esm-stock-management__root__formContainer___YM692{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__root__verticalForm___EFCw7{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__root__verticalForm___EFCw7 .cds--form-item{flex:none !important}.-esm-stock-management__root__verticalForm___EFCw7 .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0DC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,0DC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,0DCs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,0DCk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,0DC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,0DC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,kDCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,mDCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,kDC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,iDC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,iDCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,8CCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,6CACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,gDACE,YEpCW,CFuCb,oDACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,mDACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,mEACE,oBAAA,CAGF,+DACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__root__productiveHeading01___qz04k",productiveHeading02:"-esm-stock-management__root__productiveHeading02___P86oI",productiveHeading03:"-esm-stock-management__root__productiveHeading03___ad2Jr",productiveHeading04:"-esm-stock-management__root__productiveHeading04____lfRk",productiveHeading05:"-esm-stock-management__root__productiveHeading05___BiHXj",productiveHeading06:"-esm-stock-management__root__productiveHeading06___fCUbs",bodyShort01:"-esm-stock-management__root__bodyShort01___qFZKo",helperText01:"-esm-stock-management__root__helperText01___l9eBE",bodyShort02:"-esm-stock-management__root__bodyShort02___e318z",bodyLong01:"-esm-stock-management__root__bodyLong01___hajrO",bodyLong02:"-esm-stock-management__root__bodyLong02___rbPh9",label01:"-esm-stock-management__root__label01___B9Vra",text02:"-esm-stock-management__root__text02___HK43C",container:"-esm-stock-management__root__container___Rf8rX",formContainer:"-esm-stock-management__root__formContainer___YM692",verticalForm:"-esm-stock-management__root__verticalForm___EFCw7"};const l=i},7813:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__item__customTile___pTLBA{background-color:#f0f0f0;border-radius:4px;padding:20px;width:50px;height:100px;text-align:center;margin:2px}.-esm-stock-management__item__customTileTitle___DoQk8{font-size:14px;color:#333}","",{version:3,sources:["webpack://./src/stock-app-menu-item/item.scss"],names:[],mappings:"AACA,iDACI,wBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,YAAA,CACA,iBAAA,CACA,UAAA,CAGF,sDACE,cAAA,CACA,UAAA",sourceRoot:""}]),i.locals={customTile:"-esm-stock-management__item__customTile___pTLBA",customTileTitle:"-esm-stock-management__item__customTileTitle___DoQk8"};const l=i},8629:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home-detail-card__container___mESY0,.-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT,.-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk{margin:2rem 0}.-esm-stock-management__stock-home-detail-card__tilesContainer___blppR{background-color:#fff;border:1px solid #e0e0e0;border-bottom:none;width:100%;margin:0 auto;max-width:95vw;padding-bottom:0}.-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem;background-color:#fff}.-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL section{position:relative}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL a{text-decoration:none}.-esm-stock-management__stock-home-detail-card__pagination___sPPID{overflow:hidden}.-esm-stock-management__stock-home-detail-card__pagination___sPPID.cds--pagination{border-top:none}.-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa{display:none}.-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc{width:100%;max-width:768px;margin:1rem auto}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1>td>div{max-height:max-content !important}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 td{padding:0 2rem}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 th[colspan] td[colspan]>div:first-child{padding:0 1rem}.-esm-stock-management__stock-home-detail-card__action___Ul5A5{margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__illo___Wm7vk{margin-top:1rem}.-esm-stock-management__stock-home-detail-card__content___Q2X06{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h{text-align:left;text-transform:capitalize}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4:after,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid;border-bottom-color:#007d79;border-bottom-color:var(--brand-03)}.-esm-stock-management__stock-home-detail-card__tile___apXYV{text-align:center;border:1px solid #e0e0e0}.-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM{display:flex;justify-content:center;align-items:center;padding:1rem;margin:3rem;text-align:center}.-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i{margin:auto}.-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N{display:flex;margin:0 auto}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N>*{flex:1;margin:8px 8px}.-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm{display:flex;flex-direction:column}.-esm-stock-management__stock-home-detail-card__card___WYEgl{display:flex;border:1px solid #ccc;margin:10px;background-color:#f4f4f4}.-esm-stock-management__stock-home-detail-card__icon___JI7mq{margin-right:23px}.-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky{width:5px;background-color:#f1c21b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF{width:5px;background-color:#0f62fe;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z{width:5px;background-color:#ff832b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU{width:5px;background-color:#198038;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB{width:5px;background-color:#da1e28;margin-right:10px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr{margin-top:5px;margin-bottom:5px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr p{font-size:.9em;color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home-detail-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,sNACE,aAAA,CAQF,uEACE,qBDbM,CCcN,wBAAA,CACA,kBAAA,CACA,UAAA,CACA,aAAA,CACA,cAAA,CACA,gBAAA,CAGF,wEACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CACA,qBD3BM,CC8BR,wFACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,+EACE,iBAAA,CAGF,yEACE,oBAAA,CAGF,mEACE,eAAA,CAEA,mFACE,eAAA,CAIJ,kEACE,YAAA,CAGF,iEACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,8EACE,UAAA,CACA,eAAA,CACA,gBAAA,CAGF,sFACE,iCAAA,CAGF,kFACE,cAAA,CAGF,uHACE,cAAA,CAGF,+DACE,mBC9DW,CDiEb,6DACE,eCxDW,CD2Db,gEEwwBI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CFtwBF,aDvFQ,CCwFR,eC9DW,CD+DX,mBCzEW,CD4Eb,6IAEE,eAAA,CACA,yBAAA,CAEA,mJE4vBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF1vBA,aDnGM,CCqGN,+JACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2BAAA,CD/DJ,2BAAA,CACA,mCAAA,CCoEF,6DACE,iBAAA,CACA,wBAAA,CAGF,yEACE,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,YC/FW,CDgGX,WC5EW,CD6EX,iBAAA,CAGF,6EACE,WAAA,CAGF,gFE2tBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFztBF,aDpIQ,CCqIR,mBAAA,CAGF,+EEqtBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFntBF,aD1IQ,CC6IV,sEACE,YAAA,CACA,aAAA,CAGF,wEACE,MAAA,CACA,cAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CAGF,6DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,wBAAA,CAGF,6DACE,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,sEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,uEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,qEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,iEACE,cAAA,CACA,iBAAA,CAGF,mEACE,cAAA,CACA,aAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-home-detail-card__container___mESY0",emptyStateContainer:"-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT",loaderContainer:"-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk",tilesContainer:"-esm-stock-management__stock-home-detail-card__tilesContainer___blppR",headerContainer:"-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV",backgroundDataFetchingIndicator:"-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_",tableContainer:"-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL",pagination:"-esm-stock-management__stock-home-detail-card__pagination___sPPID",hiddenRow:"-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa",emptyRow:"-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s",visitSummaryContainer:"-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc",expandedActiveVisitRow:"-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1",action:"-esm-stock-management__stock-home-detail-card__action___Ul5A5",illo:"-esm-stock-management__stock-home-detail-card__illo___Wm7vk",content:"-esm-stock-management__stock-home-detail-card__content___Q2X06",desktopHeading:"-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3",tabletHeading:"-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h",tile:"-esm-stock-management__stock-home-detail-card__tile___apXYV",filterEmptyState:"-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM",filterEmptyStateTile:"-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i",filterEmptyStateContent:"-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0",filterEmptyStateHelper:"-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN",cardContainer:"-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N",cardContainerBig:"-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm",card:"-esm-stock-management__stock-home-detail-card__card___WYEgl",icon:"-esm-stock-management__stock-home-detail-card__icon___JI7mq",colorLineYellow:"-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky",colorLineBlue:"-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF",colorLineOrange:"-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z",colorLineGreen:"-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU",colorLineRed:"-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB",cardText:"-esm-stock-management__stock-home-detail-card__cardText____XcXr"};const l=i},2426:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home__cardContainer___n7Lxz{background-color:#fff;display:flex;justify-content:space-between;margin:0 1rem 0 1rem;flex-flow:row wrap;column-gap:1rem;row-gap:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,0DACE,qBCIM,CDHN,YAAA,CACA,6BAAA,CACA,oBAAA,CACA,kBAAA,CACA,eEqBW,CFpBX,YEoBW",sourceRoot:""}]),i.locals={cardContainer:"-esm-stock-management__stock-home__cardContainer___n7Lxz"};const l=i},4158:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__packaging-units__packingTable___ceosy{min-height:15rem;display:block}.-esm-stock-management__packaging-units__packingTableCell___KYLlI{display:flex;align-items:center}.-esm-stock-management__packaging-units__packagingTableBody___o7eKF{min-height:10rem}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6{padding-bottom:1rem;min-height:15rem;display:block}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6 .cds--data-table-content{overflow-x:visible}.-esm-stock-management__packaging-units__searchAndSave___iglHk{display:flex;flex-direction:column;align-items:flex-start}.-esm-stock-management__packaging-units__searchAndSave___iglHk .-esm-stock-management__packaging-units__submitButton___DIyGx{margin-top:1rem}.-esm-stock-management__packaging-units__deleteModal___T_iKq .cds--modal-container.cds--modal-container--sm .cds--modal-content .cds--form-item{margin-top:1rem}.-esm-stock-management__packaging-units__packageUnitsBtn___uapVg{display:flex;justify-content:flex-end;margin-right:2rem}cds--form-item{margin-top:1rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACE,gBAAA,CACA,aAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CAGF,oEACE,gBCwDW,CDrDb,yEACE,mBAAA,CACA,gBAAA,CACA,aAAA,CAEA,kGACE,kBAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,6HACE,eAAA,CAOE,gJACE,eAAA,CAMR,iEACE,YAAA,CACA,wBAAA,CACA,iBAAA,CAGF,eACE,eAAA",sourceRoot:""}]),i.locals={packingTable:"-esm-stock-management__packaging-units__packingTable___ceosy",packingTableCell:"-esm-stock-management__packaging-units__packingTableCell___KYLlI",packagingTableBody:"-esm-stock-management__packaging-units__packagingTableBody___o7eKF",packagingTableContainer:"-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6",searchAndSave:"-esm-stock-management__packaging-units__searchAndSave___iglHk",submitButton:"-esm-stock-management__packaging-units__submitButton___DIyGx",deleteModal:"-esm-stock-management__packaging-units__deleteModal___T_iKq",packageUnitsBtn:"-esm-stock-management__packaging-units__packageUnitsBtn___uapVg"};const l=i},501:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-item-references__referencesTable___WAMHe{min-height:15rem;display:block}.-esm-stock-management__stock-item-references__referencesTableCell___NGIOb{display:flex;align-items:center}.-esm-stock-management__stock-item-references__referencesTableBody___HreAO{min-height:10rem}.-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw{min-height:15rem;display:block}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,uEACE,gBAAA,CACA,aAAA,CAGF,2EACE,YAAA,CACA,kBAAA,CAGF,2EACE,gBCwDW,CDpDb,gFACE,gBAAA,CACA,aAAA",sourceRoot:""}]),i.locals={referencesTable:"-esm-stock-management__stock-item-references__referencesTable___WAMHe",referencesTableCell:"-esm-stock-management__stock-item-references__referencesTableCell___NGIOb",referencesTableBody:"-esm-stock-management__stock-item-references__referencesTableBody___HreAO",referencesTableContainer:"-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw"};const l=i},4563:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-rules__section___ggL6B{margin:.5rem}.-esm-stock-management__add-stock-rules__sectionTitle___fsf7E{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-rules__modalBody___DXCqE{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,yDACE,YCgBW,CDbb,8DE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,2DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-rules__section___ggL6B",sectionTitle:"-esm-stock-management__add-stock-rules__sectionTitle___fsf7E",modalBody:"-esm-stock-management__add-stock-rules__modalBody___DXCqE"};const l=i},4907:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss"],names:[],mappings:"AACI,oGACE,KAAA,CAGF,8FACE,WAAA,CAGF,iHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-rules-filter__filterContainer___eskQ5"};const l=i},1048:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__filter-stock-items__spacing___pZHZK{margin:0 16px}","",{version:3,sources:["webpack://./src/stock-items/components/filter-stock-items/filter-stock-items.scss"],names:[],mappings:"AAAA,4DACI,aAAA",sourceRoot:""}]),i.locals={spacing:"-esm-stock-management__filter-stock-items__spacing___pZHZK"};const l=i},1535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}:root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-items-table__productiveHeading01___MPnNp{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__productiveHeading02___E1KiC{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading03___N33sp{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading04___lh7n8{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading05___ieA0n{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading06___JPMyX{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__helperText01___uOks4{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__bodyShort02___d7A67{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyLong01____Gl3H{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__bodyLong02___Dwoe9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__label01___ANQCM{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__text02___ac1IL{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-items-table__container___VONiZ{padding:2rem}.-esm-stock-management__stock-items-table__formContainer___o0XL5{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-items-table__verticalForm___oOj2I{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--form-item{flex:none !important}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-items-table__tileContainer___N1eHZ{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-items-table__tile___ZZNjt{margin:auto;width:fit-content}.-esm-stock-management__stock-items-table__tileContent___SC542{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-items-table__content___zdm4U{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-items-table__helper___kKhcQ{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-items-table__separator___JXP1R{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-items-table__separator___JXP1R::before,.-esm-stock-management__stock-items-table__separator___JXP1R::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-items-table__separator___JXP1R::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-items-table__separator___JXP1R::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-items-table__toolbarContent___oBPmt{display:flex;align-items:center}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center}.-esm-stock-management__stock-items-table__dateAlign___RNWUI{padding-top:.5rem;height:100%}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL{padding-bottom:.5rem}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL .cds--list-box__menu{min-width:15rem;z-index:1}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-items/stock-items-table.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CAHF,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,uEC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,uEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,uECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,uECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,uEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,uEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,+DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,gECkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,+DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,8DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,8DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,2DCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,0DACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,6DACE,YEpCW,CFuCb,iEACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,gEACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,gFACE,oBAAA,CAGF,4EACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGpGJ,sEACE,qBHEc,CGDd,YDwBW,CCvBX,gBAAA,CAGF,iEACE,qBHPM,CGQN,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,2DFs0BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CEp0BF,aJzBQ,CI0BR,mBAAA,CAGF,0DFg0BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CE9zBF,aJ/BQ,CIkCV,6DF2zBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CEzzBF,aJpCQ,CIqCR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBJ3CM,CI4CN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,qEACE,WAAA,CACA,gBAAA,CAGF,oEACE,UAAA,CACA,iBAAA,CAIJ,kEACE,YAAA,CACA,kBAAA,CAGF,mEACE,YAAA,CACA,kBAAA,CAGF,6DACE,iBD3DW,CC4DX,WAAA,CAGF,gEACE,oBDhEW,CCkEX,qFACE,eAAA,CACA,SAAA,CAIJ,mEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,kBDlEW",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-items-table__productiveHeading01___MPnNp",productiveHeading02:"-esm-stock-management__stock-items-table__productiveHeading02___E1KiC",productiveHeading03:"-esm-stock-management__stock-items-table__productiveHeading03___N33sp",productiveHeading04:"-esm-stock-management__stock-items-table__productiveHeading04___lh7n8",productiveHeading05:"-esm-stock-management__stock-items-table__productiveHeading05___ieA0n",productiveHeading06:"-esm-stock-management__stock-items-table__productiveHeading06___JPMyX",bodyShort01:"-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK",helperText01:"-esm-stock-management__stock-items-table__helperText01___uOks4",bodyShort02:"-esm-stock-management__stock-items-table__bodyShort02___d7A67",bodyLong01:"-esm-stock-management__stock-items-table__bodyLong01____Gl3H",bodyLong02:"-esm-stock-management__stock-items-table__bodyLong02___Dwoe9",label01:"-esm-stock-management__stock-items-table__label01___ANQCM",text02:"-esm-stock-management__stock-items-table__text02___ac1IL",container:"-esm-stock-management__stock-items-table__container___VONiZ",formContainer:"-esm-stock-management__stock-items-table__formContainer___o0XL5",verticalForm:"-esm-stock-management__stock-items-table__verticalForm___oOj2I",headerBtnContainer:"-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p",tileContainer:"-esm-stock-management__stock-items-table__tileContainer___N1eHZ",tile:"-esm-stock-management__stock-items-table__tile___ZZNjt",tileContent:"-esm-stock-management__stock-items-table__tileContent___SC542",content:"-esm-stock-management__stock-items-table__content___zdm4U",helper:"-esm-stock-management__stock-items-table__helper___kKhcQ",separator:"-esm-stock-management__stock-items-table__separator___JXP1R",toolbarContent:"-esm-stock-management__stock-items-table__toolbarContent___oBPmt",filterContainer:"-esm-stock-management__stock-items-table__filterContainer___hAyU2",dateAlign:"-esm-stock-management__stock-items-table__dateAlign___RNWUI",filtersAlign:"-esm-stock-management__stock-items-table__filtersAlign___TaNrL"};const l=i},2761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_{margin-bottom:150px}","",{version:3,sources:["webpack://./src/stock-locations/stock-locations-table.scss"],names:[],mappings:"AAAA,uEACE,mBAAA",sourceRoot:""}]),i.locals={loaderContainer:"-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_"};const l=i},965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-management-header__header___eKmgW{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;height:6rem;background-color:#fff;display:flex;padding-left:8px;justify-content:space-between}.-esm-stock-management__stock-management-header__left-justified-items___VpNpP{display:flex;flex-direction:row;align-items:center;cursor:pointer}.-esm-stock-management__stock-management-header__right-justified-items___IOVey{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;margin:.5rem}.-esm-stock-management__stock-management-header__page-name___CPqh1{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-management-header__page-labels___qR7PY{margin:1rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__date-and-location___Uxut9{display:flex;justify-content:flex-end;align-items:center;margin-right:1rem}.-esm-stock-management__stock-management-header__value___eLYN8{margin-left:.25rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__view___f_vFK{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-management-header/stock-management-header.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,gEC61BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD31BF,aEyCQ,CFxCR,WG0DW,CHzDX,qBDRM,CCSN,YAAA,CACA,gBAAA,CACA,6BAAA,CAGF,8EACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,cAAA,CAGF,+EC40BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD10BF,aEwBQ,CFvBR,YAAA,CAGF,mECs0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CDl0BJ,qEACE,WAAA,CAGF,gEACE,cAAA,CAGF,2EACE,YAAA,CACA,wBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,+DACE,kBAAA,CAGF,gEACE,cAAA,CAGF,8DC2yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA",sourceRoot:""}]),i.locals={header:"-esm-stock-management__stock-management-header__header___eKmgW","left-justified-items":"-esm-stock-management__stock-management-header__left-justified-items___VpNpP","right-justified-items":"-esm-stock-management__stock-management-header__right-justified-items___IOVey","page-name":"-esm-stock-management__stock-management-header__page-name___CPqh1","page-labels":"-esm-stock-management__stock-management-header__page-labels___qR7PY",middot:"-esm-stock-management__stock-management-header__middot___gwifp","date-and-location":"-esm-stock-management__stock-management-header__date-and-location___Uxut9",value:"-esm-stock-management__stock-management-header__value___eLYN8",view:"-esm-stock-management__stock-management-header__view___f_vFK"};const l=i},2496:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-operation__sectionTitle___t2vui{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-operation__modalBody___YyRxm{padding-bottom:1rem}.-esm-stock-management__add-stock-operation__actionsContainer___SDbLm{display:flex;justify-content:space-between;margin:5px}.-esm-stock-management__add-stock-operation__statusContainer___MzxxK{display:flex;margin-top:4px;gap:1rem}.-esm-stock-management__add-stock-operation__textHeading___eg7oM{font-weight:bold}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe{margin-top:4px}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe .-esm-stock-management__add-stock-operation__text___DFlMr{margin-right:4px}.-esm-stock-management__add-stock-operation__actionButtons___XhL8k{margin:10px;display:flex;flex-direction:row}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-operations/add-stock-operation/add-stock-operation.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCpDF,kEC+1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD71BA,aAAA,CACA,oBEoBS,CFjBb,+DACI,mBEqBS,CFlBb,sEACI,YAAA,CACA,6BAAA,CACA,UAAA,CAGJ,qEACI,YAAA,CACA,cAAA,CACA,QAAA,CAGJ,iEACI,gBAAA,CAGJ,wEACI,cAAA,CACA,kIACI,gBAAA,CAIR,mEACI,WAAA,CACA,YAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-operation__sectionTitle___t2vui",modalBody:"-esm-stock-management__add-stock-operation__modalBody___YyRxm",actionsContainer:"-esm-stock-management__add-stock-operation__actionsContainer___SDbLm",statusContainer:"-esm-stock-management__add-stock-operation__statusContainer___MzxxK",textHeading:"-esm-stock-management__add-stock-operation__textHeading___eg7oM",statusDescriptions:"-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe",text:"-esm-stock-management__add-stock-operation__text___DFlMr",actionButtons:"-esm-stock-management__add-stock-operation__actionButtons___XhL8k"};const l=i},6781:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const l=i},6360:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN .cds--data-table-content{height:calc(100vh - 150px)}","",{version:3,sources:["webpack://./src/stock-operations/add-stock-operation/stock-items-addition.component.scss"],names:[],mappings:"AACE,wGACE,0BAAA",sourceRoot:""}]),i.locals={tableContainer:"-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN"};const l=i},1256:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-operations-dialog__section___fLTYQ{margin:.5rem}.-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp{margin-bottom:.75rem}.-esm-stock-management__stock-operations-dialog__modalBody___xG3z2{padding-bottom:1rem}","",{version:3,sources:["webpack://./src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAGA,iEACE,YCiBW,CDdb,sEACE,oBCkBW,CDfb,mEACE,mBCmBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__stock-operations-dialog__section___fLTYQ",sectionTitle:"-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp",modalBody:"-esm-stock-management__stock-operations-dialog__modalBody___xG3z2"};const l=i},557:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__create-stock-report__reportContainer___pFGwm{min-height:15rem;display:flex;flex-direction:column;row-gap:1rem;padding:1rem}.-esm-stock-management__create-stock-report__reportButton___T0m6Q{padding:1rem}.-esm-stock-management__create-stock-report__sectionTitle___y25tl{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__subTitle___Pgm2N{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__modalBody___VVZO6{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/generate-report/create-stock-report.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,qEACE,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CACA,YAAA,CAEF,kEACE,YAAA,CAGF,kECm1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDj1BF,aDZQ,CCaR,oBEQW,CFLb,8DACE,cAAA,CACA,oBEGW,CAAA,+DFCX,mBEIW",sourceRoot:""}]),i.locals={reportContainer:"-esm-stock-management__create-stock-report__reportContainer___pFGwm",reportButton:"-esm-stock-management__create-stock-report__reportButton___T0m6Q",sectionTitle:"-esm-stock-management__create-stock-report__sectionTitle___y25tl",subTitle:"-esm-stock-management__create-stock-report__subTitle___Pgm2N",modalBody:"-esm-stock-management__create-stock-report__modalBody___VVZO6"};const l=i},5861:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-reports__content___A4qFU{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-reports__helper___J9F35{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-reports__separator___yNdhd{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-reports__separator___yNdhd::before,.-esm-stock-management__stock-reports__separator___yNdhd::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-reports__separator___yNdhd::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-reports__separator___yNdhd::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-reports__tileContainer___nLbej{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-reports__tile___L1giA{margin:auto;width:fit-content}.-esm-stock-management__stock-reports__tileContent___J975x{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/report-list/stock-reports.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,uDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,sDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,yDCm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-reports__content___A4qFU",helper:"-esm-stock-management__stock-reports__helper___J9F35",separator:"-esm-stock-management__stock-reports__separator___yNdhd",tileContainer:"-esm-stock-management__stock-reports__tileContainer___nLbej",tile:"-esm-stock-management__stock-reports__tile___L1giA",tileContent:"-esm-stock-management__stock-reports__tileContent___J975x"};const l=i},2033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-settings__productiveHeading01___L9i81,.-esm-stock-management__stock-settings__title____W_Wx{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__productiveHeading02___hss5P{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading03___fPfXI{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading04___nygs1{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading05___oSN3A{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading06___DHu2c{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyShort01___tYpmd{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__helperText01___ZY1nd{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__bodyShort02___iosfZ{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyLong01___HhqRS{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__bodyLong02___jSFlj{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__label01___lbC3K{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__text02___Vqsry{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-settings__container___BnGf9{padding:2rem}.-esm-stock-management__stock-settings__formContainer___nHBLE{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-settings__verticalForm___S9Wbd{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--form-item{flex:none !important}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-settings__StockSettings___IhIeT{display:flex;justify-content:center;flex-direction:column;justify-content:flex-end;min-height:12.5rem;border:1px solid #e0e0e0;margin:.5rem;align-items:center;background-color:#fff}.-esm-stock-management__stock-settings__StockSettings___IhIeT>button{margin-bottom:2rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-settings/stock-settings.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_layout.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0HC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,oEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,oECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,oECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,oEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,oEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,4DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,6DCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,4DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,2DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,2DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,wDCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,uDACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,0DACE,YEpCW,CFuCb,8DACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,6DACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,6EACE,oBAAA,CAGF,yEACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGrGJ,8DACI,YAAA,CACA,sBAAA,CACA,qBAAA,CACA,wBAAA,CACA,kBAAA,CACA,wBAAA,CACA,YDUS,CCTT,kBAAA,CACA,qBC6GM,CD3GN,qEACI,kBEKI",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-settings__productiveHeading01___L9i81",title:"-esm-stock-management__stock-settings__title____W_Wx",productiveHeading02:"-esm-stock-management__stock-settings__productiveHeading02___hss5P",productiveHeading03:"-esm-stock-management__stock-settings__productiveHeading03___fPfXI",productiveHeading04:"-esm-stock-management__stock-settings__productiveHeading04___nygs1",productiveHeading05:"-esm-stock-management__stock-settings__productiveHeading05___oSN3A",productiveHeading06:"-esm-stock-management__stock-settings__productiveHeading06___DHu2c",bodyShort01:"-esm-stock-management__stock-settings__bodyShort01___tYpmd",helperText01:"-esm-stock-management__stock-settings__helperText01___ZY1nd",bodyShort02:"-esm-stock-management__stock-settings__bodyShort02___iosfZ",bodyLong01:"-esm-stock-management__stock-settings__bodyLong01___HhqRS",bodyLong02:"-esm-stock-management__stock-settings__bodyLong02___jSFlj",label01:"-esm-stock-management__stock-settings__label01___lbC3K",text02:"-esm-stock-management__stock-settings__text02___Vqsry",container:"-esm-stock-management__stock-settings__container___BnGf9",formContainer:"-esm-stock-management__stock-settings__formContainer___nHBLE",verticalForm:"-esm-stock-management__stock-settings__verticalForm___S9Wbd",StockSettings:"-esm-stock-management__stock-settings__StockSettings___IhIeT"};const l=i},8098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-sources__section___NMR9P{margin:.5rem}.-esm-stock-management__add-stock-sources__sectionTitle___mIFZm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-sources__modalBody___QeuLr{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/add-stock-sources/add-stock-sources.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,2DACE,YCgBW,CDbb,gEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,6DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-sources__section___NMR9P",sectionTitle:"-esm-stock-management__add-stock-sources__sectionTitle___mIFZm",modalBody:"-esm-stock-management__add-stock-sources__modalBody___QeuLr"};const l=i},5551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-sources/stock-sources-filter/stock-sources-filter.scss"],names:[],mappings:"AACI,sGACE,KAAA,CAGF,gGACE,WAAA,CAGF,mHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5"};const l=i},6940:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-sources__container___WSslj{background-color:#f4f4f4}.-esm-stock-management__stock-sources__headerContainer___Ze03U{display:flex;justify-content:space-between;align-items:center;padding:1rem;background-color:#fff}.-esm-stock-management__stock-sources__headerButtons___diHXv{display:flex;flex-flow:column}.-esm-stock-management__stock-sources__heading___eDFEL{font-size:20px;font-weight:bold}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown--inline .cds--list-box__field{min-width:12rem}.-esm-stock-management__stock-sources__tooltip___CZOKY .cds--tooltip__trigger.cds--tooltip__trigger--definition{border-bottom:none}.-esm-stock-management__stock-sources__tag___KdICQ{margin:.25rem 0}.-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-sources__search___skZQ1{max-width:16rem}.-esm-stock-management__stock-sources__search___skZQ1 input{background-color:#fff !important}.-esm-stock-management__stock-sources__tableContainer___lpDEm{background-color:#f4f4f4;margin:0 1rem;padding:0}.-esm-stock-management__stock-sources__tableContainer___lpDEm a{text-decoration:none}.-esm-stock-management__stock-sources__tableContainer___lpDEm th{color:#525252}.-esm-stock-management__stock-sources__tableContainer___lpDEm .cds--data-table{background-color:#e0e0e0}.-esm-stock-management__stock-sources__tableContainer___lpDEm .-esm-stock-management__stock-sources__toolbarContent___gZ2MJ{height:2rem;margin-bottom:.25rem}.-esm-stock-management__stock-sources__emptyRow___wlFNH{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-sources__stockSourcesTable___KNEf1 tr:last-of-type td{border-bottom:none}.-esm-stock-management__stock-sources__content___EBUcR{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-sources__helper___Pxp0P{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-sources__separator___NUg2A{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-sources__separator___NUg2A::before,.-esm-stock-management__stock-sources__separator___NUg2A::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-sources__separator___NUg2A::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-sources__separator___NUg2A::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-sources__tileContainer___p2Nnr{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-sources__tile___ZRgFn{margin:auto;width:fit-content}.-esm-stock-management__stock-sources__tileContent___dm3Qq{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-sources__menuItem___Brdql{max-width:none}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__desktopHeading___tb1eK,.-esm-stock-management__stock-sources__tabletHeading___rIkv3{text-align:left;text-transform:capitalize;margin-bottom:1rem}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4:after,.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__stock-sources__statusContainer___meWIY{display:flex;align-items:center}.-esm-stock-management__stock-sources__statusContainer___meWIY svg{margin-right:.5rem}.-esm-stock-management__stock-sources__visitType___HhWht{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0)}.-esm-stock-management__stock-sources__headerBtnContainer___zSCLg{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q{margin-left:1rem;height:3rem}.-esm-stock-management__stock-sources__editIcon___A00kf{color:#0f62fe;margin-top:.5rem;cursor:pointer}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/stock-sources.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,yDACE,wBDNM,CCSR,+DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,YAAA,CACA,qBDPc,CCUhB,6DACE,YAAA,CACA,gBAAA,CAGF,uDACE,cAAA,CACA,gBAAA,CAIA,+FACE,KAAA,CAGF,yFACE,WAAA,CAGF,4GACE,eAAA,CAIJ,gHACE,kBAAA,CAGF,mDACE,eAAA,CAGF,+EACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,sDACE,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,wBDjEM,CCkEN,aAAA,CACA,SAAA,CAEA,gEACE,oBAAA,CAGF,iEACE,aC1BM,CD6BR,+EACE,wBD5EI,CC+EN,4HACE,WEzCS,CF0CT,oBEnES,CFuEb,wDACE,cAAA,CACA,YAAA,CACA,kBAAA,CAIA,oFACE,kBAAA,CAKJ,uDG8vBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH5vBF,aCtDQ,CDuDR,mBAAA,CAGF,sDGwvBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CHtvBF,aC5DQ,CD+DV,yDGmvBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CHjvBF,aCjEQ,CDkER,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnHM,CCoHN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7IM,CC8IN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,wDACE,cAAA,CAIA,iEG+rBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH7rBA,aCrHM,CD0HR,gEGwrBE,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CHtrBA,aC5HM,CDgIV,2HAEE,eAAA,CACA,yBAAA,CACA,kBErJW,CFuJX,6IACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2CAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CAEA,mEACE,kBAAA,CAIJ,yDG0pBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CHtpBJ,kEACE,qBDtMc,CCuMd,YE/KW,CFgLX,gBAAA,CAGF,mEACE,gBEpLW,CFqLX,WEjKW,CFoKb,wDACE,aDnMe,CCoMf,gBAAA,CACA,cAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-sources__container___WSslj",headerContainer:"-esm-stock-management__stock-sources__headerContainer___Ze03U",headerButtons:"-esm-stock-management__stock-sources__headerButtons___diHXv",heading:"-esm-stock-management__stock-sources__heading___eDFEL",filterContainer:"-esm-stock-management__stock-sources__filterContainer___SeMsL",tooltip:"-esm-stock-management__stock-sources__tooltip___CZOKY",tag:"-esm-stock-management__stock-sources__tag___KdICQ",backgroundDataFetchingIndicator:"-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ",search:"-esm-stock-management__stock-sources__search___skZQ1",tableContainer:"-esm-stock-management__stock-sources__tableContainer___lpDEm",toolbarContent:"-esm-stock-management__stock-sources__toolbarContent___gZ2MJ",emptyRow:"-esm-stock-management__stock-sources__emptyRow___wlFNH",stockSourcesTable:"-esm-stock-management__stock-sources__stockSourcesTable___KNEf1",content:"-esm-stock-management__stock-sources__content___EBUcR",helper:"-esm-stock-management__stock-sources__helper___Pxp0P",separator:"-esm-stock-management__stock-sources__separator___NUg2A",tileContainer:"-esm-stock-management__stock-sources__tileContainer___p2Nnr",tile:"-esm-stock-management__stock-sources__tile___ZRgFn",tileContent:"-esm-stock-management__stock-sources__tileContent___dm3Qq",menuItem:"-esm-stock-management__stock-sources__menuItem___Brdql",desktopHeading:"-esm-stock-management__stock-sources__desktopHeading___tb1eK",tabletHeading:"-esm-stock-management__stock-sources__tabletHeading___rIkv3",statusContainer:"-esm-stock-management__stock-sources__statusContainer___meWIY",visitType:"-esm-stock-management__stock-sources__visitType___HhWht",headerBtnContainer:"-esm-stock-management__stock-sources__headerBtnContainer___zSCLg",addPatientToListBtn:"-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q",editIcon:"-esm-stock-management__stock-sources__editIcon___A00kf"};const l=i},4300:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko{margin:.5rem}.-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X{padding-bottom:1rem}.-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));gap:16px}.-esm-stock-management__add-stock-user-role-scope__hr___S9Kir{border:1px solid #000}.-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts{margin:5px}.-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM{width:100%}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,mEACE,YCgBW,CDbb,wEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,oEACE,cAAA,CACA,oBCUW,CDPb,qEACE,mBCWW,CDRb,wEACE,YAAA,CACA,2DAAA,CACA,QAAA,CAGF,8DACE,qBAAA,CAGF,kEACE,UAAA,CAGF,oEACE,UAAA",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko",sectionTitle:"-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005",subTitle:"-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq",modalBody:"-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X",checkboxGrid:"-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg",hr:"-esm-stock-management__add-stock-user-role-scope__hr___S9Kir",toggle:"-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts",checkbox:"-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM"};const l=i},5104:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-user-role-scopes__content___g06Q8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-user-role-scopes__helper___VOKFX{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before,.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-user-role-scopes__tile___C5KRv{margin:auto;width:fit-content}.-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/stock-user-role-scopes.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,+DCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,kECm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,mJAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,0EACE,WAAA,CACA,gBAAA,CAGF,yEACE,UAAA,CACA,iBAAA,CAIJ,sEACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,6DACE,WAAA,CACA,iBAAA,CAGF,oEACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-user-role-scopes__content___g06Q8",helper:"-esm-stock-management__stock-user-role-scopes__helper___VOKFX",separator:"-esm-stock-management__stock-user-role-scopes__separator___M4cpF",tileContainer:"-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd",tile:"-esm-stock-management__stock-user-role-scopes__tile___C5KRv",tileContent:"-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa"};const l=i},2894:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deletePackagingUnitButton:()=>js,deletePackagingUnitModal:()=>Us,deleteStockModal:()=>Bs,deleteUserScopeModal:()=>Ps,importBulkStockItemsDialog:()=>zs,importTranslation:()=>ds,root:()=>Is,startupApp:()=>Ls,stockItems:()=>_s,stockItemsLink:()=>hs,stockLocations:()=>Es,stockLocationsLink:()=>ws,stockManagement:()=>Ns,stockManagementAdminCardLink:()=>ms,stockManagementAppMenuItem:()=>Fs,stockNavMenu:()=>ps,stockOperationDialog:()=>Ts,stockOperations:()=>fs,stockOperationsLink:()=>vs,stockOverview:()=>As,stockOverviewLink:()=>gs,stockReports:()=>Ss,stockReportsLink:()=>Ds,stockSettings:()=>Os,stockSettingsLink:()=>xs,stockSources:()=>ks,stockSourcesLink:()=>Cs,stockUserScopes:()=>bs,stockUserScopesLink:()=>ys});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(6478),i=n(1672),l=n.n(i),c=n(7410),s=n.n(c),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),f=n(2434),v=n.n(f),_=n(1422),h=n.n(_),b=n(7813),y={};y.styleTagTransform=h(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(b.Z,y);const k=b.Z&&b.Z.locals?b.Z.locals:void 0;var C=n(601);var E=n(3397);function w(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function S(){var e;return e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){return t=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){w(a,r,o,i,l,"next",e)}function l(e){w(a,r,o,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var x=n(49),N={};N.styleTagTransform=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),B={};B.styleTagTransform=h(),B.setAttributes=g(),B.insert=p().bind(null,"head"),B.domAPI=d(),B.insertStyleElement=v(),s()(T.Z,B);const P=T.Z&&T.Z.locals?T.Z.locals:void 0;var U,j=n(9820);function z(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var r=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var r=e[t];return n&&(!1===r||!0===r||r)||!n&&(""===r||!1===r||!0===r||r)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r.toString())):null})).filter((function(e){return null!=e})).join("&");return r.length>0?"?"+r:""}function F(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function L(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function R(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function M(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e.uuid),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Default="default",e.Full="full",e.REF="ref"}(U||(U={}));var q=function(e){switch(e){case"NEW":return"#0f62fe";case"SUBMITTED":return"#4589ff";case"DISPATCHED":return"#8a3ffc";case"COMPLETED":return"#24a148";case"CANCELLED":return"#da1e28";case"RETURNED":return"#eb6200"}};function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H={isOverlayOpen:!1,component:Function,header:""},Z=function(){return(0,r.getGlobalStore)("dispensing-store",H)},Y=function(e,t){Z().setState({isOverlayOpen:!0,component:t,header:e})},Q=function(){Z().setState({component:null,isOverlayOpen:!1})},J=n(2653),W=n.n(J),V=function(e,t){return e?W()(e).format(null!=t?t:"DD-MMM-YYYY"):""},K=("".concat(window.getOpenmrsSpaBase),W()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),X="d/m/Y",$=function(e){return V(e,K)},ee=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},te=Object.freeze({SOURCES:"Sources",OPERATION:"Operation",STATUS:"Status"}),ne="moduleResources/stockmanagement/assets/print-logo.svg",re="Ministry of Health",oe="Main Store",ae="/openmrs/",ie=!0;function le(e){var t,n,r,o,a,i=null==e||null===(n=e.responseBody)||void 0===n||null===(t=n.error)||void 0===t?void 0:t.fieldErrors;return i?Object.values(i).flatMap((function(e){return e.map((function(e){return e.message}))})):[null!==(a=null==e||null===(o=e.responseBody)||void 0===o||null===(r=o.error)||void 0===r?void 0:r.message)&&void 0!==a?a:null==e?void 0:e.message]}"".concat(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var ce=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ue(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function de(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var me=n(8115);var pe=n(1657);const Ae=function(e){var t=e.row,n=(0,i.useCallback)((function(){var e=(0,r.showModal)("delete-packaging-unit-modal",{closeModal:function(){return e()},row:t})}),[t]);return l().createElement("div",null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:pe.ZN,onClick:n}))};function ge(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function fe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function ve(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockbatch").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function _e(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading,l=n.mutate;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a,mutate:l}}function he(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e,"?v=full"),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{item:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function be(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem"),n=new AbortController;return delete e.isDrug,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function ye(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e.uuid),n=new AbortController;return delete e.isDrug,delete e.dateCreated,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ke(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(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 Ee(e){var t=Ce((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Ce((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=_e(n),s=c.items,u=c.isLoading,d=c.isError,m=c.mutate;return{items:s.results,totalCount:s.totalCount,isLoading:u,isError:d,setStockItemUuid:l,mutate:m}}var we=n(4158),Se={};Se.styleTagTransform=h(),Se.setAttributes=g(),Se.insert=p().bind(null,"head"),Se.domAPI=d(),Se.insertStyleElement=v(),s()(we.Z,Se);const De=we.Z&&we.Z.locals?we.Z.locals:void 0;function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var xe=n(1914),Ne=n(965),Ie={};Ie.styleTagTransform=h(),Ie.setAttributes=g(),Ie.insert=p().bind(null,"head"),Ie.domAPI=d(),Ie.insertStyleElement=v(),s()(Ne.Z,Ie);const Te=Ne.Z&&Ne.Z.locals?Ne.Z.locals:void 0,Be=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 Pe=n(9375),Ue=n(2411),je=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:Te.header},l().createElement("div",{className:Te["left-justified-items"]},l().createElement(Be,null),l().createElement("div",{className:Te["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:Te["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:Te["right-justified-items"]},l().createElement("div",{className:Te["date-and-location"]},l().createElement(Pe.Ye,{size:16}),l().createElement("span",{className:Te.value},o),l().createElement("span",{className:Te.middot},"·"),l().createElement(Ue.f,{size:16}),l().createElement("span",{className:Te.value},(0,r.formatDate)(new Date,{mode:"standard"})))))};const ze=function(e){var t=e.dashboardSlot,n=e.title;return l().createElement(l().Fragment,null,l().createElement(je,null),l().createElement(r.ExtensionSlot,{name:t,state:{dashboardTitle:n}}))};var Fe=n(3011),Le={};Le.styleTagTransform=h(),Le.setAttributes=g(),Le.insert=p().bind(null,"head"),Le.domAPI=d(),Le.insertStyleElement=v(),s()(Fe.Z,Le);const Re=Fe.Z&&Fe.Z.locals?Fe.Z.locals:void 0;var Me=n(6194),qe=n(2296),Ge={};Ge.styleTagTransform=h(),Ge.setAttributes=g(),Ge.insert=p().bind(null,"head"),Ge.domAPI=d(),Ge.insertStyleElement=v(),s()(qe.Z,Ge);const He=qe.Z&&qe.Z.locals?qe.Z.locals:void 0,Ze=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?He.desktopOverlay:He.tabletOverlay},"tablet"!==c?l().createElement("div",{className:He.desktopHeader},l().createElement("div",{className:He.headerContent},t),l().createElement(a.zxk,{className:He.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(Me.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":s("tabletOverlay","Tablet overlay"),className:He.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(me.Xd,{size:16})),l().createElement("div",{className:He.headerContent},t)),l().createElement("div",null,n)))};function Ye(){var e,t=(0,xe.useParams)(),n=(0,r.useExtensionStore)(),o=(0,r.useLayoutType)(),a=(null===(e=n.slots["stock-page-dashboard-slot"])||void 0===e?void 0:e.assignedExtensions.map((function(e){return e.meta})).filter((function(e){return Object.keys(e).length})))||[],i=a.find((function(e){return e.name===(null==t?void 0:t.dashboard)}))||a[0];return l().createElement(l().Fragment,null,l().createElement(Ze,null),l().createElement("div",{className:Re.homePageWrapper},l().createElement("section",{className:(0,r.isDesktop)(o)?Re.dashboardContainer:Re.dashboardContainerTablet},(0,r.isDesktop)(o)&&l().createElement(r.ExtensionSlot,{name:"stock-sidebar-slot",key:o}),l().createElement(ze,{title:null==i?void 0:i.name,dashboardSlot:null==i?void 0:i.slot})),l().createElement(r.WorkspaceContainer,{overlay:!0,contextKey:"stock-management"})))}var Qe=n(2426),Je={};Je.styleTagTransform=h(),Je.setAttributes=g(),Je.insert=p().bind(null,"head"),Je.domAPI=d(),Je.insertStyleElement=v(),s()(Qe.Z,Je);const We=Qe.Z&&Qe.Z.locals?Qe.Z.locals:void 0;var Ve=n(3432),Ke={};Ke.styleTagTransform=h(),Ke.setAttributes=g(),Ke.insert=p().bind(null,"head"),Ke.domAPI=d(),Ke.insertStyleElement=v(),s()(Ve.Z,Ke);const Xe=Ve.Z&&Ve.Z.locals?Ve.Z.locals:void 0;var $e=n(9697),et=n(7412),tt=n.n(et);W().extend(tt());const nt=function(e){var t,n,o,i,c,s=e.label,u=e.value,d=e.headerLabel,m=e.children,p=e.view,A=e.count,g=e.outofstockCount,f=e.disposedCount,v=(0,E.useTranslation)().t;return l().createElement(a.n9L,{className:Xe.tileContainer},l().createElement("div",{className:Xe.tileHeader},l().createElement("div",{className:Xe.headerLabelContainer},l().createElement("label",{className:Xe.headerLabel},d),m),p&&l().createElement(r.ConfigurableLink,{className:Xe.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(me.ol,{size:16,className:Xe.viewListBtn}))),l().createElement("div",{className:Xe.metricsGrid},l().createElement("div",null,l().createElement("label",{className:Xe.totalsLabel},s),l().createElement("p",{className:Xe.totalsValue},u)),!(0,$e.Z)(A)&&l().createElement("div",{className:Xe.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("in6months","In 6 months")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=A.expiry6months)||void 0===t?void 0:t.length)),!(0,$e.Z)(g)&&l().createElement("div",{className:Xe.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},v("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(n=g.itemsbelowmin)||void 0===n?void 0:n.length),l().createElement("p",{style:{color:"#319227"}},null===(o=g.itemsabovemax)||void 0===o?void 0:o.length)),!(0,$e.Z)(f)&&l().createElement("div",{className:Xe.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},v("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(i=f.expired)||void 0===i?void 0:i.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(c=f.poorquality)||void 0===c?void 0:c.length))))};function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ot(e){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 rt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rt(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=ge(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 at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function it(){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 at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(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=ve(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 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(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockitem?v=default&totalCount=true"),t=(0,j.ZP)(e,r.openmrsFetch),n=t.data,o=t.error,a=null==n?void 0:n.data.results.map((function(e){return{uuid:e.uuid,hasExpiration:e.hasExpiration,expiryNotice:e.expiryNotice}}));return{stockList:null!=a?a:[],isLoading:!n&&!o,error:o}}(),o=n.stockList,i=n.isLoading,c=n.error,s=it(),u=s.items,d=(s.isLoading,ot().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){lt(e,t,n[t])}))}return e}({},e,t)}));p=p.filter((function(e){return e.hasExpiration}));var A=p.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),r=Math.ceil((n.getTime()-m.getTime())/864e5);return r<=t||r<0})),g=A.filter((function(e){return e.hasExpiration&&e.expiryNotice<=180})),f=function(e){var t,n=F(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(c)return l().createElement(r.ErrorState,{headerTitle:t("errorStockMetric"),error:c});var v=f&&f.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),_=f&&f.filter((function(e){return"Poor Quality"===e.reasonName}));return l().createElement(l().Fragment,null,l().createElement("div",{className:We.cardContainer},l().createElement(nt,{label:t("stocks","Expiring stock"),value:(null==A?void 0:A.length)||0,headerLabel:t("expiringStock","Expiring Stock"),view:"items",count:{expiry6months:g}}),l().createElement(nt,{label:t("outofstock","Out of Stock"),value:null==o?void 0:o.length,headerLabel:t("highestServiceVolume","Out of Stock "),view:"items",outofstockCount:{itemsbelowmin:["0"],itemsabovemax:["0"]}}),l().createElement(nt,{label:t("disposedstock","Disposed Stock"),value:(null==f?void 0:f.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:v,poorquality:_}})))};var st=n(8629),ut={};ut.styleTagTransform=h(),ut.setAttributes=g(),ut.insert=p().bind(null,"head"),ut.domAPI=d(),ut.insertStyleElement=v(),s()(st.Z,ut);const dt=st.Z&&st.Z.locals?st.Z.locals:void 0;var mt=n(4797);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}const At=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),it()),n=t.items,o=t.isLoading,i=ot(),c=i.items;if(i.isLoading||o)return l().createElement(l().Fragment,null);if(0===(null==c?void 0:c.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:dt.content},e("inventoryAlertNull","No inventory alerts to display")));var s=new Date,u=n.map((function(e){var t=null==c?void 0:c.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){pt(e,t,n[t])}))}return e}({},e,t)}));u=u.filter((function(e){return e.hasExpiration}));var d=u.filter((function(e){var t=new Date(e.expiration),n=Math.ceil((t.getTime()-s.getTime())/864e5);return n<=180&&n>=0})).slice(0,5);return l().createElement(l().Fragment,null,d.map((function(e,t){return l().createElement("div",{className:dt.card,key:t},l().createElement("div",{className:dt.colorLineRed}),l().createElement("div",{className:dt.icon},l().createElement(mt.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:dt.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 gt=n(8748);const ft=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:dt.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:dt.card,key:t},l().createElement("div",{className:dt.colorLineBlue}),l().createElement("div",{className:dt.icon},l().createElement(gt.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:dt.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 vt=n(2327);const _t=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:dt.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:dt.card,key:t},l().createElement("div",{className:dt.colorLineGreen}),l().createElement("div",{className:dt.icon},l().createElement(vt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:dt.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"))},ht=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:dt.cardContainer},l().createElement("div",{className:dt.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?dt.tabletHeading:dt.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(At,null)))),l().createElement("div",{className:dt.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?dt.tabletHeading:dt.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(ft,null)))),l().createElement("div",{className:dt.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?dt.tabletHeading:dt.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(_t,null)))))};function bt(e){var t=e.dashboardLinkConfig,n=t.name,o=t.title,a=(0,xe.useLocation)(),c="".concat(window.spaBase,"/stock-management"),s=(0,i.useMemo)((function(){var e=a.pathname.split("/"),t=e[e.length-1];return decodeURIComponent(t)}),[a.pathname]);return l().createElement(r.ConfigurableLink,{to:"".concat(c,"/").concat(n),className:"cds--side-nav__link ".concat(s.match(n)&&"active-left-nav-link")},o)}var yt=function(e){return function(){return l().createElement(xe.BrowserRouter,null,l().createElement(bt,{dashboardLinkConfig:e}))}};function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ct(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 kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kt(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 Et=n(1535),wt={};wt.styleTagTransform=h(),wt.setAttributes=g(),wt.insert=p().bind(null,"head"),wt.domAPI=d(),wt.insertStyleElement=v(),s()(Et.Z,wt);const St=Et.Z&&Et.Z.locals?Et.Z.locals:void 0;var Dt="RETURNED",Ot="CANCELLED",xt="REJECTED",Nt=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Dt,Ot,xt],It=n(6817),Tt=n(4642);function Bt(){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,Tt.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}function Pt(e){var t="".concat(r.restBaseUrl,"/role").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ut(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default"),t=(0,j.ZP)(e,r.openmrsFetch),n=t.data,o=t.isLoading,a=t.error;return{types:(null==n?void 0:n.data)||{},isLoading:o,isError:a}}function jt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default");return(0,r.openmrsFetch)(e)}function zt(e){var t="".concat(r.restBaseUrl,"/user").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ft(e){var t="".concat(r.restBaseUrl,"/concept/").concat(e),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Lt(e,t){(null==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 Rt=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Ut(),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 Lt(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 Lt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lt(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(It.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 Mt=n(5260),qt={};qt.styleTagTransform=h(),qt.setAttributes=g(),qt.insert=p().bind(null,"head"),qt.domAPI=d(),qt.insertStyleElement=v(),s()(Mt.Z,qt);const Gt=Mt.Z&&Mt.Z.locals?Mt.Z.locals:void 0,Ht=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?Gt.tabContainer:"","\n ").concat(Gt.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Gt.heading},n),l().createElement("div",{className:Gt.tab},l().createElement(a.mQc,{className:"".concat(Gt.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 Zt,Yt;function Qt(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}(Yt=Zt||(Zt={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Yt.DISPOSED_OPERATION_TYPE="disposed",Yt.STOCK_ISSUE_OPERATION_TYPE="stockissue",Yt.STOCK_TAKE_OPERATION_TYPE="stocktake",Yt.REQUISITION_OPERATION_TYPE="requisition",Yt.OPENING_STOCK_OPERATION_TYPE="initial",Yt.RECEIPT_OPERATION_TYPE="receipt",Yt.RETURN_OPERATION_TYPE="return",Yt.ADJUSTMENT_OPERATION_TYPE="adjustment";var Jt=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Wt=function(e){return!Vt(e)&&"requisition"!==e},Vt=function(e){return"receipt"===e||"initial"===e},Kt=function(e){return"requisition"===e},Xt=function(e){return"receipt"===e||"initial"===e},$t=function(e){return"stockissue"===e||"return"===e},en=function(e){return"stockissue"===e||tn(e)||nn(e)||rn(e)},tn=function(e){return"requisition"===e},nn=function(e){return"receipt"===e},rn=function(e){return"transferout"===e},on=n(7536),an=n(6312),ln=n(1604),cn=ln.z.object({id:ln.z.string().nullish(),uuid:ln.z.string().nullish(),stockItemUuid:ln.z.string().nullish(),packagingUomName:ln.z.string().nullish(),packagingUomUuid:ln.z.string().nullish(),factor:ln.z.number().nullish(),isDefaultStockOperationsUoM:ln.z.boolean().nullish(),isDispensingUnit:ln.z.boolean().nullish()}),sn=ln.z.object({canView:ln.z.boolean(),canEdit:ln.z.boolean(),canApprove:ln.z.boolean().nullish(),canReceiveItems:ln.z.boolean().nullish(),canDisplayReceivedItems:ln.z.boolean().nullish(),isRequisitionAndCanIssueStock:ln.z.boolean().nullish(),canUpdateBatchInformation:ln.z.boolean().nullish()}),un=ln.z.object({itemIndex:ln.z.number().nullish(),id:ln.z.string().nullish(),uuid:ln.z.string().nullish(),stockItemUuid:ln.z.string().nullish(),stockItemName:ln.z.string().nullish(),stockItemPackagingUOMUuid:ln.z.string().nullish(),stockItemPackagingUOMName:ln.z.string().nullish(),stockBatchUuid:ln.z.string().nullish(),batchNo:ln.z.string().nullish(),expiration:ln.z.coerce.date().nullish(),quantity:ln.z.number().nullish(),purchasePrice:ln.z.number().nullish(),permission:sn.nullish(),edit:ln.z.boolean().nullish(),hasExpiration:ln.z.boolean().nullish(),packagingUnits:cn.array(),quantityReceived:ln.z.number().nullish(),quantityReceivedPackagingUOMName:ln.z.string().nullish(),quantityReceivedPackagingUOMUuid:ln.z.string().nullish(),quantityRequested:ln.z.number().nullish(),quantityRequestedPackagingUOMUuid:ln.z.string().nullish(),quantityRequestedPackagingUOMName:ln.z.string().nullish(),commonName:ln.z.string().nullish(),acronym:ln.z.string().nullish()}),dn=(ln.z.object({uuid:ln.z.string().nullish(),cancelReason:ln.z.string().nullish(),cancelledBy:ln.z.coerce.number(),cancelledByGivenName:ln.z.string().nullish(),cancelledByFamilyName:ln.z.string().nullish(),cancelledDate:ln.z.coerce.date(),completedBy:ln.z.coerce.number(),completedByGivenName:ln.z.string().nullish(),completedByFamilyName:ln.z.string().nullish(),completedDate:ln.z.coerce.date(),destinationUuid:ln.z.string().nullish(),destinationName:ln.z.string().nullish(),externalReference:ln.z.string().nullish(),atLocationUuid:ln.z.string().nullish(),atLocationName:ln.z.string().nullish(),operationDate:ln.z.coerce.date(),submitted:ln.z.boolean(),submittedBy:ln.z.string().nullish(),submittedByGivenName:ln.z.string().nullish(),submittedByFamilyName:ln.z.string().nullish(),locked:ln.z.boolean(),operationNumber:ln.z.string().nullish(),operationOrder:ln.z.coerce.number(),remarks:ln.z.string().nullish(),sourceUuid:ln.z.string().nullish(),sourceName:ln.z.string().nullish(),status:ln.z.enum(Nt),returnReason:ln.z.string().nullish(),rejectionReason:ln.z.string().nullish(),operationTypeUuid:ln.z.string().nullish(),operationType:ln.z.string().nullish(),operationTypeName:ln.z.string().nullish(),responsiblePerson:ln.z.coerce.number(),responsiblePersonUuid:ln.z.string().nullish(),responsiblePersonGivenName:ln.z.string().nullish(),responsiblePersonFamilyName:ln.z.string().nullish(),responsiblePersonOther:ln.z.string().nullish(),creator:ln.z.coerce.number(),dateCreated:ln.z.coerce.date(),creatorGivenName:ln.z.string().nullish(),creatorFamilyName:ln.z.string().nullish(),permission:sn.nullish(),reasonUuid:ln.z.string().nullish(),reasonName:ln.z.string().nullish(),approvalRequired:ln.z.boolean().nullish(),stockOperationItems:un.array(),submittedDate:ln.z.coerce.date(),returnedByGivenName:ln.z.string().nullish(),returnedByFamilyName:ln.z.string().nullish(),returnedDate:ln.z.coerce.date(),rejectedByGivenName:ln.z.string().nullish(),rejectedByFamilyName:ln.z.string().nullish(),rejectedDate:ln.z.coerce.date(),dispatchedByGivenName:ln.z.string().nullish(),dispatchedByFamilyName:ln.z.string().nullish(),dispatchedDate:ln.z.coerce.date(),requisitionStockOperationUuid:ln.z.string()}),ln.z.object({operationDate:ln.z.coerce.date(),sourceUuid:ln.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:ln.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:ln.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:ln.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:ln.z.string().nullish(),remarks:ln.z.string().nullish()})),mn=function(e){switch(e){case Zt.OPENING_STOCK_OPERATION_TYPE:return dn.omit({destinationUuid:!0,reasonUuid:!0});case Zt.STOCK_TAKE_OPERATION_TYPE:case Zt.ADJUSTMENT_OPERATION_TYPE:case Zt.DISPOSED_OPERATION_TYPE:return dn.omit({destinationUuid:!0});case Zt.TRANSFER_OUT_OPERATION_TYPE:case Zt.STOCK_ISSUE_OPERATION_TYPE:return dn.omit({reasonUuid:!0}).merge(ln.z.object({destinationUuid:ln.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Zt.RETURN_OPERATION_TYPE:case Zt.REQUISITION_OPERATION_TYPE:case Zt.RECEIPT_OPERATION_TYPE:return dn.omit({reasonUuid:!0}).merge(ln.z.object({sourceUuid:ln.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const pn=function(e){return l().createElement(on.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 An(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gn(e,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 An(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?An(e,t):void 0}}(e,t)||function(){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 fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vn(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 fn(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 fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}),t);clearTimeout(n.current),n.current=i}}var _n=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:""}},hn={uuid:"Other",display:"Other",person:{display:"Other"}};function bn(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const yn=function(e){var t=function(e){var t=gn((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=zt(n),a=o.items.results,l=o.isLoading,c=gn((0,i.useState)(null),2),s=c[0],u=c[1],d=gn((0,i.useState)(10),2),m=d[0],p=d[1],A=gn((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=vn((function(e){o(e)}),1e3);return r&&r.push(hn),l().createElement("div",null,l().createElement(on.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:bn,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 kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cn=function(e){return l().createElement(on.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){kn(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.id,ref:s,value:null!=c?c:e.value})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n))}})},En=function(e){var t=Ft((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(on.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 wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sn=function(e){return l().createElement(on.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){wn(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 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}var On=(0,i.createContext)(null),xn=function(){return(0,i.useContext)(On)},Nn=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 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}}(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(On.Provider,{value:a},r)},In=[Zt.ADJUSTMENT_OPERATION_TYPE,Zt.RECEIPT_OPERATION_TYPE,Zt.STOCK_ISSUE_OPERATION_TYPE,Zt.STOCK_TAKE_OPERATION_TYPE,Zt.RETURN_OPERATION_TYPE,Zt.DISPOSED_OPERATION_TYPE,Zt.OPENING_STOCK_OPERATION_TYPE,Zt.TRANSFER_OUT_OPERATION_TYPE],Tn=[Zt.ADJUSTMENT_OPERATION_TYPE,Zt.DISPOSED_OPERATION_TYPE,Zt.STOCK_TAKE_OPERATION_TYPE,Zt.OPENING_STOCK_OPERATION_TYPE];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 Pn(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 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 jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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}}(e,t)||function(){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 zn=function(e){var t,n,r,o,c,s,u,d,m,p,A,g,f,v=e.model,_=e.onSave,h=e.operation,b=e.canEdit,y=e.isEditing,k=e.setup,C=k.requiresStockAdjustmentReason,w=k.shouldLockSource,S=k.shouldLockDestination,D=k.sourcePartyList,O=k.destinationPartyList,x=(0,E.useTranslation)().t,N=(xn().setFormContext,Ct({v:U.Full,totalCount:!0})),T=N.isLoading,B=(N.items,Qt(null==h?void 0:h.operationType)),P=(d=(u=v).sourceUuid,m=u.sourceName,p=u.destinationUuid,A=u.destinationName,g=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Un(e,t,n[t])}))}return e}({},u),f=null!=(f={sourceUuid:p,sourceName:A,destinationUuid:d,destinationName:m})?f:{},Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(f)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(f)).forEach((function(e){Object.defineProperty(g,e,Object.getOwnPropertyDescriptor(f,e))})),g),j=(0,on.cI)({defaultValues:"stockissue"===B?P:v,mode:"all",resolver:(0,an.F)(mn(B))}),z=j.handleSubmit,F=j.control,L=j.formState.errors,R=j.setValue,M=jn((0,i.useState)(),2),q=M[0],G=M[1],H=jn((0,i.useState)(!1),2),Z=H[0],Y=H[1];if(T)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Q,J,W,V,te,ne,re=function(){var e,t=(e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),Y(!0),t=function(e,t,n){var r=Object.assign(e,t);return function(e,t){["submitted","cancelledByFamilyName","atLocationName","completedByGivenName","cancelledBy","submittedByFamilyName","operationOrder","dispatchedByGivenName","submittedByGivenName","returnedByGivenName","operationNumber","responsiblePersonFamilyName","returnReason","atLocationUuid","cancelReason","rejectedByGivenName","reasonName","submittedBy","creator","completedByFamilyName","operationTypeName","rejectedByFamilyName","responsiblePerson","creatorFamilyName","returnedByFamilyName","cancelledByGivenName","operationType","responsiblePersonGivenName","sourceName","rejectionReason","completedBy","creatorGivenName","dispatchedByFamilyName","uuid"].forEach((function(t){delete e[t]}))}(r),function(e){return In.includes(e)}(n)&&delete r.destinationName,function(e){return Tn.includes(e)}(n)&&delete r.destinationUuid,r}(v,e,B),[4,_(t)];case 1:case 2:return n.sent(),[3,4];case 3:return Y(!1),[7];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Pn(a,r,o,i,l,"next",e)}function l(e){Pn(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)},b&&l().createElement(on.Qr,{control:F,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=jn(e,1)[0];n(t)}},l().createElement(a.aj6,{invalid:!!L.operationDate,invalidText:null==L||null===(t=L.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:K,labelText:x("operationDate","Operation Date"),defaultValue:$(null==v?void 0:v.operationDate)}))},name:"operationDate"}),!b&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(null==v?void 0:v.operationDate),readOnly:!0,labelText:"Operation Date"})),y&&(null==v?void 0:v.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==v?void 0:v.operationNumber,readOnly:!0,labelText:"Operation Number"}),b&&!w&&(null==h?void 0:h.hasSource)&&l().createElement(pn,{controllerName:"sourceUuid",name:"sourceUuid",control:F,title:(null==h?void 0:h.hasDestination)?x("from","From"):x("location:","Location"),placeholder:h.hasDestination?x("chooseASource","Choose a source"):x("chooseALocation","Choose a location"),invalid:!!L.sourceUuid,invalidText:L.sourceUuid&&(null==L||null===(t=L.sourceUuid)||void 0===t?void 0:t.message),parties:D||[]}),(!b||y||w)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:"stockissue"===B?P.sourceName:null!==(Q=null==v?void 0:v.sourceName)&&void 0!==Q?Q:"",readOnly:!0,labelText:(null==h||h.hasDestination,"From")}),b&&!S&&(null==h?void 0:h.hasDestination)&&l().createElement(pn,{controllerName:"destinationUuid",name:"destinationUuid",control:F,title:(null==h?void 0:h.hasSource)?"To":"Location",placeholder:(null==h?void 0:h.hasSource)?x("chooseADestination","Choose a destination"):"Location",invalid:!!L.destinationUuid,invalidText:L.destinationUuid&&(null==L||null===(n=L.destinationUuid)||void 0===n?void 0:n.message),parties:O||[]}),(!b||y||S)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:"stockissue"===B?P.destinationName:null!==(J=null==v?void 0:v.destinationName)&&void 0!==J?J:"",readOnly:!0,labelText:(null==h||h.hasSource,"To")}),b&&l().createElement(yn,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:F,title:x("responsiblePerson:","Responsible Person"),placeholder:x("filter","Filter ..."),invalid:!!L.responsiblePersonUuid,invalidText:L.responsiblePersonUuid&&(null==L||null===(r=L.responsiblePersonUuid)||void 0===r?void 0:r.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===hn.uuid&&G(!0)}}),q&&l().createElement(Cn,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:F,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(W=null==v?void 0:v.responsiblePersonOther)&&void 0!==W?W:""),labelText:x("responsiblePerson","Responsible Person"),placeholder:x("pleaseSpecify","Please Specify"),invalid:!!L.responsiblePersonOther,invalidText:L.responsiblePersonOther&&(null==L||null===(o=L.responsiblePersonOther)||void 0===o?void 0:o.message)}),!b&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(V=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==hn.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==V?V:"",readOnly:!0,labelText:"Responsible Person"}),C&&b&&l().createElement(En,{controllerName:"reasonUuid",name:"reasonUuid",control:F,placeholder:x("chooseAReason","Choose a reason"),title:x("reason","Reason"),invalid:!!L.reasonUuid,invalidText:L.reasonUuid&&(null==L||null===(c=L.reasonUuid)||void 0===c?void 0:c.message),onReasonChange:function(e){R("reasonUuid",e.uuid)}}),C&&!b&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(te=null==v?void 0:v.reasonName)&&void 0!==te?te:"",readOnly:!0,labelText:"Reason:"}),l().createElement(Sn,{id:"remarks",name:"remarks",control:F,controllerName:"remarks",maxLength:255,value:"".concat(null!==(ne=null==v?void 0:v.remarks)&&void 0!==ne?ne:""),labelText:x("remarks:","Remarks"),invalid:!!L.remarks,invalidText:L.remarks&&(null==L||null===(s=L.remarks)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:z(re),kind:"primary",renderIcon:me.ol},Z?l().createElement(a.lSo,null):x("next","Next")))))};var Fn={stockItemUuid:ln.z.string().min(1,{message:"Required"}),stockItemName:ln.z.string().min(1).nullish(),stockItemPackagingUOMUuid:ln.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:ln.z.string().min(1).nullish(),batchNo:ln.z.string().min(1,{message:"Required"}),stockBatchUuid:ln.z.string().optional(),expiration:ln.z.coerce.date({required_error:"Required"}),quantity:ln.z.coerce.number().min(1,{message:"Required"}),purchasePrice:ln.z.coerce.number().nullish(),hasExpiration:ln.z.boolean().nullish()},Ln=ln.z.object(Fn),Rn=(Ln.omit({expiration:!0}),ln.z.object({stockItems:ln.z.array(Ln)})),Mn=n(6781),qn={};qn.styleTagTransform=h(),qn.setAttributes=g(),qn.insert=p().bind(null,"head"),qn.domAPI=d(),qn.insertStyleElement=v(),s()(Mn.Z,qn);const Gn=Mn.Z&&Mn.Z.locals?Mn.Z.locals:void 0;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}function Zn(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 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}}(e,t)||function(){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 Yn(e){return e.drugName||e.conceptName}const Qn=function(e){var t=function(e){var t=Zn((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=ge(n),a=o.items.results,l=o.isLoading,c=Zn((0,i.useState)(null),2),s=c[0],u=c[1],d=Zn((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Zn((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=vn((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(on.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:Yn,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Jn=function(e){var t,n=he(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(on.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=s.uuid)&&void 0!==t?t:"",render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(n=null==c?void 0:c.packagingUnits)&&void 0!==n?n:[],onChange:function(t){var n,r;null===(n=e.onStockPackageChanged)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:s,itemToString:function(e){return e.packagingUomName?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kn(e,t){(null==t||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){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 Kn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kn(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 $n(e){var t=Xn((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||U.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=Xn((0,i.useState)(10),2),a=o[0],l=o[1],c=Xn((0,i.useState)(null),2),s=c[0],u=c[1],d=Xn((0,i.useState)(1),2),m=d[0],p=d[1],A=Xn((0,i.useState)(null==e?void 0:e.stockItemUuid),2),g=A[0],f=A[1],v=Xn((0,i.useState)(null==e?void 0:e.partyUuid),2),_=v[0],h=v[1],b=Xn((0,i.useState)(null==e?void 0:e.locationUuid),2),y=b[0],k=b[1],C=Xn((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E,includeBatchNo:!0})}),[s,m,a,g,_,y,E]);var S,D=fe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}function er(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const tr=function(e){var t=function(e){var t=Vn((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=ve(n),a=o.items.results,l=o.isLoading,c=Vn((0,i.useState)(null),2),s=c[0],u=c[1],d=Vn((0,i.useState)(10),2),m=d[0],p=d[1],A=Vn((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=$n(),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){er(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(on.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 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}function rr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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}}(e,t)||function(){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 or=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=rr((0,i.useState)(),2),_=(v[0],v[1]),h=rr((0,i.useState)(),2),b=(h[0],h[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,h,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,V,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Gn.desktopRow:Gn.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(Qn,{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(tr,{batchUuid:null==e?void 0:e.stockBatchUuid,onBatchNoChanged:function(e){p("stockItems.".concat(i,".batchNo"),null==e?void 0:e.batchNo),p("stockItems.".concat(i,".expiration"),null==e?void 0:e.expiration),b(null==e?void 0:e.expiration)},placeholder:"Filter...",invalid:!!(null==A||null===(S=A.stockItems)||void 0===S||null===(w=S[i])||void 0===w?void 0:w.stockBatchUuid),control:m,controllerName:"stockItems.".concat(i,".stockBatchUuid"),name:"stockItems.".concat(i,".stockBatchUuid"),stockItemUuid:e.stockItemUuid}),!(s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=rr(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:K,defaultValue:$(null==e?void 0:e.expiration),invalid:!!(null==A||null===(N=A.stockItems)||void 0===N||null===(x=N[i])||void 0===x?void 0:x.expiration)})),(!(s&&(null==e||null===(I=e.permission)||void 0===I?void 0:I.canUpdateBatchInformation))&&!t||c)&&$(e.expiration)),l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{className:"small-placeholder-text",size:"sm",id:"qty-".concat(null==e?void 0:e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".quantity"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(J=null==e?void 0:e.quantity)&&void 0!==J?J:"",invalidText:null==A||null===(P=A.stockItems)||void 0===P||null===(B=P[i])||void 0===B||null===(T=B.quantity)||void 0===T?void 0:T.message,placeholder:c&&!o&&(null==e?void 0:e.stockBatchUuid)in d?"Bal: ".concat(null!==(W=null===(j=d[null==e?void 0:e.stockBatchUuid])||void 0===j||null===(U=j.quantity)||void 0===U?void 0:U.toLocaleString())&&void 0!==W?W:""," ").concat(null!==(V=null===(z=d[null==e?void 0:e.stockBatchUuid])||void 0===z?void 0:z.quantityUoM)&&void 0!==V?V:""):"",invalid:!!(null==A||null===(L=A.stockItems)||void 0===L||null===(F=L[i])||void 0===F?void 0:F.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Jn,{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:pe.ZN,onClick:function(){return g(i)}})))})))};var ar=n(6360),ir={};ir.styleTagTransform=h(),ir.setAttributes=g(),ir.insert=p().bind(null,"head"),ir.domAPI=d(),ir.insertStyleElement=v(),s()(ar.Z,ir);const lr=ar.Z&&ar.Z.locals?ar.Z.locals:void 0;function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sr(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 ur(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dr(e){return function(e){if(Array.isArray(e))return cr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||mr(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 mr(e,t){if(e){if("string"==typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(e,t):void 0}}const pr=function(e){var t,n,o,c,s,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,f=u.batchNos,v=u.canUpdateItemsBatchInformation,_=u.itemUoM,h=e.canEdit,b=void 0===h||h,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,D=xn().formContext,O=function(e){if("requisition"===e){var t=Ln.omit({batchNo:!0,expiration:!0});return ln.z.object({stockItems:ln.z.array(t)})}return Rn}(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){sr(a,r,o,i,l,"next",e)}function l(e){sr(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,on.cI)({resolver:(0,an.F)(O),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,B=N.setValue,P=N.formState.errors,U=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||mr(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,on.Dq)({name:"stockItems",control:T}),z=j.fields,F=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==D?void 0:D.stockItems){var e=null==D?void 0:D.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==D?void 0:D.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(dr(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),dr(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),dr(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),dr(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")}],dr(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:lr.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){ur(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?lr.desktopHeader:lr.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:me.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:me.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(or,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:f,control:T,setValue:B,errors:P,remove:L,append:F,canEdit:b,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:z})," ")))}})))};var Ar=n(8808);function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function vr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){fr(a,r,o,i,l,"next",e)}function l(e){fr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function _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 gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gr(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){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 br=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=_r((0,i.useState)(!1),2),d=u[0],m=u[1],p=_r((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:vr((function(){return hr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onComplete(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:Pe.X4},s("complete","Complete")),o&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:vr((function(){return hr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onDispatch(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:gt.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:Ar.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:vr((function(){return hr(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:Ar.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:pe.WP},s("goBack","Go Back"))))};var yr="Location",kr="Other";function Cr(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 Er(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H;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(_n()),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,Zt.STOCK_ISSUE_OPERATION_TYPE,[4,(Q="".concat(r.restBaseUrl,"/stockmanagement/party?v=default"),(0,r.openmrsFetch)(Q))]):[3,2];case 1:if(!(I=Z.sent()).ok)throw Error("Error loading parties");return D=null==I||null===(N=I.data)||void 0===N||null===(x=N.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===yr&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===kr})),(null==e?void 0:e.hasSource)&&A&&k&&(null==D?void 0:D.length)>0&&(T=D[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(O=null==I||null===(P=I.data)||void 0===P||null===(B=P.results)||void 0===B?void 0:B.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===yr&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===kr})),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,jt()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return z=Qt(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=z,"adjustment"===Y),requiresBatchUuid:Wt(z),requiresActualBatchInfo:Vt(z),isQuantityOptional:Kt(z),canCaptureQuantityPrice:Xt(z),requiresStockAdjustmentReason:Jt(z),requiresDispatchAcknowledgement:$t(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||en(z),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===yr&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===kr},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===yr&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===kr},location:S,sourcePartyList:D,destinationPartyList:O,stockOperationTypes:v,hasQtyRequested:f}]}var Y,Q}))},Er=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Cr(a,r,o,i,l,"next",e)}function l(e){Cr(a,r,o,i,l,"throw",e)}i(void 0)}))},Er.apply(this,arguments)}function wr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sr(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 wr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(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 Or(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,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]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Or(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ir=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"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){Nr(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Tr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Br=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"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(Me.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){Tr(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};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}const Ur=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(vt.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){Pr(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function jr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var zr,Fr,Lr=(zr=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={},Zt.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):Zt.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]}))},Fr=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=zr.apply(e,t);function a(e){jr(o,n,r,a,i,"next",e)}function i(e){jr(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Fr.apply(this,arguments)});function Rr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Mr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Rr(a,r,o,i,l,"next",e)}function l(e){Rr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function qr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Gr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return'<html>\n<head>\n<meta http-equiv=Content-Type content="text/html; charset=utf8">\n<title>'.concat(null!=t?t:"","</title>\n<style>\n").concat('\n/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the main element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on h1 elements within section and\n * article contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent sub and sup elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type="button"],\n[type="reset"],\n[type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type="button"]::-moz-focus-inner,\n[type="reset"]::-moz-focus-inner,\n[type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type="button"]:-moz-focusring,\n[type="reset"]:-moz-focusring,\n[type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from fieldset elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * fieldset elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type="checkbox"],\n[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type="number"]::-webkit-inner-spin-button,\n[type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to inherit in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n/*!\n * Gutenberg\n *\n * MIT Fabien Sa\n * https://github.com/BafS/Gutenberg\n */\n\n* {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n *,\n *:before,\n *:after,\n p:first-letter,\n div:first-letter,\n blockquote:first-letter,\n li:first-letter,\n p:first-line,\n div:first-line,\n blockquote:first-line,\n li:first-line {\n background: transparent !important;\n box-shadow: none !important;\n text-shadow: none !important;\n }\n \n html {\n font-size: 16px;\n margin: 0;\n padding: 0;\n }\n \n body {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n background: #fff !important;\n color: #000 !important;\n font-family: Arial, sans-serif, "Helvetica Neue", Helvetica;\n font-size: 1rem;\n line-height: 1.5;\n margin: 0 auto;\n text-rendering: optimizeLegibility;\n }\n \n p,\n blockquote,\n table,\n ul,\n ol,\n dl {\n margin-bottom: 1.5rem;\n margin-top: 0;\n }\n \n p:last-child,\n ul:last-child,\n ol:last-child {\n margin-bottom: 0;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: #000;\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n line-height: 1.2;\n margin-bottom: 0.75rem;\n margin-top: 0;\n }\n \n h1 {\n font-size: 2.5rem;\n }\n \n h2 {\n font-size: 2rem;\n }\n \n h3 {\n font-size: 1.75rem;\n }\n \n h4 {\n font-size: 1.5rem;\n }\n \n h5 {\n font-size: 1.25rem;\n }\n \n h6 {\n font-size: 1rem;\n }\n \n a,\n a:visited {\n color: #000;\n text-decoration: underline;\n word-wrap: break-word;\n }\n \n table {\n border-collapse: collapse;\n }\n \n thead {\n display: table-header-group;\n }\n \n table,\n th,\n td {\n border-bottom: 1px solid #000;\n }\n \n td,\n th {\n padding: 0px;\n page-break-inside: avoid;\n }\n \n code,\n pre,\n kbd {\n border: 1px solid #bbb;\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n font-size: 85%;\n }\n \n code,\n kbd {\n padding: 3px;\n }\n \n pre {\n margin-bottom: 1.5rem;\n padding: 10px 12px;\n }\n \n pre code,\n pre kbd {\n border: 0;\n }\n \n ::-webkit-input-placeholder {\n color: transparent;\n }\n \n :-moz-placeholder {\n color: transparent;\n }\n \n ::-moz-placeholder {\n color: transparent;\n }\n \n :-ms-input-placeholder {\n color: transparent;\n }\n \n blockquote {\n border: 0;\n border-left: 5px solid #bbb;\n margin-left: 1px;\n padding: 12px 1.5rem;\n }\n \n [dir=\'rtl\'] blockquote {\n border-left: 0;\n border-right: 5px solid #bbb;\n margin-left: 0;\n margin-right: 1px;\n }\n \n blockquote:first-child {\n margin-top: 0;\n }\n \n blockquote p:last-child,\n blockquote ul:last-child,\n blockquote ol:last-child {\n margin-bottom: 0;\n }\n \n blockquote footer {\n display: block;\n font-size: 80%;\n }\n \n img {\n border: 0;\n display: block;\n max-width: 100% !important;\n vertical-align: middle;\n }\n \n hr {\n border: 0;\n border-bottom: 2px solid #bbb;\n height: 0;\n margin: 2.25rem 0;\n padding: 0;\n }\n \n dt {\n font-weight: bold;\n }\n \n dd {\n margin: 0;\n margin-bottom: 0.75rem;\n }\n \n abbr[title],\n acronym[title] {\n border: 0;\n text-decoration: none;\n }\n \n table,\n blockquote,\n pre,\n code,\n figure,\n li,\n hr,\n ul,\n ol,\n a,\n tr {\n page-break-inside: avoid;\n }\n \n h2,\n h3,\n h4,\n p,\n a {\n orphans: 3;\n widows: 3;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n page-break-after: avoid;\n page-break-inside: avoid;\n }\n \n h1+p,\n h2+p,\n h3+p {\n page-break-before: avoid;\n }\n \n img {\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: avoid;\n }\n \n pre {\n white-space: pre-wrap !important;\n word-wrap: break-word;\n }\n \n body {\n padding-bottom: 1cm;\n padding-left: 1cm;\n padding-right: 1cm;\n padding-top: 0.5cm;\n }\n \n a[href^=\'http\']:after,\n a[href^=\'ftp\']:after {\n content: " (" attr(href) ")";\n font-size: 80%;\n }\n \n a[href$=\'.jpg\']:after,\n a[href$=\'.jpeg\']:after,\n a[href$=\'.gif\']:after,\n a[href$=\'.png\']:after {\n display: none;\n }\n \n abbr[title]:after,\n acronym[title]:after {\n content: " (" attr(title) ")";\n }\n \n .page-break,\n .break-before,\n .page-break-before {\n page-break-before: always;\n }\n \n .break-after,\n .page-break-after {\n page-break-after: always;\n }\n \n .avoid-break-inside {\n page-break-inside: avoid;\n }\n \n .no-print {\n display: none;\n }\n \n a.no-reformat:after {\n content: \'\';\n }\n \n abbr[title].no-reformat:after,\n acronym[title].no-reformat:after {\n content: \'\';\n }\n \n .no-reformat abbr:after,\n .no-reformat acronym:after,\n .no-reformat a:after {\n content: \'\';\n }\n /*Custom CSS*/\n .right {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n margin-right: 0;\n } \n .text {\n margin-top:0in;\n margin-right:0in;\n margin-bottom:3.0pt;\n margin-left:0in;\n line-height:106%;\n font-size:12.5pt;\n } \n .logo-row {\n width: 99%;\n }\n .logo {\n width: 120; \n line-height:110%;\n text-align: center;\n margin-top: 4pt;\n }\n .logo img, .logo svg {\n width: 52;\n height: auto;\n }\n span.logo-text {\n font-size:8.0pt;\n display: block;\n white-space:nowrap;\n line-height: 110%;\n margin-top: 4pt;\n } \n .heading, .heading-row {\n margin-left:12.75pt;\n clear: both;\n }\n .heading {\n font-size:14.5pt;\n line-height:102%;\n }\n .heading-row, .heading-row table { \n font-size: 13.5pt;\n }\n .heading-row {\n margin-top: 14pt;\n }\n .heading table, .heading-row table, .heading-row td {\n border: 0;\n }\n .table-data {\n border: 0;\n border-collapse:collapse;\n margin-left:6.95pt;\n font-size:12.5pt;\n width: 99%;\n page-break-inside: auto;\n }\n .table-data td, .table-data th {\n padding:0 5.75pt 0 5.15pt;\n }\n .table-data td, .table-data th {\n border-top:none;\n border-left:none;\n border-right:solid black 1.0pt;\n vertical-align: middle;\n height: 30pt;\n }\n .table-data th {\n border-bottom:double black 1.5pt;\n } \n .table-data td {\n border-bottom:solid black 1.0pt;\n }\n .table-data th:first-child, .table-data td:first-child {\n border-left:solid black 1.0pt;\n } \n .center {\n text-align: center;\n } \n .left {\n text-align: left;\n }\n .table-data tr.footer-field td {\n height:32pt;\n vertical-align: middle;\n }\n @page { size: auto; margin: 0mm; }\n','\n</style>\n</head>\n<body onload="').concat(n?"window.print()":"","\" style='word-wrap:break-word' ").concat(r?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Hr=function(){var e=Mr((function(){var e,t;return qr(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)}}(),Zr=function(){var e=Mr((function(){var e;return qr(this,(function(t){switch(t.label){case 0:return[4,Hr()];case 1:return e=t.sent(),[2,'\n<div class="logo-row right">\n'.concat(e,"\n</div> \n ")]}}))}));return function(){return e.apply(this,arguments)}}(),Yr=function(e){setTimeout((function(){!function(e){var t=window.open("","Print-Window");t&&(t.document.open(),t.document.write(e),t.document.close())}(e)}),300)};function Qr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Jr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Qr(a,r,o,i,l,"next",e)}function l(e){Qr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Wr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Vr=function(){var e=Jr((function(e){var t,n,r,o,a,i,l,c,s;return Wr(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Goods Received Note</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Delivered To: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>GRN#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Received From: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.source)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(V(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th> \n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Purchase Price</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i,l,c;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(r=e.itemCode)&&void 0!==r?r:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(null!==(a=e.batchNumber)&&void 0!==a?a:"",'</td> \n <td valign="middle" class="center">').concat(V(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(i=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==i?i:""," ").concat(null!==(l=e.quantityRequiredUoM)&&void 0!==l?l:"",'</td>\n <td valign="middle" class="center">').concat(null!==(c=null===(n=e.purchasePrice)||void 0===n?void 0:n.toLocaleString())&&void 0!==c?c:"","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle">&nbsp;</td>\n <td valign="middle">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</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 &nbsp;\n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),Kr=function(){var e=Jr((function(e){var t;return Wr(this,(function(n){switch(n.label){case 0:return[4,Vr(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function Xr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function $r(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Xr(a,r,o,i,l,"next",e)}function l(e){Xr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function eo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var to=function(){var e=$r((function(e){var t,n,r,o,a,i,l,c,s;return eo(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Inventory Transfer</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer From: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>Transfer#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer To: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.destination)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(V(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Unit Cost</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(n=e.itemCode)&&void 0!==n?n:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</td> \n <td valign="middle" class="center">').concat(null!==(o=e.batchNumber)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(V(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle">&nbsp;</td>\n <td valign="middle">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</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 &nbsp;\n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),no=function(){var e=$r((function(e){var t;return eo(this,(function(n){switch(n.label){case 0:return[4,to(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ro(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function oo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ro(a,r,o,i,l,"next",e)}function l(e){ro(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ao(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var io=function(){var e=oo((function(e){var t,n,r,o,a,i,l,c;return ao(this,(function(s){switch(s.label){case 0:return r=Math.max(0,28-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=s.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text">\n <b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Dept/section/ward/dispensary: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(V(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td colspan="4" valign="top" style=\'border:solid black 1.0pt;height:40pt\'>\n <div class=\'text\'><b>Ordered by (Name and signature):</b></div>\n <p class=\'text\' style=\'margin-top: 1pt;\'>').concat(null!==(l=e.orderedBy)&&void 0!==l?l:"&nbsp;","</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:"&nbsp;",'</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">&nbsp;</td>\n <td valign="middle">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</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 &amp; Signature receiver:</td>\n <td valign="middle" colspan="4">Name &amp; Signature issuer:</td>\n </tr>\n </table>\n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),lo=function(){var e=oo((function(e){var t;return ao(this,(function(n){switch(n.label){case 0:return[4,io(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function co(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function so(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=((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){co(a,r,o,i,l,"next",e)}function l(e){co(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,o,a,i,l,c,s;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),n=null,o=null,t.requisitionStockOperationUuid&&(L(t.requisitionStockOperationUuid).then((function(t){t.error||(e=t)})).catch((function(e){e.error})),!e)?[2,null]:((e||"stockissue"===(null==e?void 0:e.operationType)||"transferout"===(null==e?void 0:e.operationType))&&(a={},(null==t?void 0:t.uuid)&&(a.stockOperationUuid=t.uuid),(d=a,m="".concat(r.restBaseUrl,"/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=").concat(d),p=new AbortController,(0,r.openmrsFetch)(m,{method:"GET",headers:{"Content-Type":"application/json"},signal:p.signal})).then((function(e){e.error||(n=null==e?void 0:e.results)})).catch((function(e){e.error}))),(e||"requisition"===(null==e?void 0:e.operationType))&&(i={},null==t||t.uuid,i.locationUuid=t.atLocationUuid,i.stockOperationUuid=t.uuid,i.v=U.Default,i.groupBy="LocationStockItem",i.includeStockItemName="true",i.date=JSON.stringify(null!==(l=null==e?void 0:e.dateCreated)&&void 0!==l?l:null==t?void 0:t.dateCreated),function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(z(e)),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(o=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,Lr(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,Kr(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,no(c)];case 4:return u.sent(),[3,7];case 5:return[4,lo(c)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(c),u.label=9;case 9:return[3,11];case 10:return s=u.sent(),console.info(s),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}());return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(C.FB,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){so(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function mo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const po=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(gt.bS,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){mo(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function Ao(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const go=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(me.aP,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ao(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function fo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){fo(e,t,n[t])}))}return e}const _o=function(e){var t,n,r,o,i=e.operation,c=e.operations,s=(0,E.useTranslation)().t,u={uuid:"",name:"Stock Issue",description:"",operationType:"stockissue",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1},d=(n=(t=i).uuid,r=vo({},t),o=null!=(o={requisitionStockOperationUuid:n})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r);return l().createElement(a.zxk,{onClick:function(){Uo(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(gt.ei,vo({size:16},e))}},s("issueStock","Issue Stock "))};var ho=n(2496),bo={};bo.styleTagTransform=h(),bo.setAttributes=g(),bo.insert=p().bind(null,"head"),bo.domAPI=d(),bo.insertStyleElement=v(),s()(ho.Z,bo);const yo=ho.Z&&ho.Z.locals?ho.Z.locals:void 0;function ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Co(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Eo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Co(a,r,o,i,l,"next",e)}function l(e){Co(a,r,o,i,l,"throw",e)}i(void 0)}))}}function wo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function So(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){wo(e,t,n[t])}))}return e}function Do(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Oo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ko(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ko(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const No=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,G,H,Z,Y,J,W,V,K,X,$,ee,te,ne,re,oe,ae,ie,le,ce,se,ue,de,me,pe,Ae,ge,fe,ve,_e,he,be,ye,ke,Ce,Ee,we,Se,De,Oe=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=Sr((0,i.useState)(!0),2),n=t[0],r=t[1],o=Sr((0,i.useState)(!1),2),a=o[0],l=o[1],c=Sr((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return Er.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),r(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:s}}(e),Be=Te.isLoading,Pe=Te.isError,Ue=Te.result,je=Oo((0,i.useState)(null==e?void 0:e.isEditing),2),ze=je[0],Fe=je[1],Le=Oo((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Oo((0,i.useState)(0),2),Ge=qe[0],He=qe[1];if(Be)return l().createElement(a.MHR,null);if(Pe)return Q(),void(0,r.showSnackbar)({kind:"error",title:Oe("error","Error"),subtitle:Oe("errorLoadingStockOperation","Error loading stock item"),timeoutInMs:5e3,isLowContrast:!0});var Ze=[{name:"".concat(xe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(zn,Do(So({},e),{isEditing:"Stock Issue"===(null==e||null===(o=e.operation)||void 0===o?void 0:o.name)?!xe:xe,setup:Ue,canEdit:"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?!Ne:Ne,model:xe||"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,onSave:Eo((function(){return xo(this,(function(e){return Fe(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(pr,Do(So({},e),{isEditing:xe,setup:Ue,canEdit:Ne,model:xe||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,onSave:Eo((function(){return xo(this,(function(e){return Me(!0),He(2),[2]}))}))})),disabled:!(xe||ze)},{name:(null==Ue?void 0:Ue.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(br,Do(So({},e),{isEditing:xe,setup:Ue,canEdit:Ne,locked:!1,model:xe||"Stock Issue"===(null==e||null===(d=e.operation)||void 0===d?void 0:d.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,requiresDispatchAcknowledgement:xe?"return"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType)||"issuestock"===(null==e||null===(p=e.model)||void 0===p?void 0:p.operationType):Ue.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=Eo((function(t){return xo(this,(function(n){switch(n.label){case 0:return[4,Po(t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){He(1)},onComplete:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||Re)}];return l().createElement(l().Fragment,null,xe||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},xe&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:yo.textHeading},Oe("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(null==e||null===(A=e.model)||void 0===A?void 0:A.status))}},null==e||null===(g=e.model)||void 0===g?void 0:g.status)),l().createElement("div",{className:yo.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(v=e.model)||void 0===v?void 0:v.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(_=e.model)||void 0===_?void 0:_.creatorFamilyName,"  ",null==e||null===(h=e.model)||void 0===h?void 0:h.creatorGivenName))),(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(y=e.model)||void 0===y?void 0:y.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByFamilyName,"  ",null==e||null===(C=e.model)||void 0===C?void 0:C.submittedByGivenName))),(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByFamilyName,"  ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(N=e.model)||void 0===N?void 0:N.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(I=e.model)||void 0===I?void 0:I.returnedByFamilyName,"  ",null==e||null===(T=e.model)||void 0===T?void 0:T.returnedByGivenName),l().createElement("span",{className:yo.text},null==e||null===(B=e.model)||void 0===B?void 0:B.returnReason))),(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(U=e.model)||void 0===U?void 0:U.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(j=e.model)||void 0===j?void 0:j.completedByFamilyName,"  ",null==e||null===(z=e.model)||void 0===z?void 0:z.completedByGivenName))),"CANCELLED"===(null==e||null===(F=e.model)||void 0===F?void 0:F.status)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(L=e.model)||void 0===L?void 0:L.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByFamilyName,"  ",null==e||null===(M=e.model)||void 0===M?void 0:M.cancelledByGivenName,l().createElement("span",{className:yo.text},null==e||null===(G=e.model)||void 0===G?void 0:G.cancelReason)))),"REJECTED"===(null==e||null===(H=e.model)||void 0===H?void 0:H.status)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(Y=e.model)||void 0===Y?void 0:Y.rejectedByFamilyName,"  ",null==e||null===(J=e.model)||void 0===J?void 0:J.rejectedByGivenName,l().createElement("span",null,null==e||null===(W=e.model)||void 0===W?void 0:W.rejectionReason)))))),(!(null==e||null===(K=e.model)||void 0===K||null===(V=K.permission)||void 0===V?void 0:V.canEdit)&&((null==e||null===($=e.model)||void 0===$||null===(X=$.permission)||void 0===X?void 0:X.canApprove)||(null==e||null===(te=e.model)||void 0===te||null===(ee=te.permission)||void 0===ee?void 0:ee.canReceiveItems))||(null==e||null===(re=e.model)||void 0===re||null===(ne=re.permission)||void 0===ne?void 0:ne.canEdit)||Ie||(null==e||null===(ae=e.model)||void 0===ae||null===(oe=ae.permission)||void 0===oe?void 0:oe.isRequisitionAndCanIssueStock))&&l().createElement("div",{style:{margin:"10px",display:"flex",flexDirection:"row"}},l().createElement(l().Fragment,null,!(null==e||null===(le=e.model)||void 0===le||null===(ie=le.permission)||void 0===ie?void 0:ie.canEdit)&&(null==e||null===(se=e.model)||void 0===se||null===(ce=se.permission)||void 0===ce?void 0:ce.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Zt.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Zt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(xr,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Zt.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Zt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(po,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ir,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Br,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ur,{operation:null==e?void 0:e.model}))),!(null==e||null===(ge=e.model)||void 0===ge||null===(Ae=ge.permission)||void 0===Ae?void 0:Ae.canEdit)&&(null==e||null===(ve=e.model)||void 0===ve||null===(fe=ve.permission)||void 0===fe?void 0:fe.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(go,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Br,{operation:null==e?void 0:e.model}))),(null==e||null===(he=e.model)||void 0===he||null===(_e=he.permission)||void 0===_e?void 0:_e.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Ur,{operation:null==e?void 0:e.model})),(null==e||null===(ye=e.model)||void 0===ye||null===(be=ye.permission)||void 0===be?void 0:be.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(_o,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(Ce=e.model)||void 0===Ce||null===(ke=Ce.permission)||void 0===ke?void 0:ke.isRequisitionAndCanIssueStock)||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Zt.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Zt.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Zt.RECEIPT_OPERATION_TYPE||(null==e||null===(De=e.model)||void 0===De?void 0:De.operationType)===Zt.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(uo,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Nn,null,l().createElement(Ht,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Io(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function To(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Io(a,r,o,i,l,"next",e)}function l(e){Io(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Bo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Po=function(){var e=To((function(e,t,n,o,a){var i,l,c,s;return Bo(this,(function(o){switch(o.label){case 0:i=e,o.label=1;case 1:return o.trys.push([1,3,,4]),"requisition"===n.operationType&&delete i.destinationName,n.operationType===Zt.STOCK_ISSUE_OPERATION_TYPE&&(delete i.completedDate,delete i.completedBy,delete i.completedByFamilyName,delete i.completedByGivenName,delete i.operationTypeUuid,delete i.permission,delete i.locked,i.operationTypeUuid="66666666-6666-6666-6666-666666666666"),[4,(t?M:R)(i)];case 2:return(null==(l=o.sent())?void 0:l.data)&&(ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation")),(0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",description:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Q()),[3,4];case 3:return c=o.sent(),s=le(c),(0,r.showNotification)({description:s.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),Uo=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(No,{model:e,onSave:function(e){return Po(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},jo=function(){var e=To((function(e,t,n){var o;return Bo(this,(function(a){return o=(0,r.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return o()}}),[2]}))}));return function(t,n,r){return e.apply(this,arguments)}}();function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Fo=function(e){var t,n,r=e.operationUuid,o=e.operationNumber,c=e.model,s=e.operations,u=(t=(0,i.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return zo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zo(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),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(){Uo(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ro(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Mo(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mo(e,t){if(e){if("string"==typeof e)return Lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}const qo=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Ft(t),c=o.items,s=o.isLoading,u=Ro((0,i.useState)(!1),2),d=u[0],m=u[1],p=Ro((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(Nt.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 Lo(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Mo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m(s));break;case te.OPERATION:jt().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:St.filtersAlign,id:"multiSelect",label:r,size:"md",labelInline:!0,items:A,itemToString:function(e){return e?e.display:"Not Set"},onChange:function(e){var t=e.selectedItems;t&&n(t.map((function(e){return e.display})),r)},placeholder:"Filter by ".concat(r),style:{minWidth:"auto",width:"auto"}})};function Go(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ho(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ho(e,t,n[t])}))}return e}function Yo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Qo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Go(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Go(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Jo=function(){var e,t=(0,E.useTranslation)().t,n=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))},o=(0,i.useMemo)((function(){return{uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1}}),[]),c=Ct({v:U.Full,totalCount:!0}),s=c.items,u=c.tableHeaders,d=c.currentPage,m=c.pageSizes,p=c.totalItems,A=c.goTo,g=c.currentPageSize,f=c.setPageSize,v=c.isLoading,_=Qo((0,i.useState)(s),2),h=_[0],b=_[1],y=Qo((0,i.useState)(null),2),k=y[0],C=y[1],w=Qo((0,i.useState)(null),2),S=w[0],D=w[1],O=Qo((0,i.useState)([]),2),x=O[0],N=O[1],I=Qo((0,i.useState)([]),2),T=I[0],B=I[1],P=Qo((0,i.useState)([]),2),j=P[0],z=P[1],F=(0,r.useConfig)(),L=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}});ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))};(0,i.useEffect)((function(){M()}),[k,S,x,T,j,d,g,s]);var R=(0,i.useCallback)((function(e,t){t===te.SOURCES?N(e):t===te.OPERATION?z(e):B(e)}),[]),M=function(){var e=s;x.length>0&&(e=e.filter((function(e){return x.includes(e.sourceName)}))),j.length>0&&(e=e.filter((function(e){return j.includes(e.operationTypeName)}))),T.length>0&&(e=e.filter((function(e){return T.includes(e.status)}))),k&&S?e=e.filter((function(e){var t=new Date(e.operationDate);return t>=k&&t<=S})):k?e=e.filter((function(e){return new Date(e.operationDate)>=k})):S&&(e=e.filter((function(e){return new Date(e.operationDate)<=S}))),b(e)},q=(0,i.useMemo)((function(){return null==h?void 0:h.map((function(n,r){var i,c,s,u,d,m,p,A,g,f,v,_,b,y,k,C,E,w,S;return Yo(Zo({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),operationTypeName:"".concat(null==n?void 0:n.operationTypeName),operationNumber:l().createElement(Fo,{model:h[r],operations:e}),status:"".concat(null==n?void 0:n.status),source:"".concat(null!==(i=null==n?void 0:n.sourceName)&&void 0!==i?i:""),destination:"".concat(null!==(c=null==n?void 0:n.destinationName)&&void 0!==c?c:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==n?void 0:n.sourceName)&&void 0!==s?s:""," ",(null==n?void 0:n.sourceName)&&(null==n?void 0:n.destinationName)?l().createElement(me.ol,{size:16}):""," ",null!==(u=null==n?void 0:n.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==n?void 0:n.responsiblePersonFamilyName)&&void 0!==d?d:null==n?void 0:n.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:V(null==n?void 0:n.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("created","Created")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.dateCreated))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(A=n.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=n.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==n?void 0:n.status)&&(null==n?void 0:n.status)!==Dt&&(null==n?void 0:n.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("submitted","Submitted")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.submittedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(f=n.submittedByFamilyName)&&void 0!==f?f:""," ",null!==(v=n.submittedByGivenName)&&void 0!==v?v:""))),(null==n?void 0:n.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("completed","Completed")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(_=n.completedByFamilyName)&&void 0!==_?_:""," ",null!==(b=n.completedByGivenName)&&void 0!==b?b:""))),(null==n?void 0:n.status)===Ot&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("cancelled","Cancelled")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.cancelledDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(y=n.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=n.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,n.cancelReason))),(null==n?void 0:n.status)===xt&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Rejected"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.rejectedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(C=n.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=n.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,n.rejectionReason))),(null==n?void 0:n.status)===Dt&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Returned"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=n.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=n.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,n.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:L}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){Uo(h[r],!0,o,e,!1)}}))})}))}),[L,h,o,e,s]);return v?l().createElement(a.gqd,{className:St.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:St.tableOverride},l().createElement(a.x45,null,t("Stock operations to track movement of stock.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:q,headers:u,isSortable:!0,useZebraStyles:!0,render:function(o){var i=o.rows,c=o.headers,u=o.getHeaderProps,d=o.getTableProps,m=o.getRowProps,p=o.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:St.toolbarContent},l().createElement(a.Ys1,{className:St.patientListSearch,expanded:!0,onChange:p,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:St.filterContainer},l().createElement(a.Mtg,{className:St.dateAlign,datePickerType:"range",dateFormat:X,value:[k,S],onChange:function(e){var t=Qo(e,2);!function(e){var t=Qo(e,2),n=t[0],r=t[1];n&&(C(n),S&&n&&S<n&&D(n)),r&&(D(r),k&&r&&k>r&&C(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:K}),l().createElement(a.aj6,{placeholder:K})),l().createElement(qo,{conceptUuid:F.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:R}),l().createElement(qo,{filterName:te.STATUS,onFilterChange:R}),l().createElement(qo,{filterName:te.OPERATION,onFilterChange:R})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Rt,{onOperationTypeSelected:function(t){Uo(_n(),!1,t,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),c.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Yo(Zo({},u({header:e,isSortable:e.isSortable})),{className:r.isDesktop?St.desktopHeader:St.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,i.map((function(e,n){var o,i,u,d,p,A,g,f,v,_,b,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Zo({className:r.isDesktop?St.desktopRow:St.tabletRow},m({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))),l().createElement(a.WdL,{colSpan:c.length+2},l().createElement(l().Fragment,null,l().createElement(a.SmK,null,l().createElement(a.s1N,{head:!0},l().createElement(a.agF,{head:!0},t("dateCreated","Date Created")),l().createElement(a.agF,{head:!0},t("dateCompleted","Date Completed")),l().createElement(a.agF,{head:!0},t("batchNumber","Batch Number")),l().createElement(a.agF,{head:!0},"Qty"))),l().createElement(a.FxI,null,l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(o=h[n])||void 0===o?void 0:o.dateCreated)?V(null===(i=h[n])||void 0===i?void 0:i.dateCreated):""," ",(null===(u=h[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(d=h[n])||void 0===d?void 0:d.dateCreated)?null===(p=h[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=h[n])||void 0===A?void 0:A.completedDate)?V(null===(g=h[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=h[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=h[n])||void 0===v?void 0:v.completedDate)?null===(_=h[n])||void 0===_?void 0:_.creatorFamilyName:""),l().createElement(a.agF,null,(null===(b=h[n])||void 0===b?void 0:b.stockOperationItems)?null===(y=h[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=h[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=h[n].stockOperationItems)||void 0===C?void 0:C.map((function(e){return e.quantity}))[0]:"")),l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(E=h[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(w=h[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=h[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(D=h[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=h[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=h[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(N=h[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=h[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=h[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=h[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=h[n])||void 0===P?void 0:P.completedDate)?null===(U=s[n])||void 0===U?void 0:U.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=h[n])||void 0===j?void 0:j.stockOperationItems)?null===(z=h[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=h[n])||void 0===F?void 0:F.stockOperationItems)?null===(L=h[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===i.length?l().createElement("div",{className:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("div",{className:St.tileContent},l().createElement("p",{className:St.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:St.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:g,pageSizes:m,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==g&&f(t),n!==d&&A(n)},className:St.paginationOverride}))};var Wo={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function Vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ko(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xo(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const $o=function(e){var t,n,o,c,s=Ko((0,i.useState)(""),2),u=s[0],d=s[1],m=(0,E.useTranslation)().t,p=(t=u,o={v:U.Default,q:t,limit:20},c=function(e){var t="".concat(r.restBaseUrl,"/drug").concat(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||o),{drugList:c.items.results,isLoading:c.isLoading}),A=p.isLoading,g=p.drugList,f=Ko((0,i.useState)(!1),2),v=f[0],_=f[1];return l().createElement("div",null,l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:g||[],initialSelectedItem:null!==(n=null==g?void 0:g.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:Xo,onChange:function(t){var n,o,a,l,c;_(!1),null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),i(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid),(null==t||null===(a=t.selectedItem)||void 0===a?void 0:a.uuid)&&((c=null==t||null===(l=t.selectedItem)||void 0===l?void 0:l.uuid)&&function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem?drugUuid=").concat(e,"&limit=1");return(0,r.openmrsFetch)(t).then((function(e){return e.data}))}(c).then((function(e){var t,n,r=0!==(null!==(n=null==e||null===(t=e.results)||void 0===t?void 0:t.length)&&void 0!==n?n:0);_(r)})))},onInputChange:function(e){d(e)},inputValue:u,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),A&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}),v&&l().createElement("div",{style:{color:"#da1e28"}},m("itemAlreadyExists","Item already exits")))};var ea=ln.z.string().max(255).nullish(),ta=ln.z.object({isDrug:ln.z.boolean(),drugUuid:ln.z.string().nullish(),drugName:ln.z.string().nullish(),commonName:ea,acronym:ea,hasExpiration:ln.z.boolean(),expiryNotice:ln.z.coerce.number().nullish(),uuid:ln.z.string().nullish(),conceptUuid:ln.z.string().nullish(),conceptName:ln.z.string().nullish(),preferredVendorUuid:ln.z.string().nullish(),preferredVendorName:ln.z.string().nullish(),purchasePrice:ln.z.number().nullish(),purchasePriceUoMUuid:ln.z.string().nullish(),purchasePriceUoMName:ln.z.string().nullish(),categoryUuid:ln.z.string().nullish(),categoryName:ln.z.string().nullish(),dispensingUnitUuid:ln.z.string().nullish(),dispensingUnitName:ln.z.string().nullish(),dispensingUnitPackagingUoMUuid:ln.z.string().nullish(),dispensingUnitPackagingUoMName:ln.z.string().nullish(),defaultStockOperationsUoMUuid:ln.z.string().nullish(),defaultStockOperationsUoMName:ln.z.string().nullish(),reorderLevel:ln.z.number().nullish(),reorderLevelUoMUuid:ln.z.string().nullish(),reorderLevelUoMName:ln.z.string().nullish(),dateCreated:ln.z.coerce.date().nullish(),creatorGivenName:ln.z.string().nullish(),creatorFamilyName:ln.z.string().nullish(),voided:ln.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ra=function(e){return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.SYO,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){na(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t,n,r){i(t,n,r),e.onChange&&e.onChange(t,n,r)},id:e.name,ref:s,defaultSelected:e.id,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),e.options.map((function(t,n){return l().createElement(a.EUY,{key:"".concat(n,"-").concat(e.name,"-").concat(t.value),id:"".concat(e.name,"-").concat(t.value),labelText:t.label,value:t.value,checked:c===t.value,onChange:function(){return i(t.value)},ref:s})})))}})},oa=function(e){return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.Y2U,{label:e.label,id:"".concat(e.name,"-").concat(e.id,"-").concat(null===(n=e.row)||void 0===n?void 0:n.uuid),value:null!==(o=null===(r=e.row)||void 0===r?void 0:r.factor)&&void 0!==o?o:s,min:e.min,hideSteppers:e.hideSteppers||!1,ref:u,onChange:function(t,n){c(t,n),e.onChange&&e.onChange(t,n)}})}})},aa=function(e){var t=Ft((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n;null===(n=e.onDispensingUnitChange)||void 0===n||n.call(e,t.selectedItem),c(t.selectedItem.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.dispensingUnitUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.display)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})};function ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function la(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ia(e,t,n[t])}))}return e}function ca(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(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}}const sa=function(e){var t=ca({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.preferredVendorUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},ua=function(e){var t=(0,E.useTranslation)().t,n=Ft((0,r.useConfig)().stockItemCategoryUUID),o=n.items.answers,i=n.isLoading,c=e.itemType?null==o?void 0:o.filter((function(t){return t.display===(null==e?void 0:e.itemType)})):o;return i?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(n){var r,i,s=n.field,u=s.onChange,d=s.value,m=s.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:c||[],onChange:function(t){var n,r;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),u(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==o?void 0:o.find((function(t){return t.uuid===e.categoryUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(t(null==e?void 0:e.display)):""},shouldFilterItem:function(){return!0},value:null!==(i=t(null==o||null===(r=o.find((function(e){return e.uuid===d})))||void 0===r?void 0:r.display))&&void 0!==i?i:"",placeholder:e.placeholder,ref:m,invalid:e.invalid,invalidText:e.invalidText})}})},da=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits.find((function(t){return(null==t?void 0:t.uuid)===(null==e?void 0:e.dispensingUnitPackagingUoMUuid)})):null}),[null==e?void 0:e.packagingUnits]);return e.isLoading?l().createElement(a.xNL,null):(null==e?void 0:e.packagingUnits)&&(null==e?void 0:e.packagingUnits.length)>0?l().createElement("div",null,l().createElement(on.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=null==n?void 0:n.uuid)&&void 0!==t?t:"",render:function(t){var r,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(r=e.packagingUnits)&&void 0!==r?r:[],onChange:function(t){var n,r;null===(n=e.onDispensingUnitPackagingUoMUuidChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),i(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:n,itemToString:function(e){return(null==e?void 0:e.packagingUomName)?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):"Not set"},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}})):l().createElement(l().Fragment,null)},ma=function(e){var t,n,r,o,i,c,s,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=he(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),v?l().createElement(a.iJ5,null):l().createElement(oa,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(s=f.reorderLevel)&&void 0!==s?s:"",invalidText:p.reorderLevel&&(null==p||null===(r=p.reorderLevel)||void 0===r?void 0:r.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(o=p.reorderLevelUoMUuid)||void 0===o?void 0:o.message)}),v?l().createElement(a.iJ5,null):l().createElement(oa,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price:"),value:null!==(u=f.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(c=p.purchasePriceUoMUuid)||void 0===c?void 0:c.message)})):l().createElement(l().Fragment,null)};function pa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Aa=function(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/concept").concat(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 pa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pa(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return s?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p,onChange:function(t){var n;null===(n=e.onConceptUuidChange)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},initialSelectedItem:(null==c?void 0:c.find((function(t){return t.uuid===e.conceptUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};var ga=[{label:"Pharmaceuticals",value:!0},{label:"Non Pharmaceuticals",value:!1}],fa=[{label:"Yes",value:!0},{label:"No",value:!1}];function va(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _a(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ha(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return va(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?va(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ba=(0,i.forwardRef)((function(e){var t,n,o,c,s,u,d,m,p,A,g,f=e.model,v=e.onSave,_=e.isEditing,h=e.handleTabChange,b=(0,E.useTranslation)().t,y=(0,on.cI)({defaultValues:f,mode:"all",resolver:(0,an.F)(ta)}),k=y.handleSubmit,C=y.control,w=y.formState,S=w.errors,D=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){_a(a,r,o,i,l,"next",e)}function l(e){_a(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,3,4]),N(!0),e.uuid=f.uuid,[4,v(e)];case 1:return t.sent(),h(1),ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),[3,4];case 2:return t.sent(),[3,4];case 3:return N(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),O=ha((0,i.useState)(!1),2),x=O[0],N=O[1],T=ha((0,i.useState)(!1),2),B=T[0],P=T[1],U=ha((0,i.useState)(""),2),j=U[0],z=U[1],F=ha((0,i.useState)(!1),2),L=F[0],R=F[1];return(0,i.useEffect)((function(){var e,t;P(null!==(e=f.isDrug)&&void 0!==e&&e),z(!0===f.isDrug?"Pharmaceuticals":!1===f.isDrug?"Non Pharmaceuticals":void 0),R(null!==(t=f.hasExpiration)&&void 0!==t&&t)}),[f.hasExpiration,f.isDrug]),l().createElement("form",{className:"".concat(I.formContainer," ").concat(I.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(ra,{control:C,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!S.isDrug,invalidText:S.isDrug&&(null==S||null===(t=S.isDrug)||void 0===t?void 0:t.message),onChange:function(e){var t=ga.find((function(t){return t.value===e})),n=t?t.label:"";P(e),z(n)},options:ga})),B&&l().createElement($o,{name:"drugUuid",controllerName:"drugUuid",control:C,title:b("pleaseSpecify","Please specify:"),placeholder:"Choose a drug",invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(n=S.drugUuid)||void 0===n?void 0:n.message)}),null!=B&&!B&&l().createElement(Aa,{name:"conceptUuid",controllerName:"conceptUuid",control:C,title:b("pleaseSpecify","Please specify")+":",placeholder:b("chooseAnItem","Choose an item"),invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(o=S.drugUuid)||void 0===o?void 0:o.message)}),l().createElement(Cn,{id:"commonName",name:"commonName",control:C,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(g=null==f?void 0:f.commonName)&&void 0!==g?g:""),labelText:b("commonName","Common name")+":",invalid:!!S.commonName,invalidText:S.commonName&&(null==S||null===(c=S.commonName)||void 0===c?void 0:c.message)}),l().createElement(Cn,{id:"acronym",maxLength:255,name:"acronym",control:C,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation")+":",invalid:!!S.acronym,invalidText:S.acronym&&(null==S||null===(s=S.acronym)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(ra,{name:"hasExpiration",controllerName:"hasExpiration",control:C,legendText:"",invalid:!!S.hasExpiration,invalidText:S.hasExpiration&&(null==S||null===(u=S.hasExpiration)||void 0===u?void 0:u.message),onChange:function(e){R(e)},options:fa})),L&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(oa,{id:"expiryNotice",name:"expiryNotice",control:C,controllerName:"expiryNotice",min:0,size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!S.expiryNotice,invalidText:S.expiryNotice&&(null==S||null===(d=S.expiryNotice)||void 0===d?void 0:d.message)}))),l().createElement(sa,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:C,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!S.preferredVendorUuid,invalidText:S.preferredVendorUuid&&(null==S||null===(m=S.preferredVendorUuid)||void 0===m?void 0:m.message)}),l().createElement(ua,{name:"categoryUuid",controllerName:"categoryUuid",control:C,itemType:"Pharmaceuticals"===j?"Drugs":"Non Pharmaceuticals"===j?"Non Drugs":void 0,title:b("category:","Category")+":",placeholder:b("chooseACategory","Choose a category"),invalid:!!S.categoryUuid,invalidText:S.categoryUuid&&(null==S||null===(p=S.categoryUuid)||void 0===p?void 0:p.message)}),B&&l().createElement(aa,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:C,title:b("dispensingUnit","Dispensing Unit")+":",placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!S.dispensingUnitUuid,invalidText:S.dispensingUnitUuid&&(null==S||null===(A=S.dispensingUnitUuid)||void 0===A?void 0:A.message)}),B&&_&&l().createElement(ma,{control:C,formState:w,stockItemUuid:f.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:k(D),kind:"primary",renderIcon:Ar.vc},x?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},b("cancel","Cancel"))))}));const ya=ba;function ka(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ca(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(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 ka(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ka(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,i.useMemo)((function(){return[{key:"location",header:"Location"},{key:"name",header:"Name"},{key:"quantity",header:"Quantity Threshold"},{key:"evaluationFrequency",header:"Frequency Check"},{key:"actionFrequency",header:"Notification Frequency"},{key:"alertRole",header:"Alert Role"},{key:"mailRole",header:"Mail Role"},{key:"enabled",header:"Enabled?"},{header:"actions",key:"actions"}]}),[]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:f}}var Ea=n(4563),wa={};wa.styleTagTransform=h(),wa.setAttributes=g(),wa.insert=p().bind(null,"head"),wa.domAPI=d(),wa.insertStyleElement=v(),s()(Ea.Z,wa);const Sa=Ea.Z&&Ea.Z.locals?Ea.Z.locals:void 0;function Da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Da(e,t,n[t])}))}return e}function xa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Na(e,t,n[t])}))}return e}function Ta(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 Ba(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xa(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Pa=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t,u=Ba((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=_e(d).items,A=Bt().stockLocations,g=Pt({v:U.Default}),f=g.items,v=(g.isError,g.isLoading,Ba((0,i.useState)(Ia({enabled:!0},o)),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=Ia({},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="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(t?"/"+e.uuid:""),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:Oa({},e)})}(_).then((function(){(0,r.showToast)({critical:!0,title:s("addedRule","Add Rule"),kind:"success",description:s("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[_,o,s,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:b},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:Sa.section},l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==_?void 0:_.locationUuid)?_.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.id===e.target.value}));h(Ta(Ia({},_),{locationUuid:t.id}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"name",type:"text",labelText:s("name","Rule Name"),size:"md",onChange:function(e){o&&(o.name=e.target.value),h(Ta(Ia({},_),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==_?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(Ta(Ia({},_),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:s("quantity","Quantity Threshold"),size:"md",onChange:function(e){o&&(o.quantity=Number(e.target.value)),h(Ta(Ia({},_),{quantity:Number(e.target.value)}))},value:null==o?void 0:o.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==_?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(Ta(Ia({},_),{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:Sa.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(Ta(Ia({},_),{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:Sa.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:s("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){o&&(o.evaluationFrequency=Number(e.target.value)),h(Ta(Ia({},_),{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(Ta(Ia({},_),{actionFrequency:Number(e.target.value)}))},value:null==o?void 0:o.actionFrequency,placeholder:"e.g 3600 Minutes"}))),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Sa.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enabled);h(Ta(Ia({},_),{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:Sa.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enableDescendants);h(Ta(Ia({},_),{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")))))},Ua=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Pa,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var ja=n(4907),za={};za.styleTagTransform=h(),za.setAttributes=g(),za.insert=p().bind(null,"head"),za.domAPI=d(),za.insertStyleElement=v(),s()(ja.Z,za);const Fa=ja.Z&&ja.Z.locals?ja.Z.locals:void 0;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=e.stockItemUuid,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}({v:U.Default,totalCount:!0,stockItemUuid:n}),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:Fa.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return La(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 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)||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 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,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,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 Ma(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ma(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t,n,a;(t=o,n="".concat(r.restBaseUrl,"/stockmanagement/stockrule/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){d(!1),(0,r.showToast)({critical:!0,title:c("deletingRule","Delete Rule"),kind:"success",description:c("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingRule', 'error deleting a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteRule","Delete Rule"),renderIcon:function(e){return l().createElement(pe.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){qa(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Za=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Pa,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(vt.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){Ha(e,t,n[t])}))}return e}({size:16},e))}})};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}const Wa=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t),o=Ca({v:U.Default,totalCount:!0,stockItemUuid:t}),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.currentPage,m=o.currentPageSize,p=o.pageSizes,A=o.totalItems,g=o.setPageSize,f=o.goTo,v=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e,t){var n,r;return Ja(Qa({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated:V(null==e?void 0:e.dateCreated),location:null==e?void 0:e.locationName,quantity:"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(r=null==e?void 0:e.packagingUomName)&&void 0!==r?r:""),name:"".concat(null==e?void 0:e.name),description:"".concat(null==e?void 0:e.description),evaluationFrequency:"".concat(null==e?void 0:e.evaluationFrequency," minutes"),actionFrequency:"".concat(null==e?void 0:e.actionFrequency," minutes"),lastActionDate:V(null==e?void 0:e.lastActionDate),nextActionDate:V(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Za,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Ga,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:St.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:St.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Ra,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(Ua,{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,Ja(Qa({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?St.desktopHeader:St.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,Qa({className:r.isDesktop?St.desktopRow:St.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:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("div",{className:St.tileContent},l().createElement("p",{className:St.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:St.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:St.paginationOverride}))};function Va(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ka(e){return function(e){if(Array.isArray(e))return Va(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 Va(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Va(e,t):void 0}}(e)||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 Xa=function(e){var t=Ft((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i,c,s,u,d,m,p,A=t.field.onChange;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:"".concat(e.name,"-").concat(e.row.id,"-").concat(e.row.uuid),size:"md",items:void 0!==(null===(r=e.row)||void 0===r?void 0:r.packagingUomUuid)?Ka(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(Ka(null!=n?n:[])):n||[],onChange:function(t){var n,r;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),A((null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)||"")},initialSelectedItem:void 0!==(null===(c=e.row)||void 0===c?void 0:c.packagingUomUuid)?{uuid:null===(s=e.row)||void 0===s?void 0:s.packagingUomUuid,display:null===(u=e.row)||void 0===u?void 0:u.packagingUomName}:null,selectedItem:void 0!==(null===(d=e.row)||void 0===d?void 0:d.packagingUomUuid)?{uuid:null===(m=e.row)||void 0===m?void 0:m.packagingUomUuid,display:null===(p=e.row)||void 0===p?void 0:p.packagingUomName}:null,itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText})}})};var $a=ln.z.object({id:ln.z.string().nullish(),uuid:ln.z.string().nullish(),stockItemUuid:ln.z.string().nullish(),packagingUomName:ln.z.string().nullish(),packagingUomUuid:ln.z.string().nullish(),factor:ln.z.coerce.number().nullish(),isDefaultStockOperationsUoM:ln.z.boolean().nullish(),isDispensingUnit:ln.z.boolean().nullish()});function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ti(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ni(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ti(e,t,n[t])}))}return e}function ri(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 oi(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)||ii(e,t)||function(){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 ai(e){return function(e){if(Array.isArray(e))return ei(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ii(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 ii(e,t){if(e){if("string"==typeof e)return ei(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ei(e,t):void 0}}const li=function(e){var t=e.stockItemUuid,n=e.handleTabChange,o=Ee(),c=o.items,s=o.isLoading,u=o.setStockItemUuid,d=o.mutate,m=oi((0,i.useState)(c),2),p=m[0],A=m[1],g=oi((0,i.useState)({packagingUomUuid:void 0,factor:0,packagingUomName:""}),2),f=g[0],v=g[1];(0,i.useEffect)((function(){u(t)}),[t,u]),(0,i.useEffect)((function(){A(c)}),[c]);var _=(0,E.useTranslation)().t,h=(0,i.useMemo)((function(){return[{key:"packaging",header:_("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:_("packSize","Pack Size"),styles:{width:"50%"}},{key:"action",header:_("action","Actions"),styles:{width:"50%"}}]}),[_]),b=(0,on.cI)({defaultValues:{},mode:"all",resolver:(0,an.F)($a)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(on.RV,b,l().createElement(a.wQF,{rows:ai(c).concat([{}]),headers:h,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:De.packagingTableContainer},l().createElement(a.iA_,ri(ni({},r()),{className:De.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,ri(ni({},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:De.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(ci,{row:e,id:"".concat(t,"-").concat(null==e?void 0:e.uuid),onChange:function(t){return function(e,t){var n="number"==typeof t?t:parseFloat(t);A((function(t){return t.map((function(t){return t.uuid===e.uuid?ri(ni({},t),{factor:n}):t}))}))}(e,t)}})})),l().createElement(ci,{row:f||{},id:"new-package-unit",isEditing:!0,onChangePackageUnit:function(e){return t=e,void v(ri(ni({},f),{packagingUomUuid:t.uuid,packagingUomName:t.display}));var t},onChange:function(e){return function(e){v(ri(ni({},f),{factor:Number(e)}))}(e)}}))))}}),l().createElement("div",{className:De.packageUnitsBtn},l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=b.reset,o=f?{factor:f.factor,packagingUomUuid:f.packagingUomUuid,stockItemUuid:t}:null,a=p.filter((function(e){var t=c.find((function(t){return t.uuid===e.uuid}));return t&&t.factor!==e.factor})),i=o.packagingUomUuid?function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}(o).then((function(){(0,r.showSnackbar)({title:_("savePackingUnitTitle","Package Unit"),subtitle:_("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"}),v({factor:0,packagingUomUuid:void 0,packagingUomName:""})}),(function(){(0,r.showSnackbar)({title:_("savePackagingUnitErrorTitle","Package Unit"),subtitle:_("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})):Promise.resolve({status:"no-create"}),l=a.map((function(e){return function(e,t){var n="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:e})}(e,e.uuid).then((function(){(0,r.showSnackbar)({title:_("updatePackingUnitTitle","Package Unit"),subtitle:_("updatePackingUnitMessage","Package Unit {{ name }} updated successfully",{name:e.packagingUomName}),kind:"success"})}),(function(){(0,r.showSnackbar)({title:_("updatePackagingUnitErrorTitle","Package Unit"),subtitle:_("updatePackagingUnitErrorMessage","Error updating package unit {{name}}",{name:e.packagingUomName}),kind:"error"})}))}));Promise.all([i].concat(ai(l))).then((function(){d(),e(),n(0)}))},kind:"primary",renderIcon:Ar.vc},_("save","Save"))))};var ci=function(e){var t=e.isEditing,n=e.row,r=e.id,o=e.onChange,i=e.onChangePackageUnit,c=(0,on.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(l().Fragment,null,l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(Xa,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",placeholder:"Filter",control:s,onPackageUnitChange:function(e){return i(e)},invalid:!!u.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement(oa,{row:n,controllerName:"factor",name:"factor",min:0,control:s,id:r,invalid:!!u.factor,hideSteppers:!0,onChange:function(e,t){return o(t.value)}})),l().createElement(a.pj1,null,l().createElement(Ae,{closeModal:function(){return!0},row:n}))))};function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ui(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 si(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(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 di=n(3162),mi=n(4655),pi={};pi.styleTagTransform=h(),pi.setAttributes=g(),pi.insert=p().bind(null,"head"),pi.domAPI=d(),pi.insertStyleElement=v(),s()(mi.Z,pi);const Ai=mi.Z&&mi.Z.locals?mi.Z.locals:void 0;function gi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vi(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)||_i(e,t)||function(){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){if(e){if("string"==typeof e)return gi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gi(e,t):void 0}}const hi=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=vi((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=vi((0,i.useState)(n),1)[0],h=[10,20,30,40,50],b=vi((0,i.useState)(10),2),y=b[0],k=b[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,D=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){fi(e,t,n[t])}))}return e}({},t),o=null!=(o={id:n++})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r));var r,o})),f(e)}),[S,g]);var O=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,di.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,di.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 gi(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||_i(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:Ai.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Ai.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:vt.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:Ai.itemListSearch,expanded:!0,onChange:u,placeholder:m("searchThisList","Search this list"),size:"sm"})))),l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){return l().createElement(a.xDH,r({header:e}),e.header)})))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(a.SCH,{key:e.id},e.cells.map((function(e){return l().createElement(a.pj1,{key:e.id},e.value)})))})))),0===t.length?l().createElement("div",{className:Ai.tileContainer},l().createElement(a.n9L,{className:Ai.tile},l().createElement("div",{className:Ai.tileContent},l().createElement("p",{className:Ai.content},m("No data","No data to display")),l().createElement("p",{className:Ai.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:D,pageSize:y,pageSizes:h,totalItems:c||(null==_?void 0:_.length),className:Ai.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==D){if(s)return void s(n);w(n)}}})))})))},bi=function(e){var t=(0,E.useTranslation)().t,n=Bt().stockLocations;return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ki(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ci(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ki(e,t,n[t])}))}return e}function Ei(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 wi(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 yi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yi(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 Si=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=wi((0,i.useState)(),2),c=o[0],s=o[1],u=function(e){var t=ui((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||U.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0}),2),n=t[0],o=t[1],a=ui((0,i.useState)(10),2),l=a[0],c=a[1],s=ui((0,i.useState)(null),2),u=s[0],d=s[1],m=ui((0,i.useState)(1),2),p=m[0],A=m[1],g=ui((0,i.useState)(null==e?void 0:e.stockItemUuid),2),f=g[0],v=g[1],_=ui((0,i.useState)(null==e?void 0:e.partyUuid),2),h=_[0],b=_[1],y=ui((0,i.useState)(null==e?void 0:e.locationUuid),2),k=y[0],C=y[1],E=ui((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),w=E[0],S=E[1];(0,i.useEffect)((function(){o({startIndex:p-1,v:U.Default,limit:l,q:u,totalCount:!0,stockItemUuid:f,partyUuid:h,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,h,k,w]);var D=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemtransaction").concat(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),O=D.items,x=D.isLoading,N=D.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:b,setStockBatchUuid:S}}(c),d=u.isLoading,m=u.items,p=u.tableHeaders,A=u.totalCount,g=u.setCurrentPage,f=u.setStockItemUuid,v=u.setLocationUuid,_=wi((0,i.useState)(null),2),h=(_[0],_[1],wi((0,i.useState)(null),2));h[0],h[1],(0,i.useEffect)((function(){f(t)}),[t,f]);var b,y=(0,on.cI)({}).control,k=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e){var t,n,r,o,a,i,c;return Ei(Ci({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),date:V(null==e?void 0:e.dateCreated),location:e.operationSourcePartyName&&e.operationDestinationPartyName?e.operationSourcePartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationSourcePartyName),l().createElement(me.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(me.Xd,{size:16})," ",e.operationSourcePartyName)):null==e?void 0:e.partyName:null==e?void 0:e.partyName,transaction:(null==e?void 0:e.isPatientTransaction)?"Patient Dispense":e.stockOperationTypeName,quantity:"".concat(null==e||null===(t=e.quantity)||void 0===t?void 0:t.toLocaleString()," ").concat(null!==(o=null==e?void 0:e.packagingUomName)&&void 0!==o?o:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(V(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(Fo,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:b}):l().createElement(l().Fragment,null),status:null!==(a=null==e?void 0:e.stockOperationStatus)&&void 0!==a?a:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(i=null==e?void 0:e.packagingUomName)&&void 0!==i?i:""," of ").concat(e.packagingUomFactor):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(r=-1*(null==e?void 0:e.quantity))||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""," of ").concat(e.packagingUomFactor):""})}))}),[m,b]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(hi,{children:function(){return l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement(bi,{onLocationIdChange:function(e){v(e),s(Ei(Ci({},c),{locationUuid:e}))},name:"TransactionLocationUuid",placeholder:n("filterByLocation","Filter by Location"),control:y,controllerName:"TransactionLocationUuid"}))},columns:p,data:k,totalItems:A,goToPage:g,hasToolbar:!0})},Di=function(e){var t=(0,E.useTranslation)().t,n=Bt().stockLocations;return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function Oi(e,t){(null==t||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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ni(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){xi(e,t,n[t])}))}return e}function Ii(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 Ti=function(e){var t,n,r=e.stockItemUuid,o=(t=(0,i.useState)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Oi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=$n(c),d=u.isLoading,m=u.items,p=u.totalCount,A=u.setCurrentPage,g=u.setStockItemUuid,f=u.setLocationUuid,v=(0,E.useTranslation)().t,_=(0,on.cI)({}).control;(0,i.useEffect)((function(){g(r)}),[r,g]);var h=(0,i.useMemo)((function(){return[{key:"location",header:v("location","Location")},{key:"batch",header:v("batchNumber","Batch Number")},{key:"quantity",header:v("quantity","Quantity")},{key:"packaging",header:v("packagingUnit","Packaging Unit")},{key:"expires",header:v("expires","Expires")}]}),[v]),b=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n,r,o,a,i;return Ii(Ni({},e),{id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:V(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})}))}),[m]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(hi,{children:function(){return l().createElement(l().Fragment,null,l().createElement(Di,{control:_,onLocationIdChange:function(e){f(e),s(Ii(Ni({},c),{locationUuid:e}))},placeholder:v("filterByLocation","Filter by Location"),name:"BatchLocationUuid",controllerName:"BatchLocationUuid"}))},columns:h,data:b,totalItems:p,goToPage:A,hasToolbar:!0})};function Bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Pi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bi(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 Ui(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ji=function(e){var t=e.stockItemUuid,n=function(e){var t=Pi((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Pi((0,i.useState)(10),2),a=o[0],l=o[1],c=Pi((0,i.useState)(null),2),s=c[0],u=c[1],d=Pi((0,i.useState)(1),2),m=d[0],p=d[1],A=Pi((0,i.useState)(),2),g=A[0],f=A[1],v=Pi((0,i.useState)(),2),_=v[0],h=v[1],b=Pi((0,i.useState)(),2),y=b[0],k=b[1],C=Pi((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,D=fe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}(U.Default),r=n.isLoading,o=n.items,c=n.totalCount,s=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l,c;return l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ui(e,t,n[t])}))}return e}({},e),c=null!=(c={id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:V(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(c,e))})),l}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(hi,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1})};var zi=n(501),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,Ri=function(e){var t=ca({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onSourceChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.uuid)})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid})}})};function Mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qi(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 Mi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mi(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 Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(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}function Zi(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 Yi=function(e){e.isEditing;var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=function(e){var t=qi((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=qi((0,i.useState)(),2),l=a[0],c=a[1];(0,i.useEffect)((function(){o({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:l})}),[l]);var s=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),u=s.items,d=s.isLoading,m=s.isError;return{items:u.results,totalCount:u.totalCount,isLoading:d,isError:m,setStockItemUuid:c}}(),c=o.items,s=o.isLoading,u=o.setStockItemUuid;(0,i.useEffect)((function(){u(t)}),[t,u]);var d=(0,i.useMemo)((function(){return[{key:"source",header:n("source","Source"),styles:{width:"50%"}},{key:"code",header:n("code","Code"),styles:{width:"50%"}},{key:"action",header:n("action","Actions"),styles:{width:"50%"}}]}),[n]),m=(0,on.cI)({defaultValues:{},mode:"all",resolver:(0,an.F)(ta)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(on.RV,m,l().createElement(a.wQF,{rows:null!=c?c:[],headers:d,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:Li.referencesTableContainer},l().createElement(a.iA_,Zi(Hi({},r()),{className:Li.referencesTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,Zi(Hi({},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:Li.referencesTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(Qi,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(Qi,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=(0,m.getValues)(),o=e.code,a=e.references;(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})})({referenceCode:o,stockItemUuid:t,stockSourceUuid:a}).then((function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference")),(0,r.showSnackbar)({title:n("saveReferenceTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceMessage","Stock Item Reference saved successfully"),kind:"success"})}),(function(e){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"));var t=le(e);(0,r.showSnackbar)({title:n("saveStockItemReferenceErrorTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceErrorMessage","Error saving stock item reference"+t.join(",")),kind:"error"})}))},kind:"primary",renderIcon:Ar.vc},n("save","Save")))};var Qi=function(e){var t,n=e.isEditing,o=e.row,i=e.key,c=(0,E.useTranslation)().t,s=(0,on.Gc)(),u=s.control,d=(s.formState.errors,function(e){var t,n,a;e.preventDefault(),(t=o.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showSnackbar)({title:c("deletePackagingUnitTitle","Delete StockItem reference"),kind:"success",subtitle:c("deleteStockItemReferenceMesaage","StockItem reference deleted Successfully")})}),(function(e){var t=le(e);(0,r.showSnackbar)({title:c("deleteStockItemReferenceTitle","Error Deleting a stockitem reference"),kind:"error",subtitle:t.join(",")})}))});return l().createElement(a.SCH,null,l().createElement(a.pj1,null,n?l().createElement(Ri,{row:o,name:"references",controllerName:"references",control:u,placeholder:c("filter","Filter...")}):(!n||!o.uuid.startsWith("new-item"))&&(null==o?void 0:o.stockSourceName)),l().createElement(a.pj1,null,l().createElement("div",{className:Li.referencesTableCell},l().createElement(Cn,{id:"".concat(o.uuid,"-").concat(i),name:"code",control:u,size:"md",value:null!==(t=null==o?void 0:o.referenceCode)&&void 0!==t?t:"",controllerName:"code",labelText:""}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:pe.ZN,onClick:function(e){return d(e)}}))))};function Ji(e,t){(null==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 Wi=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 Ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ji(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(ya,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(li,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(Si,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Ti,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(ji,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Rules"),component:l().createElement(Wa,{stockItemUuid:o.uuid}),disabled:!r},{name:c("references","References"),component:l().createElement(Yi,{stockItemUuid:o.uuid,isEditing:r}),disabled:!r}];return l().createElement(Ht,{onChange:m,tabs:p,selectedIndex:u})};function Vi(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 Ki=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){Vi(a,r,o,i,l,"next",e)}function l(e){Vi(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?ye:be)(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,Xi(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)}}(),Xi=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(Wi,{model:e,onSave:function(e){return Ki(e,t)},isEditing:t}))};const $i=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Xi(Wo,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var el=n(1048),tl={};tl.styleTagTransform=h(),tl.setAttributes=g(),tl.insert=p().bind(null,"head"),tl.domAPI=d(),tl.insertStyleElement=v(),s()(el.Z,tl);const nl=el.Z&&el.Z.locals?el.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:nl.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Pharmaceuticals",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Non Pharmaceuticals",value:"false",id:"is-drug-other"}))};function 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 al(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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.")}()}const il=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"))},ll=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,Xi(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function cl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ul(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){sl(e,t,n[t])}))}return e}function dl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ml=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(""),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem"))},d=function(e){(0,E.useTranslation)().t;var t=al((0,i.useState)(1),2),n=t[0],o=t[1],a=al((0,i.useState)(10),2),l=a[0],c=a[1],s=al((0,i.useState)(null),2),u=s[0],d=s[1],m=al((0,i.useState)(""),2),p=m[0],A=m[1],g=al((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:l,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=ge(f),h=_.items,b=_.isLoading,y=_.isError,k=(0,r.usePagination)(h.results,l);return(0,i.useEffect)((function(){v({startIndex:n-1,v:U.Default,limit:l,q:u,totalCount:!0,isDrug:p})}),[u,n,l,p]),{items:k.results,pagination:k,totalCount:h.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:b,isError:y,isDrug:p,setDrug:function(e){o(1),A(e)},setSearchString:d}}(U.Full),m=d.isLoading,p=d.items,A=d.totalCount,g=d.currentPageSize,f=d.setPageSize,v=d.pageSizes,_=d.currentPage,h=d.setCurrentPage,b=d.isDrug,y=d.setDrug,k=d.setSearchString,C=vn((function(e){k(e)}),1e3);(0,i.useEffect)((function(){C(c)}),[c,C]);var w=(0,i.useMemo)((function(){return[{id:0,header:n("type","Type"),key:"type"},{id:1,header:n("genericName","Generic Name"),key:"genericName"},{id:2,header:n("commonName","Common Name"),key:"commonName"},{id:3,header:n("tradeName","Trade Name"),key:"tradeName"},{id:4,header:n("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:n("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:n("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[n]),S=(0,i.useMemo)((function(){return null==p?void 0:p.map((function(e,t){var r;return dl(ul({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),type:(null==e?void 0:e.drugUuid)?n("drug","Drug"):n("other","Other"),genericName:l().createElement(ll,{data:p[t]}),commonName:null==e?void 0:e.commonName,tradeName:(null==e?void 0:e.drugUuid)?null==e?void 0:e.conceptName:"",preferredVendorName:null==e?void 0:e.preferredVendorName,dispensingUoM:null==e?void 0:e.defaultStockOperationsUoMName,dispensingUnitName:null==e?void 0:e.dispensingUnitName,defaultStockOperationsUoMName:null==e?void 0:e.defaultStockOperationsUoMName,reorderLevel:(null==e?void 0:e.reorderLevelUoMName)&&(null==e?void 0:e.reorderLevel)?"".concat(null==e||null===(r=e.reorderLevel)||void 0===r?void 0:r.toLocaleString()," ").concat(null==e?void 0:e.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){e.isDrug=!!e.drugUuid,Xi(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(vt.I8,ul({size:16},e))}}))})}))}),[p,n]);return m?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,n("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows:S,headers:w,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,d=e.getTableProps,m=e.getRowProps,p=e.getBatchActionProps;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,p()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,value:c,onChange:function(e){return t=e.target.value,void s(t);var t}}),l().createElement(rl,{filterType:b,changeFilterType:y}),l().createElement(il,null),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement($i,null))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,o.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,dl(ul({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?St.desktopHeader:St.tabletHeader,key:"".concat(e.key),isSortable:"name"!==e.key}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,dl(ul({className:r.isDesktop?St.desktopRow:St.tabletRow},m({row:e})),{key:e.id}),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("div",{className:St.tileContent},l().createElement("p",{className:St.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:St.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:_,pageSize:g,pageSizes:v,totalItems:A,onChange:function(e){var t=e.page,n=e.pageSize;h(t),f(n)},className:St.paginationOverride}))};var pl=n(5104),Al={};Al.styleTagTransform=h(),Al.setAttributes=g(),Al.insert=p().bind(null,"head"),Al.domAPI=d(),Al.insertStyleElement=v(),s()(pl.Z,Al);const gl=pl.Z&&pl.Z.locals?pl.Z.locals:void 0;function fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vl(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fl(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 _l=n(4300),hl={};hl.styleTagTransform=h(),hl.setAttributes=g(),hl.insert=p().bind(null,"head"),hl.domAPI=d(),hl.insertStyleElement=v(),s()(_l.Z,hl);const bl=_l.Z&&_l.Z.locals?_l.Z.locals:void 0;function yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kl(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 Cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function El(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Cl(e,t,n[t])}))}return e}function wl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Sl(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)||Ol(e,t)||function(){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 Dl(e){return function(e){if(Array.isArray(e))return yl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ol(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 Ol(e,t){if(e){if("string"==typeof e)return yl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yl(e,t):void 0}}var xl=ee();const Nl=function(e){var t,n,o,c,s=e.model,u=e.editMode,d=(0,E.useTranslation)().t,m=(0,r.useSession)(),p=Sl((0,i.useState)(El({},s)),2),A=p[0],g=p[1],f=Sl((0,i.useState)([]),2),v=f[0],_=f[1],h=Sl((0,i.useState)(!1),2),b=(h[0],h[1]),y=null==m||null===(t=m.user)||void 0===t?void 0:t.uuid,k=Ut(),C=k.types.results,w=k.isLoading,S=zt({v:U.Default}),D=S.items,O=S.isLoading,x=Sl((0,i.useState)(null),2),N=x[0],I=x[1],T=function(e){var t="".concat(r.restBaseUrl,"/user/").concat(e),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{data:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(N),B=T.data,P=(T.isError,Pt({v:U.Default})),z=(P.items,P.isLoading),F=Bt().stockLocations,L=Sl((0,i.useState)(""),2),R=(L[0],L[1]),M=Sl((0,i.useState)([]),2),q=M[0],G=M[1],H=null!==(c=null==D?void 0:D.results)&&void 0!==c?c:[];(0,i.useEffect)((function(){(null==s?void 0:s.userUuid)&&I(s.userUuid)}),[s]);var Z,Y,J,W=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},V=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){kl(a,r,o,i,l,"next",e)}function l(e){kl(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){return e.preventDefault(),function(e){var t=new AbortController,n=null!=e.uuid,o="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(n?"/"+e.uuid:"");return(0,r.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(e){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),(0,r.showToast)({critical:!0,title:d("addUserRole","Add User role"),kind:"success",description:d("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,r.showNotification)({title:d("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",critical:!0,description:null==e?void 0:e.message}),Q()})),[2]}))}));return function(t){return e.apply(this,arguments)}}();return w||z||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:bl.section},l().createElement("div",null,(null==D||null===(n=D.results)||void 0===n?void 0:n.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:bl.subTitle},d("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:d("user","User"),items:q.length?q:H,onChange:function(e){var t,n,r,o=["d210eb66-2188-11ed-9dff-507b9dea1806","cca4be4b-2188-11ed-9dff-507b9dea1806","84bdd876-4694-11ed-8109-00155dcc3fc0","a49be648-6b0a-11ed-93a2-806d973f13a9","2083fd40-3391-11ed-a667-507b9dea1806"],a=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return o.includes(e.uuid)})).filter((function(e){return e.uuid!==y}));g(wl(El({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),_(null!=a?a:[]),I(null==e||null===(r=e.selectedItem)||void 0===r?void 0:r.uuid)},shouldFilterItem:function(){return!0},itemToString:function(e){var t,n,r;return"".concat(null!==(r=null!==(n=null==e||null===(t=e.person)||void 0===t?void 0:t.display)&&void 0!==n?n:null==e?void 0:e.display)&&void 0!==r?r:"")},onInputChange:function(e){R(e),function(e){if(""===e.trim())b(!1);else{b(!0);var t=H.filter((function(e){return e.uuid!==y})).filter((function(t){var n,r,o;return(null!==(o=null!==(r=null==t||null===(n=t.person)||void 0===n?void 0:n.display)&&void 0!==r?r:null==t?void 0:t.display)&&void 0!==o?o:"").toLowerCase().includes(e.toLowerCase())}));G(t)}}(e)},placeholder:"Filter...",initialSelectedItem:null!==(Z=H.find((function(e){return e.uuid===(null==s?void 0:s.userUuid)})))&&void 0!==Z?Z:null})))),l().createElement("section",{className:bl.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:d("role","Role"),id:"select-role",value:null!==(Y=A.role)&&void 0!==Y?Y:"placeholder-item",onChange:function(e){var t,n,r,o=null==F||null===(t=F.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==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(wl(El({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:d("Choose a role")}),u?l().createElement(a.QlF,{key:null==A?void 0:A.role,value:null==A?void 0:A.role,text:null==A?void 0:A.role}):null===(o=null!==(J=null==B?void 0:B.roles)&&void 0!==J?J:v)||void 0===o?void 0:o.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})}))))),l().createElement("section",{className:bl.section},l().createElement(a.cOn,{className:bl.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.enabled);g(wl(El({},A),{enabled:n}))},checked:null==A?void 0:A.enabled,labelText:d("enabled","Enabled ?"),value:null==s?void 0:s.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.permanent);g(wl(El({},A),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==s?void 0:s.permanent,labelText:d("permanent","Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(xl),locale:"en",dateFormat:X,onChange:function(e){g(wl(El({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:K,labelText:d("activeFrom","Active From"),value:$(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:K,labelText:d("activeTo","Active To"),value:$(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:bl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:bl.sectionTitle}," ",d("stockOperation","Stock Operations")),l().createElement("div",{className:bl.hr}),l().createElement("span",{className:bl.subTitle},d("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:bl.section},l().createElement(a.cOn,{className:bl.checkboxGrid},(null==C?void 0:C.length)>0&&C.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:W(e),className:bl.checkbox,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=Dl(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==o?void 0:o.operationTypeUuid)})));g(wl(El({},A),{operationTypes:a}))}else{var i,l=null==C?void 0:C.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={operationTypeName:null==l?void 0:l.name,operationTypeUuid:null==l?void 0:l.uuid};g(wl(El({},A),{operationTypes:Dl(null!==(i=null==A?void 0:A.operationTypes)&&void 0!==i?i:[]).concat([c])}))}}(t,e.uuid,W(e))},labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:bl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:bl.sectionTitle}," ",d("Locations")),l().createElement("div",{className:bl.hr}),l().createElement("span",{className:bl.subTitle},d("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:bl.section},l().createElement(a.cOn,{className:bl.checkboxGrid},(null==F?void 0:F.length)>0&&F.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=Dl(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(wl(El({},A),{locations:i}))}else{var l,c=null==F?void 0:F.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={locationName:null==c?void 0:c.name,locationUuid:null==c?void 0:c.id,enableDescendants:!1},u=Dl(null!==(l=null==A?void 0:A.locations)&&void 0!==l?l:[]).concat([s]);g(wl(El({},A),{locations:u}))}}(t,e.id)},className:bl.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:bl.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},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:V},d("save","Save")))))},Il=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Nl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function Tl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Bl=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Nl,{model:t,editMode:!0}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:r,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(vt.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){Tl(e,t,n[t])}))}return e}({size:16},e))}})};function Pl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ul(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jl=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pl(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-user-scope-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/userrolescope/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),d(!1),(0,r.showToast)({critical:!0,title:c("deletingstockUserScope","Delete Stock User Scope"),kind:"success",description:c("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteUserScope","Delete Stock User Scope"),renderIcon:function(e){return l().createElement(pe.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){Ul(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};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 Fl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(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 Ll(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 Rl=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope"))},o=vl({v:U.Default,totalCount:!0}),c=o.items,s=o.totalItems,u=o.currentPage,d=o.pageSizes,m=o.goTo,p=o.currentPageSize,A=o.setPageSize,g=o.isLoading,f=(0,i.useMemo)((function(){return[{id:0,header:e("user","User"),key:"user"},{id:1,header:e("role","Role"),key:"role"},{id:2,header:e("location","Location(s)"),key:"locations"},{id:3,header:e("stockOperations","Stock Operations"),key:"stockOperations"},{id:4,header:e("permanent","Permanent ?"),key:"permanent"},{id:5,header:e("ActiveFrom","Active From "),key:"activeFrom"},{id:6,header:e("activeTo","Active To"),key:"activeTo"},{id:7,header:e("enabled","Enabled ?"),key:"enabled"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),v=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(n,r){var o,i,s,u,d,m,p=t.user.uuid===n.userUuid;return Ll(Fl({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),uuid:"".concat(null==n?void 0:n.uuid),user:t.user.uuid===n.userUuid?"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName):l().createElement(a.rUS,{to:(m=null==n?void 0:n.uuid,"".concat("/user-role-scopes","/").concat(m))},"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName)),roleName:null==n?void 0:n.role,locations:null==n||null===(o=n.locations)||void 0===o?void 0:o.map((function(e){var t="loc-".concat(null==n?void 0:n.uuid,"-").concat(e.locationUuid);return l().createElement("span",{key:t},null==e?void 0:e.locationName,(null==e?void 0:e.enableDescendants)?l().createElement(me.l2,{key:"".concat(t,"-").concat(r,"-0")}):l().createElement(me.Xd,{key:"".concat(t,"-").concat(r,"-1")})," ")})),stockOperations:null==n||null===(s=n.operationTypes)||void 0===s||null===(i=s.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===i?void 0:i.join(", "),permanent:(null==n?void 0:n.permanent)?e("yes","Yes"):e("no","No"),activeFrom:null!==(u=V(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=V(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("yes","Yes"):e("no","No"),actions:l().createElement("div",{style:{display:"flex"}},!p&&l().createElement(l().Fragment,null,l().createElement(Bl,{data:c[r]}),l().createElement(jl,{uuid:c[r].uuid})))})}))}),[t.user.uuid,c,e]);return g?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:gl.tableOverride},l().createElement(a.x45,null,e("panelDescription","To access stock management features, users must have assigned roles specifying location and stock operation type scopes.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:null!=v?v:[],headers:f,isSortable:!0,useZebraStyles:!0,render:function(t){var o=t.rows,i=t.headers,c=t.getHeaderProps,s=t.getTableProps,u=t.getRowProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:gl.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Il,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ll(Fl({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?gl.desktopHeader:gl.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,Fl({className:r.isDesktop?gl.desktopRow:gl.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:gl.tileContainer},l().createElement(a.n9L,{className:gl.tile},l().createElement("div",{className:gl.tileContent},l().createElement("p",{className:gl.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:gl.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:p,pageSizes:d,totalItems:s,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==u&&m(n)},className:gl.paginationOverride}))};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}var ql=n(8098),Gl={};Gl.styleTagTransform=h(),Gl.setAttributes=g(),Gl.insert=p().bind(null,"head"),Gl.domAPI=d(),Gl.insertStyleElement=v(),s()(ql.Z,Gl);const Hl=ql.Z&&ql.Z.locals?ql.Z.locals:void 0;function Zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Yl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Yl(e,t,n[t])}))}return e}function Jl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Wl=function(e){var t,n,o,c=e.model,s=(0,E.useTranslation)().t,u=Ft((0,r.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(Ql({},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 Zl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zl(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],p=d[1],A=(0,i.useCallback)((function(e){e.preventDefault(),c&&(m.uuid=c.uuid),function(e){var t,n,o,a=null!=e.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(a?"/"+e.uuid:""),l=new AbortController;return(0,r.openmrsFetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},signal:l.signal,body:(n=la({},e),o={sourceType:null==e||null===(t=e.sourceType)||void 0===t?void 0:t.uuid},o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n)})}(m).then((function(){(0,r.showToast)({critical:!0,title:s("addedSource","Add Source"),kind:"success",description:s("stocksourceaddedsuccessfully","Stock Source Added Successfully")}),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingSource', 'error adding a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[m,c,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:A},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:Hl.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(Jl(Ql({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:Hl.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(Jl(Ql({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:Hl.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(Jl(Ql({},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")))))},Vl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(Wl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var Kl=n(5551),Xl={};Xl.styleTagTransform=h(),Xl.setAttributes=g(),Xl.insert=p().bind(null,"head"),Xl.domAPI=d(),Xl.insertStyleElement=v(),s()(Kl.Z,Xl);const $l=Kl.Z&&Kl.Z.locals?Kl.Z.locals:void 0;function ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const tc=function(e){var t,n=e.onFilterChange,o=Ft((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:$l.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return ec(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 ec(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ec(e,t):void 0}}(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 nc=n(6940),rc={};rc.styleTagTransform=h(),rc.setAttributes=g(),rc.insert=p().bind(null,"head"),rc.domAPI=d(),rc.insertStyleElement=v(),s()(nc.Z,rc);const oc=nc.Z&&nc.Z.locals?nc.Z.locals:void 0;function ac(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ic(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const lc=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 ac(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ac(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/stocksource/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){d(!1),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),(0,r.showToast)({critical:!0,title:c("deletingSource","Delete Source"),kind:"success",description:c("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingSource', 'error deleting a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteSource","Delete Source"),renderIcon:function(e){return l().createElement(pe.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){ic(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function cc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sc=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(Wl,{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(vt.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){cc(e,t,n[t])}))}return e}({size:16},e))}})};function uc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){dc(e,t,n[t])}))}return e}function pc(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 Ac=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 uc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource"))},d=function(e){var t=ca(e),n=t.items,o=t.isLoading,a=t.isError,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n.results,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,i.useMemo)((function(){return[{id:1,header:"Name",key:"name"},{id:2,header:"Acronym",key:"acronym"},{id:3,header:"Source Type",key:"sourceType"},{id:4,header:"actions",key:"actions"}]}),[]);return{items:m,totalItems:null==n?void 0:n.totalCount,currentPage:p,currentPageSize:c,paginatedItems:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:o,isError:a,setPageSize:s,tableHeaders:A}}({v:U.Default,totalCount:!0}),m=d.items,p=d.totalItems,A=d.tableHeaders,g=d.currentPage,f=d.pageSizes,v=d.goTo,_=d.currentPageSize,h=d.setPageSize,b=d.isLoading,y=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n;return pc(mc({},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(sc,{data:m[t]}),l().createElement(lc,{uuid:m[t].uuid}))})}))}),[m]),k=function(e){s(e)},C=(0,i.useMemo)((function(){return c?y.filter((function(e){return e.sourceType===c})):y}),[y,c]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:oc.tableOverride},l().createElement(a.x45,null,n("panelDescription","List of partners who provide stock to the facility.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:C,headers:A,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,c=e.getTableProps,s=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:oc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(tc,{onFilterChange:k})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(Vl,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,pc(mc({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?oc.desktopHeader:oc.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,mc({className:r.isDesktop?oc.desktopRow:oc.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:oc.tileContainer},l().createElement(a.n9L,{className:oc.tile},l().createElement("div",{className:oc.tileContent},l().createElement("p",{className:oc.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:oc.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:g,pageSize:_,pageSizes:f,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==_&&h(t),n!==g&&v(n)},className:oc.paginationOverride}))};function gc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fc(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 vc(){return vc=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){fc(a,r,o,i,l,"next",e)}function l(e){fc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(a){switch(a.label){case 0:t=e.locationPayload,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/location/"),{method:"POST",headers:{"Content-Type":"application/json"},body:t})];case 2:return[2,a.sent()];case 3:return n=a.sent(),o=le(n),(0,r.showToast)({description:o.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))})),vc.apply(this,arguments)}var _c=n(2761),hc={};hc.styleTagTransform=h(),hc.setAttributes=g(),hc.insert=p().bind(null,"head"),hc.domAPI=d(),hc.insertStyleElement=v(),s()(_c.Z,hc);const bc=_c.Z&&_c.Z.locals?_c.Z.locals:void 0;function yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){kc(e,t,n[t])}))}return e}function Ec(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 yc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yc(e,t):void 0}}(e,t)||function(){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 wc=ln.z.object({name:ln.z.string().max(255)});const Sc=function(e){var t,n,o,c,s,u,d,m=e.showModal,p=e.onModalChange,A=e.handleCreateQuestion,g=e.headerTitle,f=e.initialData,v=(0,E.useTranslation)().t,_=Ec((0,i.useState)(!1),2),h=_[0],b=_[1],y=Ec((0,i.useState)(""),2),k=y[0],C=y[1],w=(o="".concat(r.restBaseUrl,"/locationtag/"),s=(c=(0,j.ZP)(o,r.openmrsFetch)).data,c.error,u=c.isLoading,c.isValidating,d=c.mutate,{locationTagList:(null==s||null===(t=s.data)||void 0===t?void 0:t.results)?null==s||null===(n=s.data)||void 0===n?void 0:n.results:[],loading:u,mutate:d}).locationTagList,S=(0,on.cI)({mode:"all",resolver:(0,an.F)(wc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),D=S.handleSubmit,O=S.control,x=S.getValues,N=S.formState.isDirty;return l().createElement(a.lpG,{open:m,onClose:function(){return p(!1)},preventCloseOnClickOutside:!0,size:"md"},l().createElement(a.xBx,{title:g}),l().createElement("form",{onSubmit:D((function(e){var t,n,r,o=x(),a=null!==(r=null==o||null===(n=o.tags)||void 0===n||null===(t=n.selectedItems)||void 0===t?void 0:t.map((function(e){return e.uuid})))&&void 0!==r?r:[],i={name:o.name,tags:a};wc.safeParse(e).success&&(b(!1),A(i))}),(function(e){C(Object.entries(e)[0][1].message),b(!0)}))},l().createElement(a.fef,{hasScrollingContent:!0},l().createElement(a.Kqy,{gap:3},l().createElement(a.cwH,{legendText:""},l().createElement(on.Qr,{name:"name",control:O,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,Cc({id:"location",labelText:v("location","Location Name"),placeholder:v("locationPlaceholder","Add a location"),invalidText:null===(t=r.error)||void 0===t?void 0:t.message},n)))}}),l().createElement("div",{className:bc.loaderContainer},l().createElement(on.Qr,{name:"tags",control:O,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=Cc({id:"tag",titleText:"Select tag(s)",helperText:"This is helper text",items:null!=w?w:[]},r),n={itemToString:function(e){return e?e.display:""},selectionFeedback:"top-after-reopen"},n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}}))),h&&l().createElement(a.K0D,{lowContrast:!0,title:v("error","Error"),style:{minWidth:"100%",margin:"0rem",padding:"0rem"},role:"alert",kind:"error",subtitle:v("pleaseFillField",k)+".",onClose:function(){return b(!1)}}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{onClick:function(){return p(!1)},kind:"secondary"},v("cancel","Cancel")),l().createElement(a.zxk,{disabled:!N,type:"submit"},l().createElement("span",null,v("save","Save"))))))},Dc=function(e){var t=e.showModal,n=e.onModalChange,o=e.mutate,a=(0,E.useTranslation)().t,c=a("addLocation","Create new Location"),s=(0,i.useCallback)((function(e){var t=e.name,i=e.tags;(function(e){return vc.apply(this,arguments)})({locationPayload:{name:t,tags:i}}).then((function(){(0,r.showToast)({title:a("formCreated","Add Location"),kind:"success",critical:!0,description:a("Location ".concat(t," was created successfully."))}),o(),n(!1)})).catch((function(e){(0,r.showNotification)({title:a("errorCreatingForm","Error creating location"),kind:"error",critical:!0,description:null==e?void 0:e.message}),n(!1)})),n(!1)}),[n,o,a]);return l().createElement(l().Fragment,null,l().createElement(Sc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};function Oc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nc=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oc(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=Bt(),n=t.stockLocations,o=t.error,a=t.isLoading,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,E.useTranslation)().t,g=(0,i.useMemo)((function(){return[{id:0,header:A("name","Name"),key:"name"},{id:1,header:A("tags","Tags"),key:"tags"},{id:2,header:A("childLocations","Child Locations"),key:"childLocations"},{id:3,header:A("actions","Actions"),key:"actions"}]}),[A]),f=(0,i.useMemo)((function(){return n.map((function(e){var t,n,r,o,a,i;return{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),name:"".concat(null==e?void 0:e.name),tags:null!==(a=null==e||null===(n=e.meta.tag)||void 0===n||null===(t=n.filter((function(e){return"SUBSETTED"!==e.code})).map((function(e){return e.code})))||void 0===t?void 0:t.join(", "))&&void 0!==a?a:"",childLocations:null!==(i=null==e||null===(o=e.childLocations)||void 0===o||null===(r=o.map((function(e){return e.display})))||void 0===r?void 0:r.join(", "))&&void 0!==i?i:""}}))}),[n]);return{items:n,currentPage:p,currentPageSize:c,paginatedQueueEntries:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:a,error:o,setPageSize:s,tableHeaders:g,tableRows:f}}(U.Full),d=u.tableHeaders,m=u.tableRows,p=u.items,A=u.isLoading,g=function(){ce("".concat(r.restBaseUrl,"/Location?_summary=data"))};return A?l().createElement(a.gqd,{role:"progressbar"}):(null==p?void 0:p.length)?l().createElement(hi,{columns:d,data:m},(function(e){var t=e.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:t}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:g},"Refresh")),c?l().createElement(Dc,{onModalChange:s,showModal:c,mutate:j.JG}):null,l().createElement(a.zxk,{kind:"ghost",renderIcon:function(e){return l().createElement(me.mm,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){xc(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("p",{className:St.content},"No stock items to display")))};var Ic=n(557),Tc={};Tc.styleTagTransform=h(),Tc.setAttributes=g(),Tc.insert=p().bind(null,"head"),Tc.domAPI=d(),Tc.insertStyleElement=v(),s()(Ic.Z,Tc);const Bc=Ic.Z&&Ic.Z.locals?Ic.Z.locals:void 0;function Pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Uc,jc=ln.z.object({startDate:ln.z.coerce.date().optional(),endDate:ln.z.coerce.date().optional(),location:ln.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:ln.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:ln.z.string().optional(),mostLeastMoving:ln.z.string().optional(),mostLeastMovingName:ln.z.string().optional(),stockItemUuid:ln.z.string().optional(),stockItemName:ln.z.string().optional(),patientUuid:ln.z.string().optional(),patientName:ln.z.string().optional(),locationUuid:ln.z.string().optional(),childLocations:ln.z.boolean().optional(),stockSourceUuid:ln.z.string().optional(),stockSource:ln.z.string().optional(),stockSourceDestinationUuid:ln.z.string().optional(),stockSourceDestination:ln.z.string().optional(),inventoryGroupBy:ln.z.string().optional(),stockItemCategory:ln.z.string().optional(),inventoryGroupByName:ln.z.string().optional(),stockItemCategoryConceptUuid:ln.z.string().optional(),reportSystemName:ln.z.string().optional(),maxReorderLevelRatio:ln.z.number().optional(),fullFillment:ln.z.string().array().optional(),limit:ln.z.string().optional(),date:ln.z.coerce.date().optional()}).superRefine((function(e,t){"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName&&(e.startDate||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"Start Date is required ",path:["startDate"]}),e.endDate||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"End Date is required",path:["endDate"]})),"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName||(e.date||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"Date is required ",path:["date"]}),e.inventoryGroupBy||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"Inventory by is required ",path:["inventoryGroupBy"]}))}));function zc(e){var t="".concat(r.restBaseUrl,"/stockmanagement/batchjob"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Date="Date",e.StartDate="StartDate",e.EndDate="EndDate",e.StockItemCategory="StockItemCategory",e.Location="Location",e.ChildLocations="ChildLocations",e.StockSource="StockSource",e.StockSourceDestination="StockSourceDestination",e.InventoryGroupBy="InventoryGroupBy",e.MaxReorderLevelRatio="MaxReorderLevelRatio",e.Patient="Patient",e.StockItem="StockItem",e.Limit="Limit",e.MostLeastMoving="MostLeastMoving",e.Fullfillment="Fullfillment"}(Uc||(Uc={}));var Fc=function(e){return Lc(e)?4:e?20:null},Lc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Rc="Completed";function Mc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qc(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Gc(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)||Zc(e,t)||function(){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 Hc(e){return function(e){if(Array.isArray(e))return Mc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Zc(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 Zc(e,t){if(e){if("string"==typeof e)return Mc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mc(e,t):void 0}}const Yc=function(e){var t,n,o,c,s,u=e.model,d=(0,E.useTranslation)().t,m=(0,r.useConfig)().stockItemCategoryUUID,p=function(){var e,t,n="".concat(r.restBaseUrl,"/stockmanagement/report?v=default"),o=(0,j.ZP)(n,r.openmrsFetch),a=o.data,i=o.error,l=o.isLoading;return{reportTypes:null!==(t=null==a||null===(e=a.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[],isLoading:l,isError:i}}(),A=p.reportTypes,g=p.isLoading,f=Bt().stockLocations,v=Ft(m),_=v.items,h=(v.isLoading,Gc((0,i.useState)(!1),2)),b=h[0],y=h[1],k=Gc((0,i.useState)(!1),2),C=k[0],w=k[1],S=Gc((0,i.useState)(!1),2),D=S[0],O=S[1],x=Gc((0,i.useState)(!1),2),N=x[0],I=x[1],T=Gc((0,i.useState)(!1),2),B=T[0],P=T[1],U=Gc((0,i.useState)(!1),2),z=U[0],F=U[1],L=Gc((0,i.useState)(!1),2),R=L[0],M=L[1],q=Gc((0,i.useState)(!1),2),G=q[0],H=q[1],Z=Gc((0,i.useState)(!1),2),Y=Z[0],J=Z[1],W=Gc((0,i.useState)(!1),2),te=W[0],ne=W[1],re=Gc((0,i.useState)(!1),2),oe=re[0],ae=re[1],ie=Gc((0,i.useState)(!1),2),le=ie[0],ce=ie[1],se=Gc((0,i.useState)(!1),2),ue=se[0],de=se[1],me=Gc((0,i.useState)(!1),2),pe=me[0],Ae=me[1],ge=Gc((0,i.useState)(!1),2),fe=ge[0],ve=ge[1],_e=Gc((0,i.useState)(""),2),he=_e[0],be=_e[1];(0,i.useEffect)((function(){var e=!1;if(he){var t,n,r,o,a,i,l,c,s,u,d,m,p,g,f,v=null==A?void 0:A.find((function(e){return e.name===he}));v&&(y(null===(t=v.parameters)||void 0===t?void 0:t.some((function(e){return e===Uc.Date}))),w(null===(n=v.parameters)||void 0===n?void 0:n.some((function(e){return e===Uc.StartDate}))),O(null===(r=v.parameters)||void 0===r?void 0:r.some((function(e){return e===Uc.EndDate}))),I(null===(o=v.parameters)||void 0===o?void 0:o.some((function(e){return e===Uc.StockItemCategory}))),P(null===(a=v.parameters)||void 0===a?void 0:a.some((function(e){return e===Uc.Location}))),F(null===(i=v.parameters)||void 0===i?void 0:i.some((function(e){return e===Uc.ChildLocations}))),M(null===(l=v.parameters)||void 0===l?void 0:l.some((function(e){return e===Uc.StockSource}))),H(null===(c=v.parameters)||void 0===c?void 0:c.some((function(e){return e===Uc.StockSourceDestination}))),J(null===(s=v.parameters)||void 0===s?void 0:s.some((function(e){return e===Uc.InventoryGroupBy}))),ne(null===(u=v.parameters)||void 0===u?void 0:u.some((function(e){return e===Uc.MaxReorderLevelRatio}))),ce(null===(d=v.parameters)||void 0===d?void 0:d.some((function(e){return e===Uc.StockItem}))),ae(null===(m=v.parameters)||void 0===m?void 0:m.some((function(e){return e===Uc.Patient}))),de(null===(p=v.parameters)||void 0===p?void 0:p.some((function(e){return e===Uc.Limit}))),Ae(null===(g=v.parameters)||void 0===g?void 0:g.some((function(e){return e===Uc.MostLeastMoving}))),ve(null===(f=v.parameters)||void 0===f?void 0:f.some((function(e){return e===Uc.Fullfillment}))),e=!0)}e||(y(!1),w(!1),O(!1),I(!1),P(!1),F(!1),M(!1),H(!1),J(!1),ne(!1),ce(!1),ae(!1),de(!1),Ae(!1),ve(!1))}),[he,A]);var ye=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Hc(null!==(t=_&&(null==_||null===(e=_.answers)||void 0===e?void 0:e.length)>0?null==_?void 0:_.answers:null==_?void 0:_.setMembers)&&void 0!==t?t:[]))}),[_]),ke=(0,on.cI)({mode:"all",resolver:(0,an.F)(jc)}),Ce=ke.handleSubmit,Ee=ke.control,we=ke.formState,Se=we.errors,De=(we.defaultValues,we.isDirty,ke.setValue);if(g)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Oe=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){qc(a,r,o,i,l,"next",e)}function l(e){qc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o,a,i,l,c,s,u,m,p,g,f,v,_,h,y,k,E,w,S,O,x,I,T,P,U,j,F,L,M,q,H,Z,J,W,K,X;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function($){switch($.label){case 0:n=null===(t=A.find((function(t){return t.name===e.reportName})))||void 0===t?void 0:t.systemName,$.label=1;case 1:return $.trys.push([1,,3,4]),o="\r\n",a="param.report=".concat(n).concat(o),fe&&(a+=xe(Uc.Fullfillment,(null!==(i=e.fullFillment)&&void 0!==i?i:["All"]).join(","),(null!==(l=e.fullFillment)&&void 0!==l?l:["All"]).join(", "),d("stockmanagement.report.edit.fullfillment"),o)),oe&&(a+=xe(Uc.Patient,null!==(s=e.patientUuid)&&void 0!==s?s:"",null!==(u=null===(c=e.patientName)||void 0===c?void 0:c.trim())&&void 0!==u?u:"All Patients",d("Patients"),o)),le&&(a+=xe(Uc.StockItem,null!==(p=e.stockItemUuid)&&void 0!==p?p:"",null!==(g=null===(m=e.stockItemName)||void 0===m?void 0:m.trim())&&void 0!==g?g:"All Stock Items",d("Stock Item"),o)),N&&(a+=xe(Uc.StockItemCategory,null!==(v=e.stockItemCategoryConceptUuid)&&void 0!==v?v:"",null!==(_=null===(f=e.stockItemCategory)||void 0===f?void 0:f.trim())&&void 0!==_?_:"All Categories",d("Stock Item Category"),o)),Y&&(a+=xe(Uc.InventoryGroupBy,null!==(y=e.inventoryGroupBy)&&void 0!==y?y:"LocationStockItemBatchNo",null!==(k=null===(h=e.inventoryGroupByName)||void 0===h?void 0:h.trim())&&void 0!==k?k:"Stock Item Batch Number",d("stockmanagement.report.edit.inventorygroupby"),o)),B&&(a+=xe(Uc.Location,e.location,null!==(w=null===(E=e.location)||void 0===E?void 0:E.trim())&&void 0!==w?w:"",d("Location"),o),z&&(a+=xe(Uc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",d("Include Child Locations"),o))),te&&(a+=xe(Uc.MaxReorderLevelRatio,(null!==(S=e.maxReorderLevelRatio)&&void 0!==S?S:0).toString(),(null!==(O=e.maxReorderLevelRatio)&&void 0!==O?O:0).toString()+"%",d("stockmanagement.report.edit.maxreorderlevelratio"),o)),R&&(a+=xe(Uc.StockSource,null!==(I=e.stockSourceUuid)&&void 0!==I?I:"",null!==(T=null===(x=e.stockSource)||void 0===x?void 0:x.trim())&&void 0!==T?T:"All Sources",d("stockmanagement.report.edit.stocksource"),o)),G&&(a+=xe(Uc.StockSourceDestination,null!==(U=e.stockSourceDestinationUuid)&&void 0!==U?U:"",null!==(j=null===(P=e.stockSourceDestination)||void 0===P?void 0:P.trim())&&void 0!==j?j:"All Destinations",d("stockmanagement.report.edit.stocksourcedestination"),o)),pe&&(a+=xe(Uc.MostLeastMoving,null!==(L=e.mostLeastMoving)&&void 0!==L?L:"MostMoving",null!==(M=null===(F=e.mostLeastMovingName)||void 0===F?void 0:F.trim())&&void 0!==M?M:"Most Moving",d("stockmanagement.report.edit.mostleastmoving"),o)),ue&&(a+=xe(Uc.Limit,(null!==(H=null!==(q=e.limit)&&void 0!==q?q:Fc(e.reportSystemName))&&void 0!==H?H:20).toString(),(null!==(J=null!==(Z=e.limit)&&void 0!==Z?Z:Fc(e.reportSystemName))&&void 0!==J?J:20).toString(),d(function(e){return Lc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),o)),b&&(a+=xe(Uc.Date,e.date?JSON.stringify(e.date).replaceAll('"',""):"",null!==(W=V(e.date))&&void 0!==W?W:"",d("stockmanagement.report.edit.date"),o)),C&&(a+=xe(Uc.StartDate,e.startDate?JSON.stringify(e.startDate).replaceAll('"',""):"",null!==(K=V(e.startDate))&&void 0!==K?K:"",d(function(e){return Lc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),o)),D&&(a+=xe(Uc.EndDate,e.endDate?JSON.stringify(e.endDate).replaceAll('"',""):"",null!==(X=V(e.endDate))&&void 0!==X?X:"",d(function(e){return Lc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),o)),[4,zc({batchJobType:"Report",description:e.reportName,parameters:a}).then((function(e){Q(),201===e.status?(0,r.showSnackbar)({title:d("batchJob","Batch Job"),subtitle:d("BatchJobSuccess","Batch job created successfully"),kind:"success"}):(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})})).catch((function(e){(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})}))];case 2:return $.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),xe=function(e,t,n,r,o){return"param.".concat(e,".value=").concat(t).concat(o,"param.").concat(e,".value.desc=").concat(n).concat(o,"param.").concat(e,".description=").concat(r).concat(o)};return l().createElement(a.l09,{onSubmit:Ce(Oe,(function(e){console.error(e)}))},l().createElement("div",{className:Bc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,d("reportName","Report")),l().createElement(on.Qr,{control:Ee,name:"reportName",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"report",size:"md",labelText:d("reportName","Report"),items:A,itemToString:function(e){var t,n;return"".concat(null!==(n=null!==(t=null==e?void 0:e.name)&&void 0!==t?t:null==e?void 0:e.name)&&void 0!==n?n:"")},placeholder:"Filter...",onChange:function(e){var n,r=e.selectedItem;t(r.name),n=r.name,be(n)}})}})),N&&l().createElement(l().Fragment,null,l().createElement("span",null,d("stockItemCategory","Stock Item Category")),l().createElement(on.Qr,{control:Ee,name:"stockReportItemCategory",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"stockReportItem",size:"md",labelText:d("stockItemCategory","Stock Item Category"),items:ye,onChange:function(e){var n=e.selectedItem;t(n.uuid)},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},placeholder:"Filter..."})}})),C&&l().createElement(on.Qr,{control:Ee,name:"startDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:K,labelText:d("startDate","Start Date"),defaultValue:"",invalid:null==Se||null===(t=Se.startDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.startDate)||void 0===n?void 0:n.message}))}}),D&&l().createElement(on.Qr,{control:Ee,name:"endDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:K,labelText:d("endDate","End Date"),defaultValue:"",invalid:null==Se||null===(t=Se.endDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.endDate)||void 0===n?void 0:n.message}))}}),Y&&l().createElement(a.PhF,{id:"inventoryGroupBy",defaultValue:null==u?void 0:u.inventoryGroupBy,invalid:null==Se||null===(t=Se.inventoryGroupBy)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.inventoryGroupBy)||void 0===n?void 0:n.message,labelText:d("inventoryBy","Inventory by"),onChange:function(e){return De("inventoryGroupBy",e.target.value)}},l().createElement(a.QlF,{value:"",text:d("SelectOption","Select an option")}),l().createElement(a.QlF,{value:"StockItemOnly",text:d("stockItem","Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItem",text:d("lcationstockitem","Location and Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItemBatchNo",text:d("locationBatchno","Location and Batch")})),B&&l().createElement(a.PhF,{name:"location",className:"select-field",labelText:d("location","Location"),id:"location",onChange:function(e){return De("location",e.target.value)},defaultValue:"",invalid:null==Se||null===(o=Se.location)||void 0===o?void 0:o.message,invalidText:null==Se||null===(c=Se.location)||void 0===c?void 0:c.message},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:d("Choose a location")}),null===(s=null!=f?f:[])||void 0===s?void 0:s.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})}))),z&&l().createElement(on.Qr,{control:Ee,name:"childLocations",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.XZJ,{id:"childLocations",onChange:n,value:r,labelText:d("IncludeChildLocations","Include Child Locations")})}}),pe&&l().createElement(on.Qr,{control:Ee,name:"mostLeastMoving",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.SYO,{name:"mostLeastMoving",legendText:d("rank","Rank"),onChange:n,value:r},l().createElement(a.EUY,{value:"MostMoving",id:"mostLeastMovingMost",labelText:d("mostMoving","Most Moving")}),l().createElement(a.EUY,{value:"LeastMoving",id:"mostLeastMovingLeast",labelText:d("LeastMoving","Least Moving")}))}}),ue&&l().createElement(on.Qr,{control:Ee,name:"limit",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.Y2U,{id:"limitTop",allowEmpty:!0,value:r,onchange:n,label:d("limit","Limit"),defaultValue:20})}}),fe&&l().createElement("div",{style:{display:"flex",flexDirection:"row",gap:"0 1rem"}},l().createElement(on.Qr,{control:Ee,name:"fullFillment",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(l().Fragment,null,l().createElement(a.XZJ,{id:"allFulfillment",checked:null==r?void 0:r.includes("All"),onChange:function(e){var t=e.target.checked;n(t?["All"]:r.filter((function(e){return"All"!==e})))},labelText:d("all","All")}),l().createElement(a.XZJ,{id:"fullFulfillment",checked:null==r?void 0:r.includes("Full"),onChange:function(e){var t=e.target.checked;n(t?Hc(r.filter((function(e){return"All"!==e}))).concat(["Full"]):r.filter((function(e){return"Full"!==e})))},labelText:d("fullFulfillment","Full Fulfillment")}),l().createElement(a.XZJ,{id:"partialFulfillment",checked:null==r?void 0:r.includes("Partial"),onChange:function(e){var t=e.target.checked;n(t?Hc(r.filter((function(e){return"All"!==e}))).concat(["Partial"]):r.filter((function(e){return"Partial"!==e})))},labelText:d("partialFulfillment","Partial Fulfillment")}),l().createElement(a.XZJ,{id:"noneFulfillment",checked:null==r?void 0:r.includes("None"),onChange:function(e){var t=e.target.checked;n(t?Hc(r.filter((function(e){return"All"!==e}))).concat(["None"]):r.filter((function(e){return"None"!==e})))},labelText:d("noneFulfillment","Non Fulfillment")}))}})),b&&l().createElement(on.Qr,{control:Ee,name:"date",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"date",name:"date",placeholder:K,labelText:d("date","Date"),defaultValue:"",invalid:null==Se||null===(t=Se.date)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.date)||void 0===n?void 0:n.message}))}})),l().createElement("div",{className:Bc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Q},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},d("continue","Continue"))))},Qc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("New Report",l().createElement(Yc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var Jc=n(5861),Wc={};Wc.styleTagTransform=h(),Wc.setAttributes=g(),Wc.insert=p().bind(null,"head"),Wc.domAPI=d(),Wc.insertStyleElement=v(),s()(Jc.Z,Wc);const Vc=Jc.Z&&Jc.Z.locals?Jc.Z.locals:void 0;var Kc=n(6811),Xc=n(3570),$c=n(7149),es={};es.styleTagTransform=h(),es.setAttributes=g(),es.insert=p().bind(null,"head"),es.domAPI=d(),es.insertStyleElement=v(),s()($c.Z,es);const ts=$c.Z&&$c.Z.locals?$c.Z.locals:void 0;var ns=function(e){var t=e.title,n=e.description,r=(0,E.useTranslation)().t;return l().createElement("div",{className:ts.tileContainer},l().createElement(a.n9L,{className:ts.tile},l().createElement("div",{className:ts.tileContent},l().createElement(vt.As,{size:"24"}),l().createElement("p",{className:ts.content},r("noPrivilagesTitle","".concat(t))),n&&l().createElement("p",{className:ts.helper},r("noViewPrivilegesDescription","".concat(n))))))};function rs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function os(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){rs(e,t,n[t])}))}return e}function as(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}var is=n(2033),ls={};ls.styleTagTransform=h(),ls.setAttributes=g(),ls.insert=p().bind(null,"head"),ls.domAPI=d(),ls.insertStyleElement=v(),s()(is.Z,ls);const cs=is.Z&&is.Z.locals?is.Z.locals:void 0;var ss="@openmrs/esm-stock-management-app",us={featureName:"stock-management",moduleName:ss},ds=n(3979),ms=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=e("manageStock","Manage Stock");return l().createElement(a.mh4,null,l().createElement(a.Ohc,{href:window.getOpenmrsSpaBase()+"stock-management",rel:"noopener noreferrer"},l().createElement("div",null,l().createElement("div",{className:"heading"},t),l().createElement("div",{className:"content"},e("stockManagement","Stock Management"))),l().createElement("div",{className:"iconWrapper"},l().createElement(me.ol,{size:16}))))}),us),ps=(0,r.getSyncLifecycle)((function(){return l().createElement(r.LeftNavMenu,null)}),us),As=(0,r.getSyncLifecycle)((function(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(ct,null),l().createElement(ht,null))}),us),gs=(0,r.getSyncLifecycle)(yt({title:"Overview",name:"stock-management"}),us),fs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Jo,null))}),us),vs=(0,r.getSyncLifecycle)(yt({title:"Operations",name:"operations"}),us),_s=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(ml,null))}),us),hs=(0,r.getSyncLifecycle)(yt({title:"Items",name:"items"}),us),bs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Rl,null))}),us),ys=(0,r.getSyncLifecycle)(yt({title:"User role scopes",name:"user-scopes"}),us),ks=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ac,null))}),us),Cs=(0,r.getSyncLifecycle)(yt({title:"Sources",name:"sources"}),us),Es=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Nc,null))}),us),ws=(0,r.getSyncLifecycle)(yt({title:"Locations",name:"locations"}),us),Ss=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/report?v=default"))},n=function(){var e,t,n,o,a,l,c,s="".concat(r.restBaseUrl,"/stockmanagement/batchjob?batchJobType=Report&v=default&limit=10&totalCount=true"),u=(0,j.ZP)(s,r.openmrsFetch),d=u.data,m=u.error,p=u.isLoading,A=(l=(0,i.useState)(10),c=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(l,c)||function(e,t){if(e){if("string"==typeof e)return Pc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pc(e,t):void 0}}(l,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=A[0],f=A[1],v=(0,r.usePagination)(null==d||null===(e=d.data)||void 0===e?void 0:e.results,g),_=v.goTo,h=v.results,b=v.currentPage;return{reports:null!==(a=null==d||null===(t=d.data)||void 0===t?void 0:t.results)&&void 0!==a?a:[],isLoading:p,isError:m,items:h,totalItems:null==d||null===(o=d.data)||void 0===o||null===(n=o.results)||void 0===n?void 0:n.length,currentPage:b,currentPageSize:g,paginatedItems:h,goTo:_,pageSizes:[10,20,30,40,50],setPageSize:f}}(),o=n.reports,c=n.isLoading,s=n.currentPage,u=n.pageSizes,d=n.totalItems,m=n.goTo,p=n.currentPageSize,A=n.setPageSize,g=(0,r.useSession)().user,f=g.privileges.filter((function(e){return"App: stockmanagement.reports"===e.display})).length>0,v=g.privileges.filter((function(e){return"Task: stockmanagement.reports.mutate"===e.display})).length>0,_=(0,i.useMemo)((function(){return[{id:0,header:e("report","Report"),key:"report"},{id:1,header:e("parameters","Parameters"),key:"parameters"},{id:2,header:e("dateRequested","Date Requested"),key:"dateRequested"},{id:3,header:e("requestedBy","Requested By"),key:"requestedBy"},{id:4,header:e("status","Status"),key:"status"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),h=(0,i.useCallback)((function(e,t){e&&window.open(function(e,t){return"".concat(ae,"ws/rest/v1/stockmanagement/batchjobartifact?id=").concat(e).concat("&download=1")}(e),"_blank")}),[]),b=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e){var t,n,r;return as(os({},e),{checkbox:"isBatchJobActive",id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),batchJobType:e.batchJobType,dateRequested:(r=e.dateCreated,r?W()(r).format("DD-MMM-YYYY HH:mm"):""),parameters:"",report:e.description,requestedBy:null==e||null===(t=e.owners)||void 0===t?void 0:t.map((function(t,n){return l().createElement("div",{key:"".concat(e.uuid,"-owner-").concat(n)},"".concat(t.ownerFamilyName," ").concat(t.ownerGivenName))})),status:l().createElement(l().Fragment,null,"Pending"===e.status&&l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Generating report..."}),"Failed"===e.status&&l().createElement(mt.Od,{className:"report-failed",title:e.status}),"Cancelled"===e.status&&l().createElement(Kc.mg,{className:"report-cancelled",title:e.status}),e.status===Rc&&l().createElement(Dr.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(Xc.tK,{className:"report-expired",title:e.status})),actions:l().createElement("div",{key:"".concat(null==e?void 0:e.uuid,"-actions"),style:{display:"inline-block",whiteSpace:"nowrap"}},e.outputArtifactViewable&&"hide"===e.batchJobType&&l().createElement(a.zxk,{key:"".concat(null==e?void 0:e.uuid,"-actions-view"),type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Edit",kind:"ghost",renderIcon:pe.G7}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Copy",kind:"ghost",renderIcon:Me.CK}),(null==e?void 0:e.status)===Rc&&(null!==(n=e.outputArtifactSize)&&void 0!==n?n:0)>0&&l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Download",kind:"ghost",renderIcon:vt.UW,onClick:function(){return h(e.uuid,e.outputArtifactFileExt)}}))})}))}),[o,h]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Vc.tableOverride},l().createElement(a.x45,null,e("ReportDescription","List of reports requested by users")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:b,headers:_,isSortable:!0,useZebraStyles:!0,render:function(n){var o=n.rows,i=n.headers,c=n.getHeaderProps,s=n.getTableProps,u=n.getRowProps,d=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Vc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:t},"Refresh")),v&&l().createElement(Qc,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,as(os({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Vc.desktopHeader:Vc.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,os({className:r.isDesktop?Vc.desktopRow:Vc.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),f?0===o.length?l().createElement("div",{className:Vc.tileContainer},l().createElement(a.n9L,{className:Vc.tile},l().createElement("div",{className:Vc.tileContent},l().createElement("p",{className:Vc.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:Vc.helper},e("checkFilters","Check the filters above"))))):null:l().createElement(ns,{title:"Can not view stock reports",description:"You have no permissions to view reports"}))}}),l().createElement(a.tlE,{page:s,pageSize:p,pageSizes:u,totalItems:d,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==s&&m(n)},className:Vc.paginationOverride}))}),us),Ds=(0,r.getSyncLifecycle)(yt({title:"Reports",name:"reports"}),us),Os=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t;return l().createElement("div",{className:cs.StockSettings},l().createElement("div",{className:cs.title},e("comingSoonUnderDev","Exciting updates are on the way! In the meantime, use the link below to access Admin UI settings.")),l().createElement(a.zxk,{onClick:function(){return(0,r.navigate)({to:"${openmrsBase}/admin/maintenance/settings.list?show=Stockmanagement"})},size:"md",renderIcon:function(){return l().createElement(pe.PG,{className:"cds--btn__icon",size:24})},kind:"ghost"},e("adminSettings","Admin settings")))}),us),xs=(0,r.getSyncLifecycle)(yt({title:"Settings",name:"settings"}),us),Ns=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),us),Is=(0,r.getSyncLifecycle)((function(){var e="".concat(window.spaBase,"/stock-management");return(0,i.useEffect)((function(){return(0,r.setLeftNav)({name:"stock-page-dashboard-slot",basePath:e}),function(){return(0,r.unsetLeftNav)("stock-page-dashboard-slot")}}),[e]),l().createElement("main",{className:"omrs-main-content"},l().createElement(xe.BrowserRouter,{basename:window.spaBase},l().createElement(xe.Routes,null,l().createElement(xe.Route,{path:"/stock-management",element:l().createElement(Ye,null)}),l().createElement(xe.Route,{path:"/stock-management/:dashboard/*",element:l().createElement(Ye,null)}))))}),us),Ts=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.title,c=e.requireReason,s=e.operation,u=e.closeModal,d=o.toLocaleLowerCase().trim(),m=(0,E.useTranslation)().t,p=de((0,i.useState)(""),2),A=p[0],g=p[1],f=de((0,i.useState)(!1),2),v=f[0],_=f[1],h=(t=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(e.preventDefault(),_(!0),t=null,d){case"submit":t="SUBMIT";break;case"dispatch":case"dispatchapproval":t="DISPATCH";break;case"complete":case"completedispatch":t="COMPLETE";break;case"cancel":t="CANCEL";break;case"reject":t="REJECT";break;case"return":t="RETURN";break;case"approve":t="APPROVE"}return t?(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperationaction"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}({name:t,uuid:null==s?void 0:s.uuid,reason:A}).then((function(){_(!1),(0,r.showSnackbar)({title:m("title","".concat(o," Operation")),subtitle:m("successMessage","You have successfully ".concat(o," operation ")),kind:"success"}),u(),Q(),ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))}),(function(e){_(!1);var t=le(e);(0,r.showSnackbar)({title:m("errorDescriptionTitle","Error on saving form"),subtitle:m("errorDescription",t.join(", ")),kind:"error"}),u(),Q()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){ue(a,r,o,i,l,"next",e)}function l(e){ue(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)});return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:P.modalBody},l().createElement("section",{className:P.section},l().createElement("h5",{className:P.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:P.section},l().createElement(a.Kx8,{labelText:m("notes","Please explain the reason:"),id:"nextNotes",name:"nextNotes",invalidText:"Required",maxCount:500,enableCounter:!0,onChange:function(e){return g(e.target.value)}})))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:u},m("cancel","Cancel")),v?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),us),Bs=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:I.productiveHeading03},o("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this source? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-modal",moduleName:ss}),Ps=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:I.productiveHeading03},o("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this User Scope? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-user-scope-modal",moduleName:ss}),Us=(0,r.getSyncLifecycle)((function(e){var t=e.row,n=e.closeModal,o=(0,E.useTranslation)().t,c=Ee(),s=c.mutate,u=c.setStockItemUuid;(0,i.useEffect)((function(){u(t.stockItemUuid)}),[t.stockItemUuid,u]);var d,m,p=(d=(0,i.useState)(""),m=2,function(e){if(Array.isArray(e))return e}(d)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(d,m)||function(e,t){if(e){if("string"==typeof e)return Oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oe(e,t):void 0}}(d,m)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),A=p[0],g=p[1];return l().createElement("div",null,l().createElement(a.xBx,{closeModal:n,className:De.productiveHeading03},o("removePackagingUnit","Remove Packaging Unit"),"?"),l().createElement(a.fef,null,l().createElement("span",null,o("removePackagingUnitConfirmation","Would you really like to remove the packaging unit ".concat(null==t?void 0:t.packagingUomName," from the stock item?"))),l().createElement(a.Kx8,{id:"reason",labelText:o("reasonLabel","Please explain the reason:"),onChange:function(e){g(e.target.value)},maxLength:500,placeholder:o("reasonPlaceholder","Enter reason here")})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:n},o("no","No")),l().createElement(a.zxk,{kind:"danger",type:"submit",onClick:function(e){var a,i,l;e.preventDefault(),(a=t.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(a),l=new AbortController,(0,r.openmrsFetch)(i,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:l.signal})).then((function(){s(),n(),(0,r.showToast)({critical:!0,title:o("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:o("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showNotification)({title:o("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))},disabled:A.length<1},o("yes","Yes"))))}),{featureName:"delete-packaging-unit-modal",moduleName:ss}),js=(0,r.getSyncLifecycle)(Ae,{featureName:"delete-packging-unit-button",moduleName:ss}),zs=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=O((0,i.useState)(),2),c=o[0],s=o[1],u=O((0,i.useState)(!0),2),d=u[0],m=(u[1],O((0,i.useState)(!0),2)),p=(m[0],m[1]);return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:t,title:n("importStockItems","Import Stock Items")}),l().createElement(a.fef,null,l().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"small",onChange:function(e){var t,n,r=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];r?(s(r),p(!1)):e.preventDefault()},onDelete:function(){p(!0)}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:t},n("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(c){var e=new FormData;c&&(e.append("file",c,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,r.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,r.showNotification)({title:n("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}}},n("uploadStockItems","Upload StockItems")))))}),us),Fs=(0,r.getSyncLifecycle)((function(){var e=window.getOpenmrsSpaBase();return l().createElement(a.Ohc,{className:k.customTile,id:"menu-item",href:"".concat(e,"stock-management")},l().createElement("div",{className:"customTileTitle"},l().createElement(C.yG,{size:24})),l().createElement("div",null,"Stock Management"))}),us);function Ls(){(0,r.defineConfigSchema)(ss,o)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};function o(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],o=t[0];return n.e(t[1]).then((()=>n(o)))}o.keys=()=>Object.keys(r),o.id=3979,e.exports=o}}]);
1
+ (globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[474],{3432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__metrics-card__tileContainer___SG_bT{border:.0625rem solid #e0e0e0;flex-grow:1;height:7.875rem;padding:0 .75rem;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;margin-bottom:20px}.-esm-stock-management__metrics-card__tileHeader___sMfyg{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.-esm-stock-management__metrics-card__headerLabel___HyNJ3{font-size:var(--cds-label-02-font-size, 0.875rem);font-weight:var(--cds-label-02-font-weight, 400);line-height:var(--cds-label-02-line-height, 1.28572);letter-spacing:var(--cds-label-02-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__metrics-card__totalsLabel___hyLWP{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252}.-esm-stock-management__metrics-card__totalsValue___CCj27{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);color:#161616}.-esm-stock-management__metrics-card__headerLabelContainer___bVkOu{display:flex;align-items:center;height:2rem;justify-content:space-between;width:100%}.-esm-stock-management__metrics-card__link___qIBqZ{text-decoration:none;display:flex;align-items:flex-end}.-esm-stock-management__metrics-card__metricsGrid___sM6gq{display:grid;grid-template-columns:1fr 1fr}.-esm-stock-management__metrics-card__countGrid___XC66g{display:grid;grid-template-columns:1fr 1fr;justify-self:flex-end;column-gap:.5rem}.-esm-stock-management__metrics-card__countGrid___XC66g>span{font-size:.625rem !important;margin:0;color:#525252}.-esm-stock-management__metrics-card__countGrid___XC66g>p{margin:0}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/card/metrics-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,4DACE,6BAAA,CACA,WAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,kBAAA,CAGF,yDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,mBCCW,CDCb,0DE40BI,iDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CF10BF,aGwBQ,CHtBV,0DEw0BI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CFt0BF,aDvBQ,CCyBV,0DEo0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CFl0BF,aD5BM,CC8BR,mEACE,YAAA,CACA,kBAAA,CACA,WCIW,CDHX,6BAAA,CACA,UAAA,CAEF,mDACE,oBAAA,CACA,YAAA,CACA,oBAAA,CAEF,0DACE,YAAA,CACA,6BAAA,CAEF,wDACE,YAAA,CACA,6BAAA,CACA,qBAAA,CACA,gBCjCW,CDkCX,6DACE,4BAAA,CACA,QAAA,CACA,aGVM,CHYR,0DACE,QAAA",sourceRoot:""}]),i.locals={tileContainer:"-esm-stock-management__metrics-card__tileContainer___SG_bT",tileHeader:"-esm-stock-management__metrics-card__tileHeader___sMfyg",headerLabel:"-esm-stock-management__metrics-card__headerLabel___HyNJ3",totalsLabel:"-esm-stock-management__metrics-card__totalsLabel___hyLWP",totalsValue:"-esm-stock-management__metrics-card__totalsValue___CCj27",headerLabelContainer:"-esm-stock-management__metrics-card__headerLabelContainer___bVkOu",link:"-esm-stock-management__metrics-card__link___qIBqZ",metricsGrid:"-esm-stock-management__metrics-card__metricsGrid___sM6gq",countGrid:"-esm-stock-management__metrics-card__countGrid___XC66g"};const l=i},2296:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__overlay__desktopOverlay___lvJaK{position:fixed;top:3rem;width:100%;right:0;bottom:0;z-index:9;border-left:1px solid #a8a8a8;background-color:#fff;overflow-y:auto;height:calc(100vh - 3rem)}.-esm-stock-management__overlay__desktopOverlay___lvJaK::after{height:100%;border-left:1px solid #a8a8a8}.-esm-stock-management__overlay__tabletOverlay___ThdtE{position:fixed;top:0;bottom:0;left:0;right:0;z-index:9999;background-color:#f4f4f4;overflow-y:scroll;-ms-overflow-style:none;scrollbar-width:none}.-esm-stock-management__overlay__tabletOverlay___ThdtE::-webkit-scrollbar{width:0}.-esm-stock-management__overlay__tabletOverlay___ThdtE>div{margin-top:3rem}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O button{background-color:#005d5d;background-color:var(--brand-01)}.-esm-stock-management__overlay__tabletOverlayHeader___T3x8O .-esm-stock-management__overlay__headerContent___YYBKM{color:#fff}.-esm-stock-management__overlay__desktopHeader___Ueq0h{display:flex;justify-content:space-between;align-items:center;background-color:#e0e0e0;border-bottom:1px solid #a8a8a8;position:sticky;position:-webkit-sticky;width:100%;z-index:1000;top:0}.-esm-stock-management__overlay__headerContent___YYBKM{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);padding:0 1rem;color:#161616}.-esm-stock-management__overlay__closeButton___JYFSq{background-color:#fff;color:#161616;fill:#161616}.omrs-breakpoint-gt-tablet .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.omrs-breakpoint-lt-desktop .-esm-stock-management__overlay__overlayContent___QyXjy{padding:0 0 0 0;overflow-y:auto}.cds--list-box__menu{z-index:20000}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/overlay/overlay.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,wDACE,cAAA,CACA,QC6CW,CD5CX,UAAA,CACA,OAAA,CACA,QAAA,CACA,SAAA,CACA,6BAAA,CACA,qBAAA,CACA,eAAA,CACA,yBAAA,CAGF,+DACE,WAAA,CACA,6BAAA,CAGF,uDACE,cAAA,CACA,KAAA,CACA,QAAA,CACA,MAAA,CACA,OAAA,CACA,YAAA,CACA,wBD7BM,CC8BN,iBAAA,CACA,uBAAA,CACA,oBAAA,CAEA,0EACE,OAAA,CAGF,2DACE,eCYS,CDPX,oEDNA,wBAAA,CACA,gCAAA,CCSA,oHACE,UDhDI,CCoDR,uDACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,wBDvDM,CCwDN,+BAAA,CACA,eAAA,CACA,uBAAA,CACA,UAAA,CACA,YAAA,CACA,KAAA,CAGF,uDEgyBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF9xBF,cAAA,CACA,aDjEM,CCoER,qDACE,qBDlEc,CCmEd,aDtEM,CCuEN,YDvEM,CC4EN,mFACE,eAAA,CACA,eAAA,CAMF,oFACE,eAAA,CACA,eAAA,CAKJ,qBACE,aAAA",sourceRoot:""}]),i.locals={desktopOverlay:"-esm-stock-management__overlay__desktopOverlay___lvJaK",tabletOverlay:"-esm-stock-management__overlay__tabletOverlay___ThdtE",tabletOverlayHeader:"-esm-stock-management__overlay__tabletOverlayHeader___T3x8O",headerContent:"-esm-stock-management__overlay__headerContent___YYBKM",desktopHeader:"-esm-stock-management__overlay__desktopHeader___Ueq0h",closeButton:"-esm-stock-management__overlay__closeButton___JYFSq",overlayContent:"-esm-stock-management__overlay__overlayContent___QyXjy"};const l=i},7149:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__privilages__content___UE9bQ{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__privilages__helper___EblpR{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__privilages__tileContainer___K6_qc{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__privilages__tile___zojuU{margin:auto;width:fit-content}.-esm-stock-management__privilages__tileContent___hG2dp{display:flex;flex-direction:column;align-items:center}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/privilages-component/privilages.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,oDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,mDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,0DACE,qBDfM,CCgBN,4BAAA,CACA,cAAA,CAGF,iDACE,WAAA,CACA,iBAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__privilages__content___UE9bQ",helper:"-esm-stock-management__privilages__helper___EblpR",tileContainer:"-esm-stock-management__privilages__tileContainer___K6_qc",tile:"-esm-stock-management__privilages__tile___zojuU",tileContent:"-esm-stock-management__privilages__tileContent___hG2dp"};const l=i},4655:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__table__widgetContainer___cZm_L{background-color:#fff}.-esm-stock-management__table__widgetHeaderContainer___mn6uH{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem}.-esm-stock-management__table__widgetHeaderContainer___mn6uH>h4:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-01)}.-esm-stock-management__table__toggleButtons___cvBSx{width:fit-content;margin:0 .5rem}.-esm-stock-management__table__searchField___XUf8e{width:100%;max-width:250px;border:0px !important}.-esm-stock-management__table__searchBox___pXQzl{width:100%;display:flex;justify-content:right}.-esm-stock-management__table__container___Kypy0{margin-top:16px;margin-left:inherit;width:100%;overflow-y:hidden}.-esm-stock-management__table__tabContainer___E9h5_{margin-top:16px;padding-left:1rem;background-color:#fff}.-esm-stock-management__table__itemListSearch___I6xcT{margin-right:10px;padding-left:20px;max-width:16rem}.-esm-stock-management__table__itemListSearch___I6xcT input{background-color:#fff !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tileContainer___ZrvLt{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__table__tile___peYeA{margin:auto;width:fit-content}.-esm-stock-management__table__tileContent___WuPqi{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__table__menuItem___Sy4dM{max-width:none}.-esm-stock-management__table__radioButtonGroup___jCXKy{display:flex;flex-direction:column;align-items:flex-start;margin-top:.5rem;min-height:4rem;width:100%;font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-stock-management__table__radioButton____RBAw{padding:.25rem .25rem;margin:.5rem 0}.-esm-stock-management__table__section___tNn_U{margin:.5rem}.-esm-stock-management__table__sectionTitle___UBtqA{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__table__modalBody___QNIO4{padding-bottom:1rem}.-esm-stock-management__table__tabContainer___E9h5_ div[role=tabpanel]{padding:0 !important}.-esm-stock-management__table__tabContainer___E9h5_ li button{width:100% !important}.-esm-stock-management__table__tableContainer___rZgtk{margin:0;padding:0}.-esm-stock-management__table__search___ybQU1{max-width:16rem}.-esm-stock-management__table__search___ybQU1 input{background-color:#fff !important}.-esm-stock-management__table__tableContainer___rZgtk{background-color:#f4f4f4}.-esm-stock-management__table__tableContainer___rZgtk a{text-decoration:none}.-esm-stock-management__table__tableContainer___rZgtk tr{width:.125rem}.-esm-stock-management__table__tableContainer___rZgtk .-esm-stock-management__table__toolbarContent___XsHBI{height:3rem}.-esm-stock-management__table__cds--table-sort__description___Gup5c{display:none}.-esm-stock-management__table__itemListDownload___loZ4q{margin-top:10px}.-esm-stock-management__table__content___qLKKH{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__table__helper___ZKdW1{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/table/table.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDACE,qBDCc,CCEhB,6DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CAGF,sEACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,qDACE,iBAAA,CACA,cAAA,CAGF,mDACE,UAAA,CACA,eAAA,CACA,qBAAA,CAGF,iDACE,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,iDACE,eAAA,CACA,mBAAA,CACA,UAAA,CACA,iBAAA,CAGF,oDACE,eAAA,CACA,iBAAA,CACA,qBAAA,CAGF,sDACE,iBAAA,CACA,iBAAA,CACA,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,qBAAA,CAGF,qDACE,qBDpEM,CCqEN,4BAAA,CACA,cAAA,CAGF,4CACE,WAAA,CACA,iBAAA,CAGF,mDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,gDACE,cAAA,CAGF,wDACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,gBCxEW,CDyEX,eCtCW,CDuCX,UAAA,CEmwBE,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CF/vBJ,mDACE,qBAAA,CACA,cAAA,CAGF,+CACE,YCpFW,CDuFb,oDEsvBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFpvBF,aG9DQ,CH+DR,oBCrFW,CDwFb,iDACE,mBCpFW,CDuFb,uEACE,oBAAA,CAGF,8DACE,qBAAA,CAGF,sDACE,QAAA,CACA,SAAA,CAGF,8CACE,eAAA,CAEA,oDACE,gCAAA,CAIJ,sDACE,wBD5IM,CC8IN,wDACE,oBAAA,CAGF,yDACE,aCxIS,CD2IX,4GACE,WCpGS,CDwGb,oEACE,YAAA,CAGF,wDACE,eAAA,CAGF,+CE+rBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF7rBF,aDhKQ,CCiKR,mBAAA,CAGF,8CEyrBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFvrBF,aDtKQ",sourceRoot:""}]),i.locals={widgetContainer:"-esm-stock-management__table__widgetContainer___cZm_L",widgetHeaderContainer:"-esm-stock-management__table__widgetHeaderContainer___mn6uH",toggleButtons:"-esm-stock-management__table__toggleButtons___cvBSx",searchField:"-esm-stock-management__table__searchField___XUf8e",searchBox:"-esm-stock-management__table__searchBox___pXQzl",container:"-esm-stock-management__table__container___Kypy0",tabContainer:"-esm-stock-management__table__tabContainer___E9h5_",itemListSearch:"-esm-stock-management__table__itemListSearch___I6xcT",tileContainer:"-esm-stock-management__table__tileContainer___ZrvLt",tile:"-esm-stock-management__table__tile___peYeA",tileContent:"-esm-stock-management__table__tileContent___WuPqi",menuItem:"-esm-stock-management__table__menuItem___Sy4dM",radioButtonGroup:"-esm-stock-management__table__radioButtonGroup___jCXKy",radioButton:"-esm-stock-management__table__radioButton____RBAw",section:"-esm-stock-management__table__section___tNn_U",sectionTitle:"-esm-stock-management__table__sectionTitle___UBtqA",modalBody:"-esm-stock-management__table__modalBody___QNIO4",tableContainer:"-esm-stock-management__table__tableContainer___rZgtk",search:"-esm-stock-management__table__search___ybQU1",toolbarContent:"-esm-stock-management__table__toolbarContent___XsHBI","cds--table-sort__description":"-esm-stock-management__table__cds--table-sort__description___Gup5c",itemListDownload:"-esm-stock-management__table__itemListDownload___loZ4q",content:"-esm-stock-management__table__content___qLKKH",helper:"-esm-stock-management__table__helper___ZKdW1"};const l=i},5260:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__vertical-tabs__heading___dsNAK{font-size:var(--cds-productive-heading-02-font-size, 1rem);font-weight:var(--cds-productive-heading-02-font-weight, 600);line-height:var(--cds-productive-heading-02-line-height, 1.375);letter-spacing:var(--cds-productive-heading-02-letter-spacing, 0);color:#525252;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__heading___dsNAK:after{content:"";display:block;width:2rem;padding-top:.188rem;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__vertical-tabs__mainContainer___V_jej{padding-bottom:1.5rem;background:#f4f4f4;display:flex;justify-content:center}.-esm-stock-management__vertical-tabs__title___hZ4AW{padding:1rem;font-size:1.2rem}.-esm-stock-management__vertical-tabs__desktopContainer____twGN{width:50%}.-esm-stock-management__vertical-tabs__tabletContainer___FQsU6{width:90%}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--date-picker.cds--date-picker--single .cds--date-picker__input{width:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab-content{width:100% !important;padding:0}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tab--list{flex-direction:column}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs{width:auto;max-height:20rem;display:flex;flex-direction:column;flex:1}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__panel{height:100%;overflow-y:auto}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-link{border-bottom:0;border-left:3px solid #e0e0e0;line-height:3.5}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs .cds--tabs__nav-item--selected{border-left:3px solid var(--brand-03);border-bottom:0;font-weight:600}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link{max-height:4rem}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:active,.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--tabs__nav-link:focus{outline:0 !important;outline-offset:0 !important}.-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy .cds--col{padding-left:0;width:100%}.-esm-stock-management__vertical-tabs__tabletTab___PHxHJ{width:25%}.-esm-stock-management__vertical-tabs__desktopTab___jh9Dp{width:20%}.-esm-stock-management__vertical-tabs__tab___IFWR5{display:flex}.-esm-stock-management__vertical-tabs__tabContainer___hu3KQ{background:#fff;padding-left:1.5rem;padding-right:1rem;padding-top:1rem;margin-bottom:1rem}.-esm-stock-management__vertical-tabs__optionCell___oFvY9{padding:0 !important}.-esm-stock-management__vertical-tabs__optionHeader___avuuO{width:1.5rem !important}.-esm-stock-management__vertical-tabs__text___VSinM{font-size:.9rem;padding:.5rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/core/components/tabs/vertical-tabs.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,uDC61BI,0DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CD31BF,aEyCQ,CFxCR,kBGuBW,CHnBb,6DACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,mBAAA,CACA,2CAAA,CAGF,6DACE,qBAAA,CACA,kBDtBM,CCuBN,YAAA,CACA,sBAAA,CAGF,qDACE,YAAA,CACA,gBAAA,CAGF,gEACE,SAAA,CAGF,+DACE,SAAA,CAIA,iIACE,UAAA,CAGF,+EACE,qBAAA,CACA,SAAA,CAGF,6EACE,qBAAA,CAGF,wEACE,UAAA,CACA,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,MAAA,CAGF,+EACE,WAAA,CACA,eAAA,CAGF,6FACE,eAAA,CACA,6BAAA,CACA,eAAA,CAGF,uGACE,qCAAA,CACA,eAAA,CACA,eAAA,CAGF,kFAQE,eAAA,CANA,iLAEE,oBAAA,CACA,2BAAA,CAMJ,uEACE,cAAA,CACA,UAAA,CAIJ,yDACE,SAAA,CAGF,0DACE,SAAA,CAGF,mDACE,YAAA,CAGF,4DACE,eAAA,CACA,mBAAA,CACA,kBAAA,CACA,gBAAA,CACA,kBAAA,CAGF,0DACE,oBAAA,CAGF,4DACE,uBAAA,CAGF,oDACE,eAAA,CACA,aAAA",sourceRoot:""}]),i.locals={heading:"-esm-stock-management__vertical-tabs__heading___dsNAK",mainContainer:"-esm-stock-management__vertical-tabs__mainContainer___V_jej",title:"-esm-stock-management__vertical-tabs__title___hZ4AW",desktopContainer:"-esm-stock-management__vertical-tabs__desktopContainer____twGN",tabletContainer:"-esm-stock-management__vertical-tabs__tabletContainer___FQsU6",cohortBuilder:"-esm-stock-management__vertical-tabs__cohortBuilder___yGPdy",tabletTab:"-esm-stock-management__vertical-tabs__tabletTab___PHxHJ",desktopTab:"-esm-stock-management__vertical-tabs__desktopTab___jh9Dp",tab:"-esm-stock-management__vertical-tabs__tab___IFWR5",tabContainer:"-esm-stock-management__vertical-tabs__tabContainer___hu3KQ",optionCell:"-esm-stock-management__vertical-tabs__optionCell___oFvY9",optionHeader:"-esm-stock-management__vertical-tabs__optionHeader___avuuO",text:"-esm-stock-management__vertical-tabs__text___VSinM"};const l=i},3011:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ{display:flex}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD{display:flex;flex-grow:1;flex-direction:column;margin:0;margin-left:16rem;background-color:#f4f4f4}.-esm-stock-management__home-dashboard__dashboardContainer___FvpUD a{width:100%}.-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx{flex-grow:1}.-esm-stock-management__home-dashboard__logoSection___oYB2c{display:flex;justify-content:center}","",{version:3,sources:["webpack://./src/dashboard/home-dashboard.scss","webpack://./node_modules/@carbon/colors/index.scss"],names:[],mappings:"AAGA,gEACE,YAAA,CAGF,mEACE,YAAA,CACA,WAAA,CACA,qBAAA,CACA,QAAA,CACA,iBAAA,CACA,wBC6BQ,CD3BR,qEACE,UAAA,CAIJ,yEACE,WAAA,CAGF,4DACE,YAAA,CACA,sBAAA",sourceRoot:""}]),i.locals={homePageWrapper:"-esm-stock-management__home-dashboard__homePageWrapper___HUYIJ",dashboardContainer:"-esm-stock-management__home-dashboard__dashboardContainer___FvpUD",dashboardContainerTablet:"-esm-stock-management__home-dashboard__dashboardContainerTablet___nipPx",logoSection:"-esm-stock-management__home-dashboard__logoSection___oYB2c"};const l=i},49:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__root__productiveHeading01___qz04k{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__root__productiveHeading02___P86oI{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading03___ad2Jr{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading04____lfRk{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading05___BiHXj{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__root__productiveHeading06___fCUbs{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__root__bodyShort01___qFZKo{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__root__helperText01___l9eBE{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__root__bodyShort02___e318z{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__root__bodyLong01___hajrO{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__root__bodyLong02___rbPh9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__root__label01___B9Vra{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__root__text02___HK43C{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__root__container___Rf8rX{padding:2rem}.-esm-stock-management__root__formContainer___YM692{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__root__verticalForm___EFCw7{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__root__verticalForm___EFCw7 .cds--form-item{flex:none !important}.-esm-stock-management__root__verticalForm___EFCw7 .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0DC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,0DC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,0DCs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,0DCk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,0DC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,0DC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,kDCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,mDCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,kDC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,iDC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,iDCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,8CCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,6CACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,gDACE,YEpCW,CFuCb,oDACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,mDACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,mEACE,oBAAA,CAGF,+DACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__root__productiveHeading01___qz04k",productiveHeading02:"-esm-stock-management__root__productiveHeading02___P86oI",productiveHeading03:"-esm-stock-management__root__productiveHeading03___ad2Jr",productiveHeading04:"-esm-stock-management__root__productiveHeading04____lfRk",productiveHeading05:"-esm-stock-management__root__productiveHeading05___BiHXj",productiveHeading06:"-esm-stock-management__root__productiveHeading06___fCUbs",bodyShort01:"-esm-stock-management__root__bodyShort01___qFZKo",helperText01:"-esm-stock-management__root__helperText01___l9eBE",bodyShort02:"-esm-stock-management__root__bodyShort02___e318z",bodyLong01:"-esm-stock-management__root__bodyLong01___hajrO",bodyLong02:"-esm-stock-management__root__bodyLong02___rbPh9",label01:"-esm-stock-management__root__label01___B9Vra",text02:"-esm-stock-management__root__text02___HK43C",container:"-esm-stock-management__root__container___Rf8rX",formContainer:"-esm-stock-management__root__formContainer___YM692",verticalForm:"-esm-stock-management__root__verticalForm___EFCw7"};const l=i},7813:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__item__customTile___pTLBA{background-color:#f0f0f0;border-radius:4px;padding:20px;width:50px;height:100px;text-align:center;margin:2px}.-esm-stock-management__item__customTileTitle___DoQk8{font-size:14px;color:#333}","",{version:3,sources:["webpack://./src/stock-app-menu-item/item.scss"],names:[],mappings:"AACA,iDACI,wBAAA,CACA,iBAAA,CACA,YAAA,CACA,UAAA,CACA,YAAA,CACA,iBAAA,CACA,UAAA,CAGF,sDACE,cAAA,CACA,UAAA",sourceRoot:""}]),i.locals={customTile:"-esm-stock-management__item__customTile___pTLBA",customTileTitle:"-esm-stock-management__item__customTileTitle___DoQk8"};const l=i},8629:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home-detail-card__container___mESY0,.-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT,.-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk{margin:2rem 0}.-esm-stock-management__stock-home-detail-card__tilesContainer___blppR{background-color:#fff;border:1px solid #e0e0e0;border-bottom:none;width:100%;margin:0 auto;max-width:95vw;padding-bottom:0}.-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV{display:flex;justify-content:space-between;align-items:center;padding:.75rem 0 .75rem 1rem;background-color:#fff}.-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL section{position:relative}.-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL a{text-decoration:none}.-esm-stock-management__stock-home-detail-card__pagination___sPPID{overflow:hidden}.-esm-stock-management__stock-home-detail-card__pagination___sPPID.cds--pagination{border-top:none}.-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa{display:none}.-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc{width:100%;max-width:768px;margin:1rem auto}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1>td>div{max-height:max-content !important}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 td{padding:0 2rem}.-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1 th[colspan] td[colspan]>div:first-child{padding:0 1rem}.-esm-stock-management__stock-home-detail-card__action___Ul5A5{margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__illo___Wm7vk{margin-top:1rem}.-esm-stock-management__stock-home-detail-card__content___Q2X06{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h{text-align:left;text-transform:capitalize}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3 h4:after,.-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid;border-bottom-color:#007d79;border-bottom-color:var(--brand-03)}.-esm-stock-management__stock-home-detail-card__tile___apXYV{text-align:center;border:1px solid #e0e0e0}.-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM{display:flex;justify-content:center;align-items:center;padding:1rem;margin:3rem;text-align:center}.-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i{margin:auto}.-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N{display:flex;margin:0 auto}.-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N>*{flex:1;margin:8px 8px}.-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm{display:flex;flex-direction:column}.-esm-stock-management__stock-home-detail-card__card___WYEgl{display:flex;border:1px solid #ccc;margin:10px;background-color:#f4f4f4}.-esm-stock-management__stock-home-detail-card__icon___JI7mq{margin-right:23px}.-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky{width:5px;background-color:#f1c21b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF{width:5px;background-color:#0f62fe;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z{width:5px;background-color:#ff832b;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU{width:5px;background-color:#198038;margin-right:10px}.-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB{width:5px;background-color:#da1e28;margin-right:10px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr{margin-top:5px;margin-bottom:5px}.-esm-stock-management__stock-home-detail-card__cardText____XcXr p{font-size:.9em;color:#525252}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home-detail-card.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,sNACE,aAAA,CAQF,uEACE,qBDbM,CCcN,wBAAA,CACA,kBAAA,CACA,UAAA,CACA,aAAA,CACA,cAAA,CACA,gBAAA,CAGF,wEACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,4BAAA,CACA,qBD3BM,CC8BR,wFACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,+EACE,iBAAA,CAGF,yEACE,oBAAA,CAGF,mEACE,eAAA,CAEA,mFACE,eAAA,CAIJ,kEACE,YAAA,CAGF,iEACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,8EACE,UAAA,CACA,eAAA,CACA,gBAAA,CAGF,sFACE,iCAAA,CAGF,kFACE,cAAA,CAGF,uHACE,cAAA,CAGF,+DACE,mBC9DW,CDiEb,6DACE,eCxDW,CD2Db,gEEwwBI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CFtwBF,aDvFQ,CCwFR,eC9DW,CD+DX,mBCzEW,CD4Eb,6IAEE,eAAA,CACA,yBAAA,CAEA,mJE4vBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CF1vBA,aDnGM,CCqGN,+JACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2BAAA,CD/DJ,2BAAA,CACA,mCAAA,CCoEF,6DACE,iBAAA,CACA,wBAAA,CAGF,yEACE,YAAA,CACA,sBAAA,CACA,kBAAA,CACA,YC/FW,CDgGX,WC5EW,CD6EX,iBAAA,CAGF,6EACE,WAAA,CAGF,gFE2tBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFztBF,aDpIQ,CCqIR,mBAAA,CAGF,+EEqtBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CFntBF,aD1IQ,CC6IV,sEACE,YAAA,CACA,aAAA,CAGF,wEACE,MAAA,CACA,cAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CAGF,6DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,wBAAA,CAGF,6DACE,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,sEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,wEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,uEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,qEACE,SAAA,CACA,wBAAA,CACA,iBAAA,CAGF,iEACE,cAAA,CACA,iBAAA,CAGF,mEACE,cAAA,CACA,aAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-home-detail-card__container___mESY0",emptyStateContainer:"-esm-stock-management__stock-home-detail-card__emptyStateContainer___OKbLT",loaderContainer:"-esm-stock-management__stock-home-detail-card__loaderContainer___gGPuk",tilesContainer:"-esm-stock-management__stock-home-detail-card__tilesContainer___blppR",headerContainer:"-esm-stock-management__stock-home-detail-card__headerContainer___C3_bV",backgroundDataFetchingIndicator:"-esm-stock-management__stock-home-detail-card__backgroundDataFetchingIndicator___wrwp_",tableContainer:"-esm-stock-management__stock-home-detail-card__tableContainer___M8sDL",pagination:"-esm-stock-management__stock-home-detail-card__pagination___sPPID",hiddenRow:"-esm-stock-management__stock-home-detail-card__hiddenRow___YoKHa",emptyRow:"-esm-stock-management__stock-home-detail-card__emptyRow___TLa4s",visitSummaryContainer:"-esm-stock-management__stock-home-detail-card__visitSummaryContainer___oAlTc",expandedActiveVisitRow:"-esm-stock-management__stock-home-detail-card__expandedActiveVisitRow___xkLH1",action:"-esm-stock-management__stock-home-detail-card__action___Ul5A5",illo:"-esm-stock-management__stock-home-detail-card__illo___Wm7vk",content:"-esm-stock-management__stock-home-detail-card__content___Q2X06",desktopHeading:"-esm-stock-management__stock-home-detail-card__desktopHeading___ztNj3",tabletHeading:"-esm-stock-management__stock-home-detail-card__tabletHeading___BSZ1h",tile:"-esm-stock-management__stock-home-detail-card__tile___apXYV",filterEmptyState:"-esm-stock-management__stock-home-detail-card__filterEmptyState___xwbLM",filterEmptyStateTile:"-esm-stock-management__stock-home-detail-card__filterEmptyStateTile___PDk6i",filterEmptyStateContent:"-esm-stock-management__stock-home-detail-card__filterEmptyStateContent___wS8z0",filterEmptyStateHelper:"-esm-stock-management__stock-home-detail-card__filterEmptyStateHelper___ircIN",cardContainer:"-esm-stock-management__stock-home-detail-card__cardContainer___L_H7N",cardContainerBig:"-esm-stock-management__stock-home-detail-card__cardContainerBig___ddtbm",card:"-esm-stock-management__stock-home-detail-card__card___WYEgl",icon:"-esm-stock-management__stock-home-detail-card__icon___JI7mq",colorLineYellow:"-esm-stock-management__stock-home-detail-card__colorLineYellow___iJnky",colorLineBlue:"-esm-stock-management__stock-home-detail-card__colorLineBlue___kWxvF",colorLineOrange:"-esm-stock-management__stock-home-detail-card__colorLineOrange___AtZ7Z",colorLineGreen:"-esm-stock-management__stock-home-detail-card__colorLineGreen___BbRKU",colorLineRed:"-esm-stock-management__stock-home-detail-card__colorLineRed___Rr5JB",cardText:"-esm-stock-management__stock-home-detail-card__cardText____XcXr"};const l=i},2426:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-home__cardContainer___n7Lxz{background-color:#fff;display:flex;justify-content:space-between;margin:0 1rem 0 1rem;flex-flow:row wrap;column-gap:1rem;row-gap:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-home/stock-home.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,0DACE,qBCIM,CDHN,YAAA,CACA,6BAAA,CACA,oBAAA,CACA,kBAAA,CACA,eEqBW,CFpBX,YEoBW",sourceRoot:""}]),i.locals={cardContainer:"-esm-stock-management__stock-home__cardContainer___n7Lxz"};const l=i},4158:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__packaging-units__packingTable___ceosy{min-height:15rem;display:block}.-esm-stock-management__packaging-units__packingTableCell___KYLlI{display:flex;align-items:center}.-esm-stock-management__packaging-units__packagingTableBody___o7eKF{min-height:10rem}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6{padding-bottom:1rem;min-height:15rem;display:block}.-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6 .cds--data-table-content{overflow-x:visible}.-esm-stock-management__packaging-units__searchAndSave___iglHk{display:flex;flex-direction:column;align-items:flex-start}.-esm-stock-management__packaging-units__searchAndSave___iglHk .-esm-stock-management__packaging-units__submitButton___DIyGx{margin-top:1rem}.-esm-stock-management__packaging-units__deleteModal___T_iKq .cds--modal-container.cds--modal-container--sm .cds--modal-content .cds--form-item{margin-top:1rem}.-esm-stock-management__packaging-units__packageUnitsBtn___uapVg{display:flex;justify-content:flex-end;margin-right:2rem}cds--form-item{margin-top:1rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/packaging-units/packaging-units.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,8DACE,gBAAA,CACA,aAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CAGF,oEACE,gBCwDW,CDrDb,yEACE,mBAAA,CACA,gBAAA,CACA,aAAA,CAEA,kGACE,kBAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,6HACE,eAAA,CAOE,gJACE,eAAA,CAMR,iEACE,YAAA,CACA,wBAAA,CACA,iBAAA,CAGF,eACE,eAAA",sourceRoot:""}]),i.locals={packingTable:"-esm-stock-management__packaging-units__packingTable___ceosy",packingTableCell:"-esm-stock-management__packaging-units__packingTableCell___KYLlI",packagingTableBody:"-esm-stock-management__packaging-units__packagingTableBody___o7eKF",packagingTableContainer:"-esm-stock-management__packaging-units__packagingTableContainer___kSbZ6",searchAndSave:"-esm-stock-management__packaging-units__searchAndSave___iglHk",submitButton:"-esm-stock-management__packaging-units__submitButton___DIyGx",deleteModal:"-esm-stock-management__packaging-units__deleteModal___T_iKq",packageUnitsBtn:"-esm-stock-management__packaging-units__packageUnitsBtn___uapVg"};const l=i},501:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-item-references__referencesTable___WAMHe{min-height:15rem;display:block}.-esm-stock-management__stock-item-references__referencesTableCell___NGIOb{display:flex;align-items:center}.-esm-stock-management__stock-item-references__referencesTableBody___HreAO{min-height:10rem}.-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw{min-height:15rem;display:block}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAIA,uEACE,gBAAA,CACA,aAAA,CAGF,2EACE,YAAA,CACA,kBAAA,CAGF,2EACE,gBCwDW,CDpDb,gFACE,gBAAA,CACA,aAAA",sourceRoot:""}]),i.locals={referencesTable:"-esm-stock-management__stock-item-references__referencesTable___WAMHe",referencesTableCell:"-esm-stock-management__stock-item-references__referencesTableCell___NGIOb",referencesTableBody:"-esm-stock-management__stock-item-references__referencesTableBody___HreAO",referencesTableContainer:"-esm-stock-management__stock-item-references__referencesTableContainer___z4SLw"};const l=i},4563:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-rules__section___ggL6B{margin:.5rem}.-esm-stock-management__add-stock-rules__sectionTitle___fsf7E{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-rules__modalBody___DXCqE{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,yDACE,YCgBW,CDbb,8DE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,2DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-rules__section___ggL6B",sectionTitle:"-esm-stock-management__add-stock-rules__sectionTitle___fsf7E",modalBody:"-esm-stock-management__add-stock-rules__modalBody___DXCqE"};const l=i},4907:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-rules-filter__filterContainer___eskQ5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-items/add-stock-item/stock-item-rules/stock-rules-filter.scss"],names:[],mappings:"AACI,oGACE,KAAA,CAGF,8FACE,WAAA,CAGF,iHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-rules-filter__filterContainer___eskQ5"};const l=i},1048:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__filter-stock-items__spacing___pZHZK{margin:0 16px}","",{version:3,sources:["webpack://./src/stock-items/components/filter-stock-items/filter-stock-items.scss"],names:[],mappings:"AAAA,4DACI,aAAA",sourceRoot:""}]),i.locals={spacing:"-esm-stock-management__filter-stock-items__spacing___pZHZK"};const l=i},1535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}:root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-items-table__productiveHeading01___MPnNp{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__productiveHeading02___E1KiC{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading03___N33sp{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading04___lh7n8{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading05___ieA0n{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-items-table__productiveHeading06___JPMyX{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__helperText01___uOks4{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__bodyShort02___d7A67{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__bodyLong01____Gl3H{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-items-table__bodyLong02___Dwoe9{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-items-table__label01___ANQCM{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-items-table__text02___ac1IL{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-items-table__container___VONiZ{padding:2rem}.-esm-stock-management__stock-items-table__formContainer___o0XL5{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-items-table__verticalForm___oOj2I{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--form-item{flex:none !important}.-esm-stock-management__stock-items-table__verticalForm___oOj2I .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-items-table__tileContainer___N1eHZ{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-items-table__tile___ZZNjt{margin:auto;width:fit-content}.-esm-stock-management__stock-items-table__tileContent___SC542{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-items-table__content___zdm4U{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-items-table__helper___kKhcQ{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-items-table__separator___JXP1R{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-items-table__separator___JXP1R::before,.-esm-stock-management__stock-items-table__separator___JXP1R::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-items-table__separator___JXP1R::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-items-table__separator___JXP1R::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-items-table__toolbarContent___oBPmt{display:flex;align-items:center}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center}.-esm-stock-management__stock-items-table__dateAlign___RNWUI{padding-top:.5rem;height:100%}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL{padding-bottom:.5rem}.-esm-stock-management__stock-items-table__filtersAlign___TaNrL .cds--list-box__menu{min-width:15rem;z-index:1}.-esm-stock-management__stock-items-table__filterContainer___hAyU2{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-items/stock-items-table.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CAHF,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,uEC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,uEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,uECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,uECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,uEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,uEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,+DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,gECkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,+DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,8DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,8DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,2DCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,0DACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,6DACE,YEpCW,CFuCb,iEACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,gEACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,gFACE,oBAAA,CAGF,4EACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGpGJ,sEACE,qBHEc,CGDd,YDwBW,CCvBX,gBAAA,CAGF,iEACE,qBHPM,CGQN,4BAAA,CACA,cAAA,CAGF,wDACE,WAAA,CACA,iBAAA,CAGF,+DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,2DFs0BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CEp0BF,aJzBQ,CI0BR,mBAAA,CAGF,0DFg0BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CE9zBF,aJ/BQ,CIkCV,6DF2zBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CEzzBF,aJpCQ,CIqCR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,yIAEE,wBJ3CM,CI4CN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,qEACE,WAAA,CACA,gBAAA,CAGF,oEACE,UAAA,CACA,iBAAA,CAIJ,kEACE,YAAA,CACA,kBAAA,CAGF,mEACE,YAAA,CACA,kBAAA,CAGF,6DACE,iBD3DW,CC4DX,WAAA,CAGF,gEACE,oBDhEW,CCkEX,qFACE,eAAA,CACA,SAAA,CAIJ,mEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,kBDlEW",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-items-table__productiveHeading01___MPnNp",productiveHeading02:"-esm-stock-management__stock-items-table__productiveHeading02___E1KiC",productiveHeading03:"-esm-stock-management__stock-items-table__productiveHeading03___N33sp",productiveHeading04:"-esm-stock-management__stock-items-table__productiveHeading04___lh7n8",productiveHeading05:"-esm-stock-management__stock-items-table__productiveHeading05___ieA0n",productiveHeading06:"-esm-stock-management__stock-items-table__productiveHeading06___JPMyX",bodyShort01:"-esm-stock-management__stock-items-table__bodyShort01___Z8ZwK",helperText01:"-esm-stock-management__stock-items-table__helperText01___uOks4",bodyShort02:"-esm-stock-management__stock-items-table__bodyShort02___d7A67",bodyLong01:"-esm-stock-management__stock-items-table__bodyLong01____Gl3H",bodyLong02:"-esm-stock-management__stock-items-table__bodyLong02___Dwoe9",label01:"-esm-stock-management__stock-items-table__label01___ANQCM",text02:"-esm-stock-management__stock-items-table__text02___ac1IL",container:"-esm-stock-management__stock-items-table__container___VONiZ",formContainer:"-esm-stock-management__stock-items-table__formContainer___o0XL5",verticalForm:"-esm-stock-management__stock-items-table__verticalForm___oOj2I",headerBtnContainer:"-esm-stock-management__stock-items-table__headerBtnContainer___bXD1p",tileContainer:"-esm-stock-management__stock-items-table__tileContainer___N1eHZ",tile:"-esm-stock-management__stock-items-table__tile___ZZNjt",tileContent:"-esm-stock-management__stock-items-table__tileContent___SC542",content:"-esm-stock-management__stock-items-table__content___zdm4U",helper:"-esm-stock-management__stock-items-table__helper___kKhcQ",separator:"-esm-stock-management__stock-items-table__separator___JXP1R",toolbarContent:"-esm-stock-management__stock-items-table__toolbarContent___oBPmt",filterContainer:"-esm-stock-management__stock-items-table__filterContainer___hAyU2",dateAlign:"-esm-stock-management__stock-items-table__dateAlign___RNWUI",filtersAlign:"-esm-stock-management__stock-items-table__filtersAlign___TaNrL"};const l=i},2761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_{margin-bottom:150px}","",{version:3,sources:["webpack://./src/stock-locations/stock-locations-table.scss"],names:[],mappings:"AAAA,uEACE,mBAAA",sourceRoot:""}]),i.locals={loaderContainer:"-esm-stock-management__stock-locations-table__loaderContainer___kdzQ_"};const l=i},965:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-management-header__header___eKmgW{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;height:6rem;background-color:#fff;display:flex;padding-left:8px;justify-content:space-between}.-esm-stock-management__stock-management-header__left-justified-items___VpNpP{display:flex;flex-direction:row;align-items:center;cursor:pointer}.-esm-stock-management__stock-management-header__right-justified-items___IOVey{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;margin:.5rem}.-esm-stock-management__stock-management-header__page-name___CPqh1{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-management-header__page-labels___qR7PY{margin:1rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__date-and-location___Uxut9{display:flex;justify-content:flex-end;align-items:center;margin-right:1rem}.-esm-stock-management__stock-management-header__value___eLYN8{margin-left:.25rem}.-esm-stock-management__stock-management-header__middot___gwifp{margin:0 .5rem}.-esm-stock-management__stock-management-header__view___f_vFK{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-management-header/stock-management-header.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,gEC61BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD31BF,aEyCQ,CFxCR,WG0DW,CHzDX,qBDRM,CCSN,YAAA,CACA,gBAAA,CACA,6BAAA,CAGF,8EACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,cAAA,CAGF,+EC40BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CD10BF,aEwBQ,CFvBR,YAAA,CAGF,mECs0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CDl0BJ,qEACE,WAAA,CAGF,gEACE,cAAA,CAGF,2EACE,YAAA,CACA,wBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,+DACE,kBAAA,CAGF,gEACE,cAAA,CAGF,8DC2yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA",sourceRoot:""}]),i.locals={header:"-esm-stock-management__stock-management-header__header___eKmgW","left-justified-items":"-esm-stock-management__stock-management-header__left-justified-items___VpNpP","right-justified-items":"-esm-stock-management__stock-management-header__right-justified-items___IOVey","page-name":"-esm-stock-management__stock-management-header__page-name___CPqh1","page-labels":"-esm-stock-management__stock-management-header__page-labels___qR7PY",middot:"-esm-stock-management__stock-management-header__middot___gwifp","date-and-location":"-esm-stock-management__stock-management-header__date-and-location___Uxut9",value:"-esm-stock-management__stock-management-header__value___eLYN8",view:"-esm-stock-management__stock-management-header__view___f_vFK"};const l=i},2496:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-operation__sectionTitle___t2vui{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-operation__modalBody___YyRxm{padding-bottom:1rem}.-esm-stock-management__add-stock-operation__actionsContainer___SDbLm{display:flex;justify-content:space-between;margin:5px}.-esm-stock-management__add-stock-operation__statusContainer___MzxxK{display:flex;margin-top:4px;gap:1rem}.-esm-stock-management__add-stock-operation__textHeading___eg7oM{font-weight:bold}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe{margin-top:4px}.-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe .-esm-stock-management__add-stock-operation__text___DFlMr{margin-right:4px}.-esm-stock-management__add-stock-operation__actionButtons___XhL8k{margin:10px;display:flex;flex-direction:row}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-operations/add-stock-operation/add-stock-operation.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCpDF,kEC+1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD71BA,aAAA,CACA,oBEoBS,CFjBb,+DACI,mBEqBS,CFlBb,sEACI,YAAA,CACA,6BAAA,CACA,UAAA,CAGJ,qEACI,YAAA,CACA,cAAA,CACA,QAAA,CAGJ,iEACI,gBAAA,CAGJ,wEACI,cAAA,CACA,kIACI,gBAAA,CAIR,mEACI,WAAA,CACA,YAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={sectionTitle:"-esm-stock-management__add-stock-operation__sectionTitle___t2vui",modalBody:"-esm-stock-management__add-stock-operation__modalBody___YyRxm",actionsContainer:"-esm-stock-management__add-stock-operation__actionsContainer___SDbLm",statusContainer:"-esm-stock-management__add-stock-operation__statusContainer___MzxxK",textHeading:"-esm-stock-management__add-stock-operation__textHeading___eg7oM",statusDescriptions:"-esm-stock-management__add-stock-operation__statusDescriptions___fzNKe",text:"-esm-stock-management__add-stock-operation__text___DFlMr",actionButtons:"-esm-stock-management__add-stock-operation__actionButtons___XhL8k"};const l=i},6781:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]),i.locals={};const l=i},6360:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN .cds--data-table-content{height:calc(100vh - 150px)}","",{version:3,sources:["webpack://./src/stock-operations/add-stock-operation/stock-items-addition.component.scss"],names:[],mappings:"AACE,wGACE,0BAAA",sourceRoot:""}]),i.locals={tableContainer:"-esm-stock-management__stock-items-addition-component__tableContainer___J5PsN"};const l=i},1256:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-operations-dialog__section___fLTYQ{margin:.5rem}.-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp{margin-bottom:.75rem}.-esm-stock-management__stock-operations-dialog__modalBody___xG3z2{padding-bottom:1rem}","",{version:3,sources:["webpack://./src/stock-operations/stock-operations-dialog/stock-operations-dialog.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAGA,iEACE,YCiBW,CDdb,sEACE,oBCkBW,CDfb,mEACE,mBCmBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__stock-operations-dialog__section___fLTYQ",sectionTitle:"-esm-stock-management__stock-operations-dialog__sectionTitle____y5Vp",modalBody:"-esm-stock-management__stock-operations-dialog__modalBody___xG3z2"};const l=i},557:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__create-stock-report__reportContainer___pFGwm{min-height:15rem;display:flex;flex-direction:column;row-gap:1rem;padding:1rem}.-esm-stock-management__create-stock-report__reportButton___T0m6Q{padding:1rem}.-esm-stock-management__create-stock-report__sectionTitle___y25tl{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__subTitle___Pgm2N{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__create-stock-report__modalBody___VVZO6{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/generate-report/create-stock-report.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,qEACE,gBAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CACA,YAAA,CAEF,kEACE,YAAA,CAGF,kECm1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDj1BF,aDZQ,CCaR,oBEQW,CFLb,8DACE,cAAA,CACA,oBEGW,CAAA,+DFCX,mBEIW",sourceRoot:""}]),i.locals={reportContainer:"-esm-stock-management__create-stock-report__reportContainer___pFGwm",reportButton:"-esm-stock-management__create-stock-report__reportButton___T0m6Q",sectionTitle:"-esm-stock-management__create-stock-report__sectionTitle___y25tl",subTitle:"-esm-stock-management__create-stock-report__subTitle___Pgm2N",modalBody:"-esm-stock-management__create-stock-report__modalBody___VVZO6"};const l=i},5861:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-reports__content___A4qFU{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-reports__helper___J9F35{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-reports__separator___yNdhd{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-reports__separator___yNdhd::before,.-esm-stock-management__stock-reports__separator___yNdhd::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-reports__separator___yNdhd::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-reports__separator___yNdhd::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-reports__tileContainer___nLbej{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-reports__tile___L1giA{margin:auto;width:fit-content}.-esm-stock-management__stock-reports__tileContent___J975x{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-reports/report-list/stock-reports.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,uDC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,sDCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,yDCm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-reports__content___A4qFU",helper:"-esm-stock-management__stock-reports__helper___J9F35",separator:"-esm-stock-management__stock-reports__separator___yNdhd",tileContainer:"-esm-stock-management__stock-reports__tileContainer___nLbej",tile:"-esm-stock-management__stock-reports__tile___L1giA",tileContent:"-esm-stock-management__stock-reports__tileContent___J975x"};const l=i},2033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-settings__productiveHeading01___L9i81,.-esm-stock-management__stock-settings__title____W_Wx{font-size:var(--cds-heading-01-font-size, 0.875rem);font-weight:var(--cds-heading-01-font-weight, 600);line-height:var(--cds-heading-01-line-height, 1.42857);letter-spacing:var(--cds-heading-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__productiveHeading02___hss5P{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading03___fPfXI{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading04___nygs1{font-size:var(--cds-productive-heading-04-font-size, 1.75rem);font-weight:var(--cds-productive-heading-04-font-weight, 400);line-height:var(--cds-productive-heading-04-line-height, 1.28572);letter-spacing:var(--cds-productive-heading-04-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading05___oSN3A{font-size:var(--cds-productive-heading-05-font-size, 2rem);font-weight:var(--cds-productive-heading-05-font-weight, 400);line-height:var(--cds-productive-heading-05-line-height, 1.25);letter-spacing:var(--cds-productive-heading-05-letter-spacing, 0)}.-esm-stock-management__stock-settings__productiveHeading06___DHu2c{font-size:var(--cds-productive-heading-06-font-size, 2.625rem);font-weight:var(--cds-productive-heading-06-font-weight, 300);line-height:var(--cds-productive-heading-06-line-height, 1.199);letter-spacing:var(--cds-productive-heading-06-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyShort01___tYpmd{font-size:var(--cds-body-short-01-font-size, 0.875rem);font-weight:var(--cds-body-short-01-font-weight, 400);line-height:var(--cds-body-short-01-line-height, 1.28572);letter-spacing:var(--cds-body-short-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__helperText01___ZY1nd{font-size:var(--cds-helper-text-01-font-size, 0.75rem);line-height:var(--cds-helper-text-01-line-height, 1.33333);letter-spacing:var(--cds-helper-text-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__bodyShort02___iosfZ{font-size:var(--cds-body-short-02-font-size, 1rem);font-weight:var(--cds-body-short-02-font-weight, 400);line-height:var(--cds-body-short-02-line-height, 1.375);letter-spacing:var(--cds-body-short-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__bodyLong01___HhqRS{font-size:var(--cds-body-long-01-font-size, 0.875rem);font-weight:var(--cds-body-long-01-font-weight, 400);line-height:var(--cds-body-long-01-line-height, 1.42857);letter-spacing:var(--cds-body-long-01-letter-spacing, 0.16px)}.-esm-stock-management__stock-settings__bodyLong02___jSFlj{font-size:var(--cds-body-long-02-font-size, 1rem);font-weight:var(--cds-body-long-02-font-weight, 400);line-height:var(--cds-body-long-02-line-height, 1.5);letter-spacing:var(--cds-body-long-02-letter-spacing, 0)}.-esm-stock-management__stock-settings__label01___lbC3K{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-stock-management__stock-settings__text02___Vqsry{color:#525252}aside{background-color:#fff !important}.-esm-stock-management__stock-settings__container___BnGf9{padding:2rem}.-esm-stock-management__stock-settings__formContainer___nHBLE{height:calc(100vh - 100px) !important;overflow:scroll;padding:0 1rem}.-esm-stock-management__stock-settings__verticalForm___S9Wbd{display:flex;grid-row-gap:2em;padding-top:1rem;align-content:space-between;flex-direction:column}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--form-item{flex:none !important}.-esm-stock-management__stock-settings__verticalForm___S9Wbd .cds--label{color:#000;display:inline-block;font-size:var(--cds-label-01-font-size);font-weight:bold;letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);line-height:1rem;margin-bottom:.5rem;vertical-align:baseline}.-esm-stock-management__stock-settings__StockSettings___IhIeT{display:flex;justify-content:center;flex-direction:column;justify-content:flex-end;min-height:12.5rem;border:1px solid #e0e0e0;margin:.5rem;align-items:center;background-color:#fff}.-esm-stock-management__stock-settings__StockSettings___IhIeT>button{margin-bottom:2rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/stock-settings/stock-settings.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_layout.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnCF,0HC80BI,mDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,2DAAA,CD10BJ,oEC00BI,+CAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDt0BJ,oECs0BI,6DAAA,CAAA,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CDl0BJ,oECk0BI,6DAAA,CAAA,6DAAA,CAAA,iEAAA,CAAA,iEAAA,CD9zBJ,oEC8zBI,0DAAA,CAAA,6DAAA,CAAA,8DAAA,CAAA,iEAAA,CD1zBJ,oEC0zBI,8DAAA,CAAA,6DAAA,CAAA,+DAAA,CAAA,iEAAA,CDtzBJ,4DCszBI,sDAAA,CAAA,qDAAA,CAAA,yDAAA,CAAA,8DAAA,CDlzBJ,6DCkzBI,sDAAA,CAAA,0DAAA,CAAA,+DAAA,CD9yBJ,4DC8yBI,kDAAA,CAAA,qDAAA,CAAA,uDAAA,CAAA,yDAAA,CD1yBJ,2DC0yBI,qDAAA,CAAA,oDAAA,CAAA,wDAAA,CAAA,6DAAA,CDtyBJ,2DCsyBI,iDAAA,CAAA,oDAAA,CAAA,oDAAA,CAAA,wDAAA,CDlyBJ,wDCkyBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD9xBJ,uDACE,aDhEQ,CCmEV,MACE,gCAAA,CAGF,0DACE,YEpCW,CFuCb,8DACE,qCAAA,CACA,eAAA,CACA,cAAA,CAGF,6DACE,YAAA,CACA,gBAAA,CACA,gBAAA,CACA,2BAAA,CACA,qBAAA,CAEA,6EACE,oBAAA,CAGF,yEACE,UAAA,CACA,oBAAA,CACA,uCAAA,CACA,gBAAA,CACA,yDAAA,CACA,gBAAA,CACA,mBAAA,CACA,uBAAA,CGrGJ,8DACI,YAAA,CACA,sBAAA,CACA,qBAAA,CACA,wBAAA,CACA,kBAAA,CACA,wBAAA,CACA,YDUS,CCTT,kBAAA,CACA,qBC6GM,CD3GN,qEACI,kBEKI",sourceRoot:""}]),i.locals={productiveHeading01:"-esm-stock-management__stock-settings__productiveHeading01___L9i81",title:"-esm-stock-management__stock-settings__title____W_Wx",productiveHeading02:"-esm-stock-management__stock-settings__productiveHeading02___hss5P",productiveHeading03:"-esm-stock-management__stock-settings__productiveHeading03___fPfXI",productiveHeading04:"-esm-stock-management__stock-settings__productiveHeading04___nygs1",productiveHeading05:"-esm-stock-management__stock-settings__productiveHeading05___oSN3A",productiveHeading06:"-esm-stock-management__stock-settings__productiveHeading06___DHu2c",bodyShort01:"-esm-stock-management__stock-settings__bodyShort01___tYpmd",helperText01:"-esm-stock-management__stock-settings__helperText01___ZY1nd",bodyShort02:"-esm-stock-management__stock-settings__bodyShort02___iosfZ",bodyLong01:"-esm-stock-management__stock-settings__bodyLong01___HhqRS",bodyLong02:"-esm-stock-management__stock-settings__bodyLong02___jSFlj",label01:"-esm-stock-management__stock-settings__label01___lbC3K",text02:"-esm-stock-management__stock-settings__text02___Vqsry",container:"-esm-stock-management__stock-settings__container___BnGf9",formContainer:"-esm-stock-management__stock-settings__formContainer___nHBLE",verticalForm:"-esm-stock-management__stock-settings__verticalForm___S9Wbd",StockSettings:"-esm-stock-management__stock-settings__StockSettings___IhIeT"};const l=i},8098:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-sources__section___NMR9P{margin:.5rem}.-esm-stock-management__add-stock-sources__sectionTitle___mIFZm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-sources__modalBody___QeuLr{padding-bottom:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/add-stock-sources/add-stock-sources.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,2DACE,YCgBW,CDbb,gEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,6DACE,mBCgBW",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-sources__section___NMR9P",sectionTitle:"-esm-stock-management__add-stock-sources__sectionTitle___mIFZm",modalBody:"-esm-stock-management__add-stock-sources__modalBody___QeuLr"};const l=i},5551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,".-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5 .cds--dropdown--inline .cds--list-box__field{min-width:12rem}","",{version:3,sources:["webpack://./src/stock-sources/stock-sources-filter/stock-sources-filter.scss"],names:[],mappings:"AACI,sGACE,KAAA,CAGF,gGACE,WAAA,CAGF,mHACE,eAAA",sourceRoot:""}]),i.locals={filterContainer:"-esm-stock-management__stock-sources-filter__filterContainer___Bd1E5"};const l=i},6940:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-sources__container___WSslj{background-color:#f4f4f4}.-esm-stock-management__stock-sources__headerContainer___Ze03U{display:flex;justify-content:space-between;align-items:center;padding:1rem;background-color:#fff}.-esm-stock-management__stock-sources__headerButtons___diHXv{display:flex;flex-flow:column}.-esm-stock-management__stock-sources__heading___eDFEL{font-size:20px;font-weight:bold}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown__wrapper--inline{gap:0}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--list-box__menu-icon{height:1rem}.-esm-stock-management__stock-sources__filterContainer___SeMsL .cds--dropdown--inline .cds--list-box__field{min-width:12rem}.-esm-stock-management__stock-sources__tooltip___CZOKY .cds--tooltip__trigger.cds--tooltip__trigger--definition{border-bottom:none}.-esm-stock-management__stock-sources__tag___KdICQ{margin:.25rem 0}.-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ{align-items:center;display:flex;flex:1 1 0%;justify-content:center}.-esm-stock-management__stock-sources__search___skZQ1{max-width:16rem}.-esm-stock-management__stock-sources__search___skZQ1 input{background-color:#fff !important}.-esm-stock-management__stock-sources__tableContainer___lpDEm{background-color:#f4f4f4;margin:0 1rem;padding:0}.-esm-stock-management__stock-sources__tableContainer___lpDEm a{text-decoration:none}.-esm-stock-management__stock-sources__tableContainer___lpDEm th{color:#525252}.-esm-stock-management__stock-sources__tableContainer___lpDEm .cds--data-table{background-color:#e0e0e0}.-esm-stock-management__stock-sources__tableContainer___lpDEm .-esm-stock-management__stock-sources__toolbarContent___gZ2MJ{height:2rem;margin-bottom:.25rem}.-esm-stock-management__stock-sources__emptyRow___wlFNH{padding:0 1rem;display:flex;align-items:center}.-esm-stock-management__stock-sources__stockSourcesTable___KNEf1 tr:last-of-type td{border-bottom:none}.-esm-stock-management__stock-sources__content___EBUcR{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-sources__helper___Pxp0P{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-sources__separator___NUg2A{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-sources__separator___NUg2A::before,.-esm-stock-management__stock-sources__separator___NUg2A::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-sources__separator___NUg2A::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-sources__separator___NUg2A::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-sources__tileContainer___p2Nnr{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-sources__tile___ZRgFn{margin:auto;width:fit-content}.-esm-stock-management__stock-sources__tileContent___dm3Qq{display:flex;flex-direction:column;align-items:center}.-esm-stock-management__stock-sources__menuItem___Brdql{max-width:none}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);color:#525252}.-esm-stock-management__stock-sources__desktopHeading___tb1eK,.-esm-stock-management__stock-sources__tabletHeading___rIkv3{text-align:left;text-transform:capitalize;margin-bottom:1rem}.-esm-stock-management__stock-sources__desktopHeading___tb1eK h4:after,.-esm-stock-management__stock-sources__tabletHeading___rIkv3 h4:after{content:"";display:block;width:2rem;padding-top:3px;border-bottom:.375rem solid var(--brand-03)}.-esm-stock-management__stock-sources__statusContainer___meWIY{display:flex;align-items:center}.-esm-stock-management__stock-sources__statusContainer___meWIY svg{margin-right:.5rem}.-esm-stock-management__stock-sources__visitType___HhWht{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0)}.-esm-stock-management__stock-sources__headerBtnContainer___zSCLg{background-color:#fff;padding:1rem;text-align:right}.-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q{margin-left:1rem;height:3rem}.-esm-stock-management__stock-sources__editIcon___A00kf{color:#0f62fe;margin-top:.5rem;cursor:pointer}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-sources/stock-sources.scss","webpack://./node_modules/@carbon/colors/index.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,yDACE,wBDNM,CCSR,+DACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,YAAA,CACA,qBDPc,CCUhB,6DACE,YAAA,CACA,gBAAA,CAGF,uDACE,cAAA,CACA,gBAAA,CAIA,+FACE,KAAA,CAGF,yFACE,WAAA,CAGF,4GACE,eAAA,CAIJ,gHACE,kBAAA,CAGF,mDACE,eAAA,CAGF,+EACE,kBAAA,CACA,YAAA,CACA,WAAA,CACA,sBAAA,CAGF,sDACE,eAAA,CAEA,4DACE,gCAAA,CAIJ,8DACE,wBDjEM,CCkEN,aAAA,CACA,SAAA,CAEA,gEACE,oBAAA,CAGF,iEACE,aC1BM,CD6BR,+EACE,wBD5EI,CC+EN,4HACE,WEzCS,CF0CT,oBEnES,CFuEb,wDACE,cAAA,CACA,YAAA,CACA,kBAAA,CAIA,oFACE,kBAAA,CAKJ,uDG8vBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH5vBF,aCtDQ,CDuDR,mBAAA,CAGF,sDGwvBI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CHtvBF,aC5DQ,CD+DV,yDGmvBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CHjvBF,aCjEQ,CDkER,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,iIAEE,wBDnHM,CCoHN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,iEACE,WAAA,CACA,gBAAA,CAGF,gEACE,UAAA,CACA,iBAAA,CAIJ,6DACE,qBD7IM,CC8IN,4BAAA,CACA,cAAA,CAGF,oDACE,WAAA,CACA,iBAAA,CAGF,2DACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAGF,wDACE,cAAA,CAIA,iEG+rBE,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CH7rBA,aCrHM,CD0HR,gEGwrBE,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CHtrBA,aC5HM,CDgIV,2HAEE,eAAA,CACA,yBAAA,CACA,kBErJW,CFuJX,6IACE,UAAA,CACA,aAAA,CACA,UAAA,CACA,eAAA,CACA,2CAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CAEA,mEACE,kBAAA,CAIJ,yDG0pBI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CHtpBJ,kEACE,qBDtMc,CCuMd,YE/KW,CFgLX,gBAAA,CAGF,mEACE,gBEpLW,CFqLX,WEjKW,CFoKb,wDACE,aDnMe,CCoMf,gBAAA,CACA,cAAA",sourceRoot:""}]),i.locals={container:"-esm-stock-management__stock-sources__container___WSslj",headerContainer:"-esm-stock-management__stock-sources__headerContainer___Ze03U",headerButtons:"-esm-stock-management__stock-sources__headerButtons___diHXv",heading:"-esm-stock-management__stock-sources__heading___eDFEL",filterContainer:"-esm-stock-management__stock-sources__filterContainer___SeMsL",tooltip:"-esm-stock-management__stock-sources__tooltip___CZOKY",tag:"-esm-stock-management__stock-sources__tag___KdICQ",backgroundDataFetchingIndicator:"-esm-stock-management__stock-sources__backgroundDataFetchingIndicator___FDncZ",search:"-esm-stock-management__stock-sources__search___skZQ1",tableContainer:"-esm-stock-management__stock-sources__tableContainer___lpDEm",toolbarContent:"-esm-stock-management__stock-sources__toolbarContent___gZ2MJ",emptyRow:"-esm-stock-management__stock-sources__emptyRow___wlFNH",stockSourcesTable:"-esm-stock-management__stock-sources__stockSourcesTable___KNEf1",content:"-esm-stock-management__stock-sources__content___EBUcR",helper:"-esm-stock-management__stock-sources__helper___Pxp0P",separator:"-esm-stock-management__stock-sources__separator___NUg2A",tileContainer:"-esm-stock-management__stock-sources__tileContainer___p2Nnr",tile:"-esm-stock-management__stock-sources__tile___ZRgFn",tileContent:"-esm-stock-management__stock-sources__tileContent___dm3Qq",menuItem:"-esm-stock-management__stock-sources__menuItem___Brdql",desktopHeading:"-esm-stock-management__stock-sources__desktopHeading___tb1eK",tabletHeading:"-esm-stock-management__stock-sources__tabletHeading___rIkv3",statusContainer:"-esm-stock-management__stock-sources__statusContainer___meWIY",visitType:"-esm-stock-management__stock-sources__visitType___HhWht",headerBtnContainer:"-esm-stock-management__stock-sources__headerBtnContainer___zSCLg",addPatientToListBtn:"-esm-stock-management__stock-sources__addPatientToListBtn___Jo50q",editIcon:"-esm-stock-management__stock-sources__editIcon___A00kf"};const l=i},4300:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko{margin:.5rem}.-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq{font-size:14px;margin-bottom:.75rem}.-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X{padding-bottom:1rem}.-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));gap:16px}.-esm-stock-management__add-stock-user-role-scope__hr___S9Kir{border:1px solid #000}.-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts{margin:5px}.-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM{width:100%}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,mEACE,YCgBW,CDbb,wEE01BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CFx1BF,aDLQ,CCMR,oBCeW,CDZb,oEACE,cAAA,CACA,oBCUW,CDPb,qEACE,mBCWW,CDRb,wEACE,YAAA,CACA,2DAAA,CACA,QAAA,CAGF,8DACE,qBAAA,CAGF,kEACE,UAAA,CAGF,oEACE,UAAA",sourceRoot:""}]),i.locals={section:"-esm-stock-management__add-stock-user-role-scope__section___Lv8Ko",sectionTitle:"-esm-stock-management__add-stock-user-role-scope__sectionTitle___Bb005",subTitle:"-esm-stock-management__add-stock-user-role-scope__subTitle___JC7xq",modalBody:"-esm-stock-management__add-stock-user-role-scope__modalBody___uNo7X",checkboxGrid:"-esm-stock-management__add-stock-user-role-scope__checkboxGrid___QNkgg",hr:"-esm-stock-management__add-stock-user-role-scope__hr___S9Kir",toggle:"-esm-stock-management__add-stock-user-role-scope__toggle___JX5ts",checkbox:"-esm-stock-management__add-stock-user-role-scope__checkbox___DZHJM"};const l=i},5104:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(7537),o=n.n(r),a=n(3645),i=n.n(a)()(o());i.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-stock-management__stock-user-role-scopes__content___g06Q8{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);color:#525252;margin-bottom:.5rem}.-esm-stock-management__stock-user-role-scopes__helper___VOKFX{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px);color:#525252}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;width:80%;margin:1.5rem auto;overflow:hidden;text-align:center}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before,.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{background-color:#a8a8a8;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::before{right:.5rem;margin-left:-50%}.-esm-stock-management__stock-user-role-scopes__separator___M4cpF::after{left:.5rem;margin-right:-50%}.-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd{background-color:#fff;border-top:1px solid #e0e0e0;padding:5rem 0}.-esm-stock-management__stock-user-role-scopes__tile___C5KRv{margin:auto;width:fit-content}.-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa{display:flex;flex-direction:column;align-items:center}',"",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/stock-user-role-scopes/stock-user-role-scopes.scss","webpack://./node_modules/@carbon/type/scss/_styles.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CD51BF,aDDQ,CCER,mBAAA,CAGF,+DCw1BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CDt1BF,aDPQ,CCUV,kECm1BI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDj1BF,aDZQ,CCaR,SAAA,CACA,kBAAA,CACA,eAAA,CACA,iBAAA,CAEA,mJAEE,wBDnBM,CCoBN,UAAA,CACA,oBAAA,CACA,UAAA,CACA,iBAAA,CACA,qBAAA,CACA,SAAA,CAGF,0EACE,WAAA,CACA,gBAAA,CAGF,yEACE,UAAA,CACA,iBAAA,CAIJ,sEACE,qBD7CM,CC8CN,4BAAA,CACA,cAAA,CAGF,6DACE,WAAA,CACA,iBAAA,CAGF,oEACE,YAAA,CACA,qBAAA,CACA,kBAAA",sourceRoot:""}]),i.locals={content:"-esm-stock-management__stock-user-role-scopes__content___g06Q8",helper:"-esm-stock-management__stock-user-role-scopes__helper___VOKFX",separator:"-esm-stock-management__stock-user-role-scopes__separator___M4cpF",tileContainer:"-esm-stock-management__stock-user-role-scopes__tileContainer___PGoSd",tile:"-esm-stock-management__stock-user-role-scopes__tile___C5KRv",tileContent:"-esm-stock-management__stock-user-role-scopes__tileContent___HvcGa"};const l=i},2894:(e,t,n)=>{"use strict";n.r(t),n.d(t,{deletePackagingUnitButton:()=>js,deletePackagingUnitModal:()=>Us,deleteStockModal:()=>Bs,deleteUserScopeModal:()=>Ps,importBulkStockItemsDialog:()=>zs,importTranslation:()=>ds,root:()=>Is,startupApp:()=>Ls,stockItems:()=>_s,stockItemsLink:()=>hs,stockLocations:()=>Es,stockLocationsLink:()=>ws,stockManagement:()=>Ns,stockManagementAdminCardLink:()=>ms,stockManagementAppMenuItem:()=>Fs,stockNavMenu:()=>ps,stockOperationDialog:()=>Ts,stockOperations:()=>fs,stockOperationsLink:()=>vs,stockOverview:()=>As,stockOverviewLink:()=>gs,stockReports:()=>Ss,stockReportsLink:()=>Ds,stockSettings:()=>Os,stockSettingsLink:()=>xs,stockSources:()=>ks,stockSourcesLink:()=>Cs,stockUserScopes:()=>bs,stockUserScopesLink:()=>ys});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(6478),i=n(1672),l=n.n(i),c=n(7410),s=n.n(c),u=n(4766),d=n.n(u),m=n(1991),p=n.n(m),A=n(3702),g=n.n(A),f=n(2434),v=n.n(f),_=n(1422),h=n.n(_),b=n(7813),y={};y.styleTagTransform=h(),y.setAttributes=g(),y.insert=p().bind(null,"head"),y.domAPI=d(),y.insertStyleElement=v(),s()(b.Z,y);const k=b.Z&&b.Z.locals?b.Z.locals:void 0;var C=n(601);var E=n(3397);function w(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function S(){var e;return e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){return t=new AbortController,[2,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},S=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){w(a,r,o,i,l,"next",e)}function l(e){w(a,r,o,i,l,"throw",e)}i(void 0)}))},S.apply(this,arguments)}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?D(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var x=n(49),N={};N.styleTagTransform=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),B={};B.styleTagTransform=h(),B.setAttributes=g(),B.insert=p().bind(null,"head"),B.domAPI=d(),B.insertStyleElement=v(),s()(T.Z,B);const P=T.Z&&T.Z.locals?T.Z.locals:void 0;var U,j=n(9820);function z(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return"";var r=null===(t=Object.keys(e))||void 0===t?void 0:t.map((function(t){var r=e[t];return n&&(!1===r||!0===r||r)||!n&&(""===r||!1===r||!0===r||r)?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r.toString())):null})).filter((function(e){return null!=e})).join("&");return r.length>0?"?"+r:""}function F(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function L(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e,"?v=full");return(0,r.openmrsFetch)(t)}function R(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function M(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperation/").concat(e.uuid),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Default="default",e.Full="full",e.REF="ref"}(U||(U={}));var q=function(e){switch(e){case"NEW":return"#0f62fe";case"SUBMITTED":return"#4589ff";case"DISPATCHED":return"#8a3ffc";case"COMPLETED":return"#24a148";case"CANCELLED":return"#da1e28";case"RETURNED":return"#eb6200"}};function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H={isOverlayOpen:!1,component:Function,header:""},Z=function(){return(0,r.getGlobalStore)("dispensing-store",H)},Y=function(e,t){Z().setState({isOverlayOpen:!0,component:t,header:e})},Q=function(){Z().setState({component:null,isOverlayOpen:!1})},J=n(2653),W=n.n(J),V=function(e,t){return e?W()(e).format(null!=t?t:"DD-MMM-YYYY"):""},K=("".concat(window.getOpenmrsSpaBase),W()((new Date).setUTCHours(0,0,0,0)).format("YYYY-MM-DDTHH:mm:ss.SSSZZ"),Intl.DateTimeFormat().resolvedOptions().timeZone,"DD/MM/YYYY"),X="d/m/Y",$=function(e){return V(e,K)},ee=function(){var e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},te=Object.freeze({SOURCES:"Sources",OPERATION:"Operation",STATUS:"Status"}),ne="moduleResources/stockmanagement/assets/print-logo.svg",re="Ministry of Health",oe="Main Store",ae="/openmrs/",ie=!0;function le(e){var t,n,r,o,a,i=null==e||null===(n=e.responseBody)||void 0===n||null===(t=n.error)||void 0===t?void 0:t.fieldErrors;return i?Object.values(i).flatMap((function(e){return e.map((function(e){return e.message}))})):[null!==(a=null==e||null===(o=e.responseBody)||void 0===o||null===(r=o.error)||void 0===r?void 0:r.message)&&void 0!==a?a:null==e?void 0:e.message]}"".concat(ae,"moduleResources/stockmanagement/templates/Import_Stock_Items.xlsx");var ce=function(e){(0,j.JG)((function(t){return"string"==typeof t&&t.startsWith(e)}),void 0,{revalidate:!0})};function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ue(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function de(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var me=n(8115);var pe=n(1657);const Ae=function(e){var t=e.row,n=(0,i.useCallback)((function(){var e=(0,r.showModal)("delete-packaging-unit-modal",{closeModal:function(){return e()},row:t})}),[t]);return l().createElement("div",null,l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:pe.ZN,onClick:n}))};function ge(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function fe(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function ve(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockbatch").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function _e(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading,l=n.mutate;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a,mutate:l}}function he(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e,"?v=full"),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{item:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function be(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem"),n=new AbortController;return delete e.isDrug,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function ye(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem/").concat(e.uuid),n=new AbortController;return delete e.isDrug,delete e.dateCreated,(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ke(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(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 Ee(e){var t=Ce((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Ce((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=_e(n),s=c.items,u=c.isLoading,d=c.isError,m=c.mutate;return{items:s.results,totalCount:s.totalCount,isLoading:u,isError:d,setStockItemUuid:l,mutate:m}}var we=n(4158),Se={};Se.styleTagTransform=h(),Se.setAttributes=g(),Se.insert=p().bind(null,"head"),Se.domAPI=d(),Se.insertStyleElement=v(),s()(we.Z,Se);const De=we.Z&&we.Z.locals?we.Z.locals:void 0;function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var xe=n(1914),Ne=n(965),Ie={};Ie.styleTagTransform=h(),Ie.setAttributes=g(),Ie.insert=p().bind(null,"head"),Ie.domAPI=d(),Ie.insertStyleElement=v(),s()(Ne.Z,Ie);const Te=Ne.Z&&Ne.Z.locals?Ne.Z.locals:void 0,Be=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 Pe=n(9375),Ue=n(2411),je=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:Te.header},l().createElement("div",{className:Te["left-justified-items"]},l().createElement(Be,null),l().createElement("div",{className:Te["page-labels"]},l().createElement("p",null,t("home","Home")),l().createElement("p",{className:Te["page-name"]},t("stockManagement","Stock Management")))),l().createElement("div",{className:Te["right-justified-items"]},l().createElement("div",{className:Te["date-and-location"]},l().createElement(Pe.Ye,{size:16}),l().createElement("span",{className:Te.value},o),l().createElement("span",{className:Te.middot},"·"),l().createElement(Ue.f,{size:16}),l().createElement("span",{className:Te.value},(0,r.formatDate)(new Date,{mode:"standard"})))))};const ze=function(e){var t=e.dashboardSlot,n=e.title;return l().createElement(l().Fragment,null,l().createElement(je,null),l().createElement(r.ExtensionSlot,{name:t,state:{dashboardTitle:n}}))};var Fe=n(3011),Le={};Le.styleTagTransform=h(),Le.setAttributes=g(),Le.insert=p().bind(null,"head"),Le.domAPI=d(),Le.insertStyleElement=v(),s()(Fe.Z,Le);const Re=Fe.Z&&Fe.Z.locals?Fe.Z.locals:void 0;var Me=n(6194),qe=n(2296),Ge={};Ge.styleTagTransform=h(),Ge.setAttributes=g(),Ge.insert=p().bind(null,"head"),Ge.domAPI=d(),Ge.insertStyleElement=v(),s()(qe.Z,Ge);const He=qe.Z&&qe.Z.locals?qe.Z.locals:void 0,Ze=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?He.desktopOverlay:He.tabletOverlay},"tablet"!==c?l().createElement("div",{className:He.desktopHeader},l().createElement("div",{className:He.headerContent},t),l().createElement(a.zxk,{className:He.closePanelButton,onClick:function(){return Q()},kind:"ghost",hasIconOnly:!0},l().createElement(Me.x8,{size:16}))):l().createElement(a.h4i,{onClick:function(){return Q()},"aria-label":s("tabletOverlay","Tablet overlay"),className:He.tabletOverlayHeader},l().createElement(a.zxk,{hasIconOnly:!0},l().createElement(me.Xd,{size:16})),l().createElement("div",{className:He.headerContent},t)),l().createElement("div",null,n)))};function Ye(){var e,t=(0,xe.useParams)(),n=(0,r.useExtensionStore)(),o=(0,r.useLayoutType)(),a=(null===(e=n.slots["stock-page-dashboard-slot"])||void 0===e?void 0:e.assignedExtensions.map((function(e){return e.meta})).filter((function(e){return Object.keys(e).length})))||[],i=a.find((function(e){return e.name===(null==t?void 0:t.dashboard)}))||a[0];return l().createElement(l().Fragment,null,l().createElement(Ze,null),l().createElement("div",{className:Re.homePageWrapper},l().createElement("section",{className:(0,r.isDesktop)(o)?Re.dashboardContainer:Re.dashboardContainerTablet},(0,r.isDesktop)(o)&&l().createElement(r.ExtensionSlot,{name:"stock-sidebar-slot",key:o}),l().createElement(ze,{title:null==i?void 0:i.name,dashboardSlot:null==i?void 0:i.slot})),l().createElement(r.WorkspaceContainer,{overlay:!0,contextKey:"stock-management"})))}var Qe=n(2426),Je={};Je.styleTagTransform=h(),Je.setAttributes=g(),Je.insert=p().bind(null,"head"),Je.domAPI=d(),Je.insertStyleElement=v(),s()(Qe.Z,Je);const We=Qe.Z&&Qe.Z.locals?Qe.Z.locals:void 0;var Ve=n(3432),Ke={};Ke.styleTagTransform=h(),Ke.setAttributes=g(),Ke.insert=p().bind(null,"head"),Ke.domAPI=d(),Ke.insertStyleElement=v(),s()(Ve.Z,Ke);const Xe=Ve.Z&&Ve.Z.locals?Ve.Z.locals:void 0;var $e=n(9697),et=n(7412),tt=n.n(et);W().extend(tt());const nt=function(e){var t,n,o,i,c,s=e.label,u=e.value,d=e.headerLabel,m=e.children,p=e.view,A=e.count,g=e.outofstockCount,f=e.disposedCount,v=(0,E.useTranslation)().t;return l().createElement(a.n9L,{className:Xe.tileContainer},l().createElement("div",{className:Xe.tileHeader},l().createElement("div",{className:Xe.headerLabelContainer},l().createElement("label",{className:Xe.headerLabel},d),m),p&&l().createElement(r.ConfigurableLink,{className:Xe.link,to:"${openmrsSpaBase}/stock-management/orders"},l().createElement("span",{style:{fontSize:"0.825rem",marginRight:"0.325rem"}},v("view","View"))," ",l().createElement(me.ol,{size:16,className:Xe.viewListBtn}))),l().createElement("div",{className:Xe.metricsGrid},l().createElement("div",null,l().createElement("label",{className:Xe.totalsLabel},s),l().createElement("p",{className:Xe.totalsValue},u)),!(0,$e.Z)(A)&&l().createElement("div",{className:Xe.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("in6months","In 6 months")),l().createElement("p",{style:{color:"#DA1E28"}},null===(t=A.expiry6months)||void 0===t?void 0:t.length)),!(0,$e.Z)(g)&&l().createElement("div",{className:Xe.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("itemsbelowmin","Items Below Min")),l().createElement("span",{style:{color:"#319227"}},v("itemsabovemax","Items Above Max")),l().createElement("p",{style:{color:"#DA1E28"}},null===(n=g.itemsbelowmin)||void 0===n?void 0:n.length),l().createElement("p",{style:{color:"#319227"}},null===(o=g.itemsabovemax)||void 0===o?void 0:o.length)),!(0,$e.Z)(f)&&l().createElement("div",{className:Xe.countGrid},l().createElement("span",{style:{color:"#DA1E28"}},v("expired","Expired")),l().createElement("span",{style:{color:"#FABA5F"}},v("poorquality","Poor Quality")),l().createElement("p",{style:{color:"#DA1E28"}},null===(i=f.expired)||void 0===i?void 0:i.length),l().createElement("p",{style:{color:"#FABA5F"}},null===(c=f.poorquality)||void 0===c?void 0:c.length))))};function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ot(e){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 rt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rt(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=ge(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 at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function it(){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 at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(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=ve(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 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(e){var t=(0,E.useTranslation)().t,n=function(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockitem?v=default&totalCount=true"),t=(0,j.ZP)(e,r.openmrsFetch),n=t.data,o=t.error,a=null==n?void 0:n.data.results.map((function(e){return{uuid:e.uuid,hasExpiration:e.hasExpiration,expiryNotice:e.expiryNotice}}));return{stockList:null!=a?a:[],isLoading:!n&&!o,error:o}}(),o=n.stockList,i=n.isLoading,c=n.error,s=it(),u=s.items,d=(s.isLoading,ot().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){lt(e,t,n[t])}))}return e}({},e,t)}));p=p.filter((function(e){return e.hasExpiration}));var A=p.filter((function(e){var t=e.expiryNotice||0,n=new Date(e.expiration),r=Math.ceil((n.getTime()-m.getTime())/864e5);return r<=t||r<0})),g=A.filter((function(e){return e.hasExpiration&&e.expiryNotice<=180})),f=function(e){var t,n=F(e),r=n.items,o=n.isLoading,a=n.isError,i=null==r||null===(t=r.results)||void 0===t?void 0:t.filter((function(e){return"disposed"===(null==e?void 0:e.operationType)}));return{items:i,isLoading:o,isError:a}}({v:U.Full,totalCount:!0}).items;if(i)return l().createElement(a.lSo,{role:"progressbar",description:t("loading","Loading...")});if(c)return l().createElement(r.ErrorState,{headerTitle:t("errorStockMetric"),error:c});var v=f&&f.filter((function(e){return"Drug not available due to expired medication"===e.reasonName})),_=f&&f.filter((function(e){return"Poor Quality"===e.reasonName}));return l().createElement(l().Fragment,null,l().createElement("div",{className:We.cardContainer},l().createElement(nt,{label:t("stocks","Expiring stock"),value:(null==A?void 0:A.length)||0,headerLabel:t("expiringStock","Expiring Stock"),view:"items",count:{expiry6months:g}}),l().createElement(nt,{label:t("outofstock","Out of Stock"),value:null==o?void 0:o.length,headerLabel:t("highestServiceVolume","Out of Stock "),view:"items",outofstockCount:{itemsbelowmin:["0"],itemsabovemax:["0"]}}),l().createElement(nt,{label:t("disposedstock","Disposed Stock"),value:(null==f?void 0:f.length)||0,headerLabel:t("providersAvailableToday","Disposed Stock "),view:"items",disposedCount:{expired:v,poorquality:_}})))};var st=n(8629),ut={};ut.styleTagTransform=h(),ut.setAttributes=g(),ut.insert=p().bind(null,"head"),ut.domAPI=d(),ut.insertStyleElement=v(),s()(st.Z,ut);const dt=st.Z&&st.Z.locals?st.Z.locals:void 0;var mt=n(4797);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}const At=function(){var e=(0,E.useTranslation)().t,t=((0,r.useLayoutType)(),it()),n=t.items,o=t.isLoading,i=ot(),c=i.items;if(i.isLoading||o)return l().createElement(l().Fragment,null);if(0===(null==c?void 0:c.length))return l().createElement(l().Fragment,null,l().createElement("p",{className:dt.content},e("inventoryAlertNull","No inventory alerts to display")));var s=new Date,u=n.map((function(e){var t=null==c?void 0:c.find((function(t){return(null==e?void 0:e.stockItemUuid)===t.uuid}));return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){pt(e,t,n[t])}))}return e}({},e,t)}));u=u.filter((function(e){return e.hasExpiration}));var d=u.filter((function(e){var t=new Date(e.expiration),n=Math.ceil((t.getTime()-s.getTime())/864e5);return n<=180&&n>=0})).slice(0,5);return l().createElement(l().Fragment,null,d.map((function(e,t){return l().createElement("div",{className:dt.card,key:t},l().createElement("div",{className:dt.colorLineRed}),l().createElement("div",{className:dt.icon},l().createElement(mt.UI,{size:40,color:"#DA1E28"})),l().createElement("div",{className:dt.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 gt=n(8748);const ft=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:dt.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:dt.card,key:t},l().createElement("div",{className:dt.colorLineBlue}),l().createElement("div",{className:dt.icon},l().createElement(gt.oq,{size:40,color:"#0F62FE"})),l().createElement("div",{className:dt.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 vt=n(2327);const _t=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:dt.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:dt.card,key:t},l().createElement("div",{className:dt.colorLineGreen}),l().createElement("div",{className:dt.icon},l().createElement(vt.rs,{size:40,color:"#198038"})),l().createElement("div",{className:dt.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"))},ht=function(){var e="tablet"===(0,r.useLayoutType)(),t=(0,E.useTranslation)().t;return l().createElement("div",{className:dt.cardContainer},l().createElement("div",{className:dt.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?dt.tabletHeading:dt.desktopHeading},l().createElement("h4",null,t("Inventory Alerts"))),l().createElement(At,null)))),l().createElement("div",{className:dt.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?dt.tabletHeading:dt.desktopHeading},l().createElement("h4",null,t("Receiving"))),l().createElement(ft,null)))),l().createElement("div",{className:dt.tilesContainer},l().createElement(a.mh4,null,l().createElement(a.n9L,null,l().createElement("div",{className:e?dt.tabletHeading:dt.desktopHeading},l().createElement("h4",null,t("Issuing"))),l().createElement(_t,null)))))};function bt(e){var t=e.dashboardLinkConfig,n=t.name,o=t.title,a=(0,xe.useLocation)(),c="".concat(window.spaBase,"/stock-management"),s=(0,i.useMemo)((function(){var e=a.pathname.split("/"),t=e[e.length-1];return decodeURIComponent(t)}),[a.pathname]);return l().createElement(r.ConfigurableLink,{to:"".concat(c,"/").concat(n),className:"cds--side-nav__link ".concat(s.match(n)&&"active-left-nav-link")},o)}var yt=function(e){return function(){return l().createElement(xe.BrowserRouter,null,l().createElement(bt,{dashboardLinkConfig:e}))}};function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ct(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 kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kt(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 Et=n(1535),wt={};wt.styleTagTransform=h(),wt.setAttributes=g(),wt.insert=p().bind(null,"head"),wt.domAPI=d(),wt.insertStyleElement=v(),s()(Et.Z,wt);const St=Et.Z&&Et.Z.locals?Et.Z.locals:void 0;var Dt="RETURNED",Ot="CANCELLED",xt="REJECTED",Nt=["NEW","SUBMITTED","DISPATCHED","COMPLETED",Dt,Ot,xt],It=n(6817),Tt=n(4642);function Bt(){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,Tt.Z)(s,"id"))&&void 0!==t?t:[],isLoading:c,error:l}}function Pt(e){var t="".concat(r.restBaseUrl,"/role").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ut(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default"),t=(0,j.ZP)(e,r.openmrsFetch),n=t.data,o=t.isLoading,a=t.error;return{types:(null==n?void 0:n.data)||{},isLoading:o,isError:a}}function jt(){var e="".concat(r.restBaseUrl,"/stockmanagement/stockoperationtype?v=default");return(0,r.openmrsFetch)(e)}function zt(e){var t="".concat(r.restBaseUrl,"/user").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Ft(e){var t="".concat(r.restBaseUrl,"/concept/").concat(e),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}function Lt(e,t){(null==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 Rt=function(e){var t=e.onOperationTypeSelected,n=e.onOperationLoaded,o=Ut(),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 Lt(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 Lt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lt(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(It.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 Mt=n(5260),qt={};qt.styleTagTransform=h(),qt.setAttributes=g(),qt.insert=p().bind(null,"head"),qt.domAPI=d(),qt.insertStyleElement=v(),s()(Mt.Z,qt);const Gt=Mt.Z&&Mt.Z.locals?Mt.Z.locals:void 0,Ht=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?Gt.tabContainer:"","\n ").concat(Gt.cohortBuilder,"\n ")},n&&l().createElement("p",{className:Gt.heading},n),l().createElement("div",{className:Gt.tab},l().createElement(a.mQc,{className:"".concat(Gt.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 Zt,Yt;function Qt(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}(Yt=Zt||(Zt={})).TRANSFER_OUT_OPERATION_TYPE="transferout",Yt.DISPOSED_OPERATION_TYPE="disposed",Yt.STOCK_ISSUE_OPERATION_TYPE="stockissue",Yt.STOCK_TAKE_OPERATION_TYPE="stocktake",Yt.REQUISITION_OPERATION_TYPE="requisition",Yt.OPENING_STOCK_OPERATION_TYPE="initial",Yt.RECEIPT_OPERATION_TYPE="receipt",Yt.RETURN_OPERATION_TYPE="return",Yt.ADJUSTMENT_OPERATION_TYPE="adjustment";var Jt=function(e){return"adjustment"===e||"stocktake"===e||"disposed"===e},Wt=function(e){return!Vt(e)&&"requisition"!==e},Vt=function(e){return"receipt"===e||"initial"===e},Kt=function(e){return"requisition"===e},Xt=function(e){return"receipt"===e||"initial"===e},$t=function(e){return"stockissue"===e||"return"===e},en=function(e){return"stockissue"===e||tn(e)||nn(e)||rn(e)},tn=function(e){return"requisition"===e},nn=function(e){return"receipt"===e},rn=function(e){return"transferout"===e},on=n(7536),an=n(6312),ln=n(1604),cn=ln.z.object({id:ln.z.string().nullish(),uuid:ln.z.string().nullish(),stockItemUuid:ln.z.string().nullish(),packagingUomName:ln.z.string().nullish(),packagingUomUuid:ln.z.string().nullish(),factor:ln.z.number().nullish(),isDefaultStockOperationsUoM:ln.z.boolean().nullish(),isDispensingUnit:ln.z.boolean().nullish()}),sn=ln.z.object({canView:ln.z.boolean(),canEdit:ln.z.boolean(),canApprove:ln.z.boolean().nullish(),canReceiveItems:ln.z.boolean().nullish(),canDisplayReceivedItems:ln.z.boolean().nullish(),isRequisitionAndCanIssueStock:ln.z.boolean().nullish(),canUpdateBatchInformation:ln.z.boolean().nullish()}),un=ln.z.object({itemIndex:ln.z.number().nullish(),id:ln.z.string().nullish(),uuid:ln.z.string().nullish(),stockItemUuid:ln.z.string().nullish(),stockItemName:ln.z.string().nullish(),stockItemPackagingUOMUuid:ln.z.string().nullish(),stockItemPackagingUOMName:ln.z.string().nullish(),stockBatchUuid:ln.z.string().nullish(),batchNo:ln.z.string().nullish(),expiration:ln.z.coerce.date().nullish(),quantity:ln.z.number().nullish(),purchasePrice:ln.z.number().nullish(),permission:sn.nullish(),edit:ln.z.boolean().nullish(),hasExpiration:ln.z.boolean().nullish(),packagingUnits:cn.array(),quantityReceived:ln.z.number().nullish(),quantityReceivedPackagingUOMName:ln.z.string().nullish(),quantityReceivedPackagingUOMUuid:ln.z.string().nullish(),quantityRequested:ln.z.number().nullish(),quantityRequestedPackagingUOMUuid:ln.z.string().nullish(),quantityRequestedPackagingUOMName:ln.z.string().nullish(),commonName:ln.z.string().nullish(),acronym:ln.z.string().nullish()}),dn=(ln.z.object({uuid:ln.z.string().nullish(),cancelReason:ln.z.string().nullish(),cancelledBy:ln.z.coerce.number(),cancelledByGivenName:ln.z.string().nullish(),cancelledByFamilyName:ln.z.string().nullish(),cancelledDate:ln.z.coerce.date(),completedBy:ln.z.coerce.number(),completedByGivenName:ln.z.string().nullish(),completedByFamilyName:ln.z.string().nullish(),completedDate:ln.z.coerce.date(),destinationUuid:ln.z.string().nullish(),destinationName:ln.z.string().nullish(),externalReference:ln.z.string().nullish(),atLocationUuid:ln.z.string().nullish(),atLocationName:ln.z.string().nullish(),operationDate:ln.z.coerce.date(),submitted:ln.z.boolean(),submittedBy:ln.z.string().nullish(),submittedByGivenName:ln.z.string().nullish(),submittedByFamilyName:ln.z.string().nullish(),locked:ln.z.boolean(),operationNumber:ln.z.string().nullish(),operationOrder:ln.z.coerce.number(),remarks:ln.z.string().nullish(),sourceUuid:ln.z.string().nullish(),sourceName:ln.z.string().nullish(),status:ln.z.enum(Nt),returnReason:ln.z.string().nullish(),rejectionReason:ln.z.string().nullish(),operationTypeUuid:ln.z.string().nullish(),operationType:ln.z.string().nullish(),operationTypeName:ln.z.string().nullish(),responsiblePerson:ln.z.coerce.number(),responsiblePersonUuid:ln.z.string().nullish(),responsiblePersonGivenName:ln.z.string().nullish(),responsiblePersonFamilyName:ln.z.string().nullish(),responsiblePersonOther:ln.z.string().nullish(),creator:ln.z.coerce.number(),dateCreated:ln.z.coerce.date(),creatorGivenName:ln.z.string().nullish(),creatorFamilyName:ln.z.string().nullish(),permission:sn.nullish(),reasonUuid:ln.z.string().nullish(),reasonName:ln.z.string().nullish(),approvalRequired:ln.z.boolean().nullish(),stockOperationItems:un.array(),submittedDate:ln.z.coerce.date(),returnedByGivenName:ln.z.string().nullish(),returnedByFamilyName:ln.z.string().nullish(),returnedDate:ln.z.coerce.date(),rejectedByGivenName:ln.z.string().nullish(),rejectedByFamilyName:ln.z.string().nullish(),rejectedDate:ln.z.coerce.date(),dispatchedByGivenName:ln.z.string().nullish(),dispatchedByFamilyName:ln.z.string().nullish(),dispatchedDate:ln.z.coerce.date(),requisitionStockOperationUuid:ln.z.string()}),ln.z.object({operationDate:ln.z.coerce.date(),sourceUuid:ln.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),destinationUuid:ln.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reasonUuid:ln.z.string({required_error:"Reason Required"}).min(1,{message:"Reason Required"}),responsiblePersonUuid:ln.z.string({required_error:"Responsible Person Required"}).min(1,{message:"Responsible Person Required"}),responsiblePersonOther:ln.z.string().nullish(),remarks:ln.z.string().nullish()})),mn=function(e){switch(e){case Zt.OPENING_STOCK_OPERATION_TYPE:return dn.omit({destinationUuid:!0,reasonUuid:!0});case Zt.STOCK_TAKE_OPERATION_TYPE:case Zt.ADJUSTMENT_OPERATION_TYPE:case Zt.DISPOSED_OPERATION_TYPE:return dn.omit({destinationUuid:!0});case Zt.TRANSFER_OUT_OPERATION_TYPE:case Zt.STOCK_ISSUE_OPERATION_TYPE:return dn.omit({reasonUuid:!0}).merge(ln.z.object({destinationUuid:ln.z.string({required_error:"Destination Required"}).min(1,{message:"Destination Required"})}));case Zt.RETURN_OPERATION_TYPE:case Zt.REQUISITION_OPERATION_TYPE:case Zt.RECEIPT_OPERATION_TYPE:return dn.omit({reasonUuid:!0}).merge(ln.z.object({sourceUuid:ln.z.string({required_error:"Source Required"}).min(1,{message:"Source Required"})}))}};const pn=function(e){return l().createElement(on.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 An(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gn(e,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 An(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?An(e,t):void 0}}(e,t)||function(){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 fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vn(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 fn(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 fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}),t);clearTimeout(n.current),n.current=i}}var _n=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:""}},hn={uuid:"Other",display:"Other",person:{display:"Other"}};function bn(e){var t;return(null==e||null===(t=e.person)||void 0===t?void 0:t.display)||""}const yn=function(e){var t=function(e){var t=gn((0,i.useState)({v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=zt(n),a=o.items.results,l=o.isLoading,c=gn((0,i.useState)(null),2),s=c[0],u=c[1],d=gn((0,i.useState)(10),2),m=d[0],p=d[1],A=gn((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=vn((function(e){o(e)}),1e3);return r&&r.push(hn),l().createElement("div",null,l().createElement(on.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:bn,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 kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Cn=function(e){return l().createElement(on.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){kn(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t){i(t.target.value),e.onChange&&e.onChange(t)},id:e.id,ref:s,value:null!=c?c:e.value})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n))}})},En=function(e){var t=Ft((0,r.useConfig)().stockAdjustmentReasonUUID),n=t.isLoading,o=t.isError,i=t.items.answers;return n||o?l().createElement(a.xNL,null):l().createElement(on.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 wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Sn=function(e){return l().createElement(on.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){wn(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 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}var On=(0,i.createContext)(null),xn=function(){return(0,i.useContext)(On)},Nn=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 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}}(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(On.Provider,{value:a},r)},In=[Zt.ADJUSTMENT_OPERATION_TYPE,Zt.RECEIPT_OPERATION_TYPE,Zt.STOCK_ISSUE_OPERATION_TYPE,Zt.STOCK_TAKE_OPERATION_TYPE,Zt.RETURN_OPERATION_TYPE,Zt.DISPOSED_OPERATION_TYPE,Zt.OPENING_STOCK_OPERATION_TYPE,Zt.TRANSFER_OUT_OPERATION_TYPE],Tn=[Zt.ADJUSTMENT_OPERATION_TYPE,Zt.DISPOSED_OPERATION_TYPE,Zt.STOCK_TAKE_OPERATION_TYPE,Zt.OPENING_STOCK_OPERATION_TYPE];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 Pn(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 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 jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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}}(e,t)||function(){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 zn=function(e){var t,n,r,o,c,s,u,d,m,p,A,g,f,v=e.model,_=e.onSave,h=e.operation,b=e.canEdit,y=e.isEditing,k=e.setup,C=k.requiresStockAdjustmentReason,w=k.shouldLockSource,S=k.shouldLockDestination,D=k.sourcePartyList,O=k.destinationPartyList,x=(0,E.useTranslation)().t,N=(xn().setFormContext,Ct({v:U.Full,totalCount:!0})),T=N.isLoading,B=(N.items,Qt(null==h?void 0:h.operationType)),P=(d=(u=v).sourceUuid,m=u.sourceName,p=u.destinationUuid,A=u.destinationName,g=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Un(e,t,n[t])}))}return e}({},u),f=null!=(f={sourceUuid:p,sourceName:A,destinationUuid:d,destinationName:m})?f:{},Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(f)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(f)).forEach((function(e){Object.defineProperty(g,e,Object.getOwnPropertyDescriptor(f,e))})),g),j=(0,on.cI)({defaultValues:"stockissue"===B?P:v,mode:"all",resolver:(0,an.F)(mn(B))}),z=j.handleSubmit,F=j.control,L=j.formState.errors,R=j.setValue,M=jn((0,i.useState)(),2),q=M[0],G=M[1],H=jn((0,i.useState)(!1),2),Z=H[0],Y=H[1];if(T)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Q,J,W,V,te,ne,re=function(){var e,t=(e=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),Y(!0),t=function(e,t,n){var r=Object.assign(e,t);return function(e,t){["submitted","cancelledByFamilyName","atLocationName","completedByGivenName","cancelledBy","submittedByFamilyName","operationOrder","dispatchedByGivenName","submittedByGivenName","returnedByGivenName","operationNumber","responsiblePersonFamilyName","returnReason","atLocationUuid","cancelReason","rejectedByGivenName","reasonName","submittedBy","creator","completedByFamilyName","operationTypeName","rejectedByFamilyName","responsiblePerson","creatorFamilyName","returnedByFamilyName","cancelledByGivenName","operationType","responsiblePersonGivenName","sourceName","rejectionReason","completedBy","creatorGivenName","dispatchedByFamilyName","uuid"].forEach((function(t){delete e[t]}))}(r),function(e){return In.includes(e)}(n)&&delete r.destinationName,function(e){return Tn.includes(e)}(n)&&delete r.destinationUuid,r}(v,e,B),[4,_(t)];case 1:case 2:return n.sent(),[3,4];case 3:return Y(!1),[7];case 4:return[2]}}))},function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Pn(a,r,o,i,l,"next",e)}function l(e){Pn(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)},b&&l().createElement(on.Qr,{control:F,render:function(e){var t,n=e.field.onChange;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=jn(e,1)[0];n(t)}},l().createElement(a.aj6,{invalid:!!L.operationDate,invalidText:null==L||null===(t=L.operationDate)||void 0===t?void 0:t.message,id:"operationDate",name:"operationDate",placeholder:K,labelText:x("operationDate","Operation Date"),defaultValue:$(null==v?void 0:v.operationDate)}))},name:"operationDate"}),!b&&l().createElement(l().Fragment,null,l().createElement(a.oil,{id:"operationDateLbl",value:$(null==v?void 0:v.operationDate),readOnly:!0,labelText:"Operation Date"})),y&&(null==v?void 0:v.operationNumber)&&l().createElement(a.oil,{id:"operationNoLbl",value:null==v?void 0:v.operationNumber,readOnly:!0,labelText:"Operation Number"}),b&&!w&&(null==h?void 0:h.hasSource)&&l().createElement(pn,{controllerName:"sourceUuid",name:"sourceUuid",control:F,title:(null==h?void 0:h.hasDestination)?x("from","From"):x("location:","Location"),placeholder:h.hasDestination?x("chooseASource","Choose a source"):x("chooseALocation","Choose a location"),invalid:!!L.sourceUuid,invalidText:L.sourceUuid&&(null==L||null===(t=L.sourceUuid)||void 0===t?void 0:t.message),parties:D||[]}),(!b||y||w)&&l().createElement(a.oil,{id:"sourceUuidLbl",value:"stockissue"===B?P.sourceName:null!==(Q=null==v?void 0:v.sourceName)&&void 0!==Q?Q:"",readOnly:!0,labelText:(null==h||h.hasDestination,"From")}),b&&!S&&(null==h?void 0:h.hasDestination)&&l().createElement(pn,{controllerName:"destinationUuid",name:"destinationUuid",control:F,title:(null==h?void 0:h.hasSource)?"To":"Location",placeholder:(null==h?void 0:h.hasSource)?x("chooseADestination","Choose a destination"):"Location",invalid:!!L.destinationUuid,invalidText:L.destinationUuid&&(null==L||null===(n=L.destinationUuid)||void 0===n?void 0:n.message),parties:O||[]}),(!b||y||S)&&l().createElement(a.oil,{id:"destinationUuidLbl",value:"stockissue"===B?P.destinationName:null!==(J=null==v?void 0:v.destinationName)&&void 0!==J?J:"",readOnly:!0,labelText:(null==h||h.hasSource,"To")}),b&&l().createElement(yn,{controllerName:"responsiblePersonUuid",name:"responsiblePersonUuid",control:F,title:x("responsiblePerson:","Responsible Person"),placeholder:x("filter","Filter ..."),invalid:!!L.responsiblePersonUuid,invalidText:L.responsiblePersonUuid&&(null==L||null===(r=L.responsiblePersonUuid)||void 0===r?void 0:r.message),onUserChanged:function(e){(null==e?void 0:e.uuid)===hn.uuid&&G(!0)}}),q&&l().createElement(Cn,{id:"responsiblePersonOther",name:"responsiblePersonOther",control:F,controllerName:"responsiblePersonOther",maxLength:255,size:"md",value:"".concat(null!==(W=null==v?void 0:v.responsiblePersonOther)&&void 0!==W?W:""),labelText:x("responsiblePerson","Responsible Person"),placeholder:x("pleaseSpecify","Please Specify"),invalid:!!L.responsiblePersonOther,invalidText:L.responsiblePersonOther&&(null==L||null===(o=L.responsiblePersonOther)||void 0===o?void 0:o.message)}),!b&&l().createElement(a.oil,{id:"responsiblePersonLbl",value:null!==(V=(null==v?void 0:v.responsiblePersonUuid)&&(null==v?void 0:v.responsiblePersonUuid)!==hn.uuid?"".concat(null==v?void 0:v.responsiblePersonFamilyName," ").concat(null==v?void 0:v.responsiblePersonGivenName):null==v?void 0:v.responsiblePersonOther)&&void 0!==V?V:"",readOnly:!0,labelText:"Responsible Person"}),C&&b&&l().createElement(En,{controllerName:"reasonUuid",name:"reasonUuid",control:F,placeholder:x("chooseAReason","Choose a reason"),title:x("reason","Reason"),invalid:!!L.reasonUuid,invalidText:L.reasonUuid&&(null==L||null===(c=L.reasonUuid)||void 0===c?void 0:c.message),onReasonChange:function(e){R("reasonUuid",e.uuid)}}),C&&!b&&l().createElement(a.oil,{id:"reasonUuidLbl",value:null!==(te=null==v?void 0:v.reasonName)&&void 0!==te?te:"",readOnly:!0,labelText:"Reason:"}),l().createElement(Sn,{id:"remarks",name:"remarks",control:F,controllerName:"remarks",maxLength:255,value:"".concat(null!==(ne=null==v?void 0:v.remarks)&&void 0!==ne?ne:""),labelText:x("remarks:","Remarks"),invalid:!!L.remarks,invalidText:L.remarks&&(null==L||null===(s=L.remarks)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:z(re),kind:"primary",renderIcon:me.ol},Z?l().createElement(a.lSo,null):x("next","Next")))))};var Fn={stockItemUuid:ln.z.string().min(1,{message:"Required"}),stockItemName:ln.z.string().min(1).nullish(),stockItemPackagingUOMUuid:ln.z.string().min(1,{message:"Required"}),stockItemPackagingUOMName:ln.z.string().min(1).nullish(),batchNo:ln.z.string().min(1,{message:"Required"}),stockBatchUuid:ln.z.string().optional(),expiration:ln.z.coerce.date({required_error:"Required"}),quantity:ln.z.coerce.number().min(1,{message:"Required"}),purchasePrice:ln.z.coerce.number().nullish(),hasExpiration:ln.z.boolean().nullish()},Ln=ln.z.object(Fn),Rn=(Ln.omit({expiration:!0}),ln.z.object({stockItems:ln.z.array(Ln)})),Mn=n(6781),qn={};qn.styleTagTransform=h(),qn.setAttributes=g(),qn.insert=p().bind(null,"head"),qn.domAPI=d(),qn.insertStyleElement=v(),s()(Mn.Z,qn);const Gn=Mn.Z&&Mn.Z.locals?Mn.Z.locals:void 0;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}function Zn(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 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}}(e,t)||function(){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 Yn(e){return e.drugName||e.conceptName}const Qn=function(e){var t=function(e){var t=Zn((0,i.useState)(e||{v:U.Default,limit:10,startIndex:0}),2),n=t[0],r=t[1],o=ge(n),a=o.items.results,l=o.isLoading,c=Zn((0,i.useState)(null),2),s=c[0],u=c[1],d=Zn((0,i.useState)((null==e?void 0:e.limit)||10),2),m=d[0],p=d[1],A=Zn((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=vn((function(e){o(e)}),500);return l().createElement("div",null,l().createElement(on.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:Yn,onInputChange:c,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:s})}}),n&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}))},Jn=function(e){var t,n=he(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(on.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=s.uuid)&&void 0!==t?t:"",render:function(t){var n,r=t.field,o=r.onChange,i=r.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(n=null==c?void 0:c.packagingUnits)&&void 0!==n?n:[],onChange:function(t){var n,r;null===(n=e.onStockPackageChanged)||void 0===n||n.call(e,t.selectedItem),o(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:s,itemToString:function(e){return e.packagingUomName?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):""},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:i})}}))};function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Vn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Kn(e,t){(null==t||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){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 Kn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kn(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 $n(e){var t=Xn((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||U.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0,includeBatchNo:!0}),2),n=t[0],r=t[1],o=Xn((0,i.useState)(10),2),a=o[0],l=o[1],c=Xn((0,i.useState)(null),2),s=c[0],u=c[1],d=Xn((0,i.useState)(1),2),m=d[0],p=d[1],A=Xn((0,i.useState)(null==e?void 0:e.stockItemUuid),2),g=A[0],f=A[1],v=Xn((0,i.useState)(null==e?void 0:e.partyUuid),2),_=v[0],h=v[1],b=Xn((0,i.useState)(null==e?void 0:e.locationUuid),2),y=b[0],k=b[1],C=Xn((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E,includeBatchNo:!0})}),[s,m,a,g,_,y,E]);var S,D=fe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}function er(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const tr=function(e){var t=function(e){var t=Vn((0,i.useState)({v:U.Default,limit:10,startIndex:0,stockItemUuid:e}),2),n=t[0],r=t[1],o=ve(n),a=o.items.results,l=o.isLoading,c=Vn((0,i.useState)(null),2),s=c[0],u=c[1],d=Vn((0,i.useState)(10),2),m=d[0],p=d[1],A=Vn((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=$n(),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){er(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(on.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 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}function rr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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}}(e,t)||function(){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 or=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=rr((0,i.useState)(),2),_=(v[0],v[1]),h=rr((0,i.useState)(),2),b=(h[0],h[1]);return l().createElement(l().Fragment,null,null==f?void 0:f.map((function(e,i){var v,h,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H,Z,Y,Q,J,W,V,te,ne,re="stockItems.".concat(i,".stockItemUuid");return l().createElement(a.SCH,{className:r.isDesktop?Gn.desktopRow:Gn.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(Qn,{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(tr,{batchUuid:null==e?void 0:e.stockBatchUuid,onBatchNoChanged:function(e){p("stockItems.".concat(i,".batchNo"),null==e?void 0:e.batchNo),p("stockItems.".concat(i,".expiration"),null==e?void 0:e.expiration),b(null==e?void 0:e.expiration)},placeholder:"Filter...",invalid:!!(null==A||null===(S=A.stockItems)||void 0===S||null===(w=S[i])||void 0===w?void 0:w.stockBatchUuid),control:m,controllerName:"stockItems.".concat(i,".stockBatchUuid"),name:"stockItems.".concat(i,".stockBatchUuid"),stockItemUuid:e.stockItemUuid}),!(s&&(null==e||null===(D=e.permission)||void 0===D?void 0:D.canUpdateBatchInformation))&&!t&&(null==e?void 0:e.batchNo)),(o||c)&&l().createElement(a.pj1,null,(t||s&&(null==e||null===(O=e.permission)||void 0===O?void 0:O.canUpdateBatchInformation))&&o&&l().createElement(a.Mtg,{id:"expiration-".concat(e.uuid),datePickerType:"single",minDate:$(ee()),locale:"en",dateFormat:X,onChange:function(e){var t=rr(e,1)[0];p("stockItems.".concat(i,".expiration"),t)}},l().createElement(a.aj6,{size:"sm",autoComplete:"off",id:"expiration-input-".concat(e.uuid),name:"operationDate",placeholder:K,defaultValue:$(null==e?void 0:e.expiration),invalid:!!(null==A||null===(N=A.stockItems)||void 0===N||null===(x=N[i])||void 0===x?void 0:x.expiration)})),(!(s&&(null==e||null===(I=e.permission)||void 0===I?void 0:I.canUpdateBatchInformation))&&!t||c)&&$(e.expiration)),l().createElement(a.pj1,null,t&&l().createElement(a.Y2U,{className:"small-placeholder-text",size:"sm",id:"qty-".concat(null==e?void 0:e.uuid),allowEmpty:!0,onChange:function(e){var t;return p("stockItems.".concat(i,".quantity"),null==e||null===(t=e.target)||void 0===t?void 0:t.value)},value:null!==(J=null==e?void 0:e.quantity)&&void 0!==J?J:"",invalidText:null==A||null===(P=A.stockItems)||void 0===P||null===(B=P[i])||void 0===B||null===(T=B.quantity)||void 0===T?void 0:T.message,placeholder:c&&!o&&(null==e?void 0:e.stockBatchUuid)in d?"Bal: ".concat(null!==(W=null===(j=d[null==e?void 0:e.stockBatchUuid])||void 0===j||null===(U=j.quantity)||void 0===U?void 0:U.toLocaleString())&&void 0!==W?W:""," ").concat(null!==(V=null===(z=d[null==e?void 0:e.stockBatchUuid])||void 0===z?void 0:z.quantityUoM)&&void 0!==V?V:""):"",invalid:!!(null==A||null===(L=A.stockItems)||void 0===L||null===(F=L[i])||void 0===F?void 0:F.quantity)}),!t&&(null==e||null===(R=e.quantity)||void 0===R?void 0:R.toLocaleString())),l().createElement(a.pj1,null,t&&l().createElement(Jn,{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:pe.ZN,onClick:function(){return g(i)}})))})))};var ar=n(6360),ir={};ir.styleTagTransform=h(),ir.setAttributes=g(),ir.insert=p().bind(null,"head"),ir.domAPI=d(),ir.insertStyleElement=v(),s()(ar.Z,ir);const lr=ar.Z&&ar.Z.locals?ar.Z.locals:void 0;function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sr(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 ur(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dr(e){return function(e){if(Array.isArray(e))return cr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||mr(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 mr(e,t){if(e){if("string"==typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cr(e,t):void 0}}const pr=function(e){var t,n,o,c,s,u=e.setup,d=u.hasQtyRequested,m=u.requiresBatchUuid,p=u.requiresActualBatchInfo,A=u.canCaptureQuantityPrice,g=u.batchBalance,f=u.batchNos,v=u.canUpdateItemsBatchInformation,_=u.itemUoM,h=e.canEdit,b=void 0===h||h,y=e.model,k=e.onSave,C=e.operation,w=(0,E.useTranslation)().t,S=(null!=C?C:{}).operationType,D=xn().formContext,O=function(e){if("requisition"===e){var t=Ln.omit({batchNo:!0,expiration:!0});return ln.z.object({stockItems:ln.z.array(t)})}return Rn}(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){sr(a,r,o,i,l,"next",e)}function l(e){sr(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)}),N=(0,on.cI)({resolver:(0,an.F)(O),defaultValues:{stockItems:null!==(o=null==y?void 0:y.stockOperationItems)&&void 0!==o?o:[{uuid:"new-item-1",id:"new-item-1"}]},mode:"onSubmit"}),I=N.handleSubmit,T=N.control,B=N.setValue,P=N.formState.errors,U=(c=(0,i.useState)(!1),s=1,function(e){if(Array.isArray(e))return e}(c)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(c,s)||mr(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,on.Dq)({name:"stockItems",control:T}),z=j.fields,F=j.append,L=j.remove;(0,i.useEffect)((function(){if(null==D?void 0:D.stockItems){var e=null==D?void 0:D.stockItems;null==e||e.forEach((function(e){return F(e)}))}}),[F,null==D?void 0:D.stockItems]);var R,M=[{key:"item",header:w("item","Item"),styles:{width:"40% !important"}}].concat(dr(d?[{key:"quantityrequested",header:w("quantityRequested","Quantity Requested")}]:[]),dr(m||p?[{key:"batch",header:w("batchNo","Batch No"),styles:{width:"15% !important"}}]:[]),dr(p?[{key:"expiry",header:w("expiry","Expiry")}]:[]),dr(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")}],dr(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:lr.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){ur(e,t,n[t])}))}return e}({},o({header:e,isSortable:!1})),c=null!=(c={className:r.isDesktop?lr.desktopHeader:lr.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:me.mm,onClick:q,hasIconOnly:!0}),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:function(){return I(x)()},kind:"primary",renderIcon:me.ol},U?l().createElement(a.lSo,null):w("next","Next")))))),l().createElement(a.RMI,null,l().createElement(or,{rows:null!==(t=null==y?void 0:y.stockOperationItems)&&void 0!==t?t:[{uuid:"new-item-1",id:"new-item-1"}],batchBalance:g,batchNos:f,control:T,setValue:B,errors:P,remove:L,append:F,canEdit:b,showQuantityRequested:d,requiresActualBatchInformation:p,requiresBatchUuid:m,canUpdateBatchInformation:v,canCapturePurchasePrice:A,itemUoM:_,fields:z})," ")))}})))};var Ar=n(8808);function gr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function vr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){fr(a,r,o,i,l,"next",e)}function l(e){fr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function _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 gr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gr(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){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 br=function(e){var t=e.canEdit,n=e.locked,r=e.model,o=e.requiresDispatchAcknowledgement,c=e.actions,s=(0,E.useTranslation)().t,u=_r((0,i.useState)(!1),2),d=u[0],m=u[1],p=_r((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:vr((function(){return hr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onComplete(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:Pe.X4},s("complete","Complete")),o&&!A&&l().createElement(a.zxk,{name:"dispatch",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:vr((function(){return hr(this,(function(e){switch(e.label){case 0:return null==r||delete r.dateCreated,null==r||delete r.status,m(!0),[4,c.onSave(r).then((function(){null==r||delete r.dateCreated,r.status="COMPLETED",m(!0),c.onDispatch(r),m(!1)}))];case 1:return e.sent(),[2]}}))})),renderIcon:gt.bS},s("dispatch","Dispatch")),A&&l().createElement(a.zxk,{name:"submit",type:"button",style:{margin:"4px"},className:"submitButton",kind:"primary",onClick:c.onSubmit,renderIcon:Ar.f5},s("submit","Submit For Review"))),l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",style:{margin:"4px"},disabled:d,onClick:vr((function(){return hr(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:Ar.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:pe.WP},s("goBack","Go Back"))))};var yr="Location",kr="Other";function Cr(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 Er(){var e;return e=function(e,t,n){var o,a,i,l,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,q,G,H;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(_n()),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,Zt.STOCK_ISSUE_OPERATION_TYPE,[4,(Q="".concat(r.restBaseUrl,"/stockmanagement/party?v=default"),(0,r.openmrsFetch)(Q))]):[3,2];case 1:if(!(I=Z.sent()).ok)throw Error("Error loading parties");return D=null==I||null===(N=I.data)||void 0===N||null===(x=N.results)||void 0===x?void 0:x.filter((function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===yr&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===kr})),(null==e?void 0:e.hasSource)&&A&&k&&(null==D?void 0:D.length)>0&&(T=D[0],p.sourceUuid=T.uuid,p.sourceName=T.name,S=null==T?void 0:T.locationUuid),(null==e?void 0:e.hasDestination)&&(O=null==I||null===(P=I.data)||void 0===P||null===(B=P.results)||void 0===B?void 0:B.filter((function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===yr&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===kr})),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,jt()];case 3:if(!(j=Z.sent()).ok)throw Error("Error loading operation types");v=j.data.results,Z.label=4;case 4:return z=Qt(e.operationType),[2,{batchBalance:{},batchNos:{},itemUoM:{},requisition:"",showQuantityRequested:!1,dto:p,stockItems:g,isNegativeQuantityAllowed:(Y=z,"adjustment"===Y),requiresBatchUuid:Wt(z),requiresActualBatchInfo:Vt(z),isQuantityOptional:Kt(z),canCaptureQuantityPrice:Xt(z),requiresStockAdjustmentReason:Jt(z),requiresDispatchAcknowledgement:$t(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||en(z),sourceTags:y,destinationTags:E,shouldLockDestination:w,shouldLockSource:k,sourcePartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.sourceType)===yr&&(0===y.length||t.tags&&y.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.sourceType)===kr},destinationPartyListFilter:function(t){return t.locationUuid&&(null==e?void 0:e.destinationType)===yr&&(0===E.length||t.tags&&E.some((function(e){return t.tags.includes(e)})))||t.stockSourceUuid&&(null==e?void 0:e.destinationType)===kr},location:S,sourcePartyList:D,destinationPartyList:O,stockOperationTypes:v,hasQtyRequested:f}]}var Y,Q}))},Er=function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Cr(a,r,o,i,l,"next",e)}function l(e){Cr(a,r,o,i,l,"throw",e)}i(void 0)}))},Er.apply(this,arguments)}function wr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sr(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 wr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(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 Or(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const xr=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Approve",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,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]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Or(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Approve "))};function Nr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ir=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"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){Nr(e,t,n[t])}))}return e}({size:16},e))}},n("reject","Reject "))};function Tr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Br=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"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(Me.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){Tr(e,t,n[t])}))}return e}({size:16},e))}},n("return","Return "))};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}const Ur=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(vt.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){Pr(e,t,n[t])}))}return e}({size:16},e))}},n("cancel","Cancel "))};function jr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}var zr,Fr,Lr=(zr=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={},Zt.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):Zt.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]}))},Fr=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=zr.apply(e,t);function a(e){jr(o,n,r,a,i,"next",e)}function i(e){jr(o,n,r,a,i,"throw",e)}a(void 0)}))},function(e,t,n,r,o){return Fr.apply(this,arguments)});function Rr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Mr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Rr(a,r,o,i,l,"next",e)}function l(e){Rr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function qr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Gr=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return'<html>\n<head>\n<meta http-equiv=Content-Type content="text/html; charset=utf8">\n<title>'.concat(null!=t?t:"","</title>\n<style>\n").concat('\n/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */\n\n/* Document\n ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n ========================================================================== */\n\n/**\n * Remove the margin in all browsers.\n */\n\nbody {\n margin: 0;\n}\n\n/**\n * Render the main element consistently in IE.\n */\n\nmain {\n display: block;\n}\n\n/**\n * Correct the font size and margin on h1 elements within section and\n * article contexts in Chrome, Firefox, and Safari.\n */\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\n/* Grouping content\n ========================================================================== */\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Show the overflow in Edge and IE.\n */\n\nhr {\n box-sizing: content-box; /* 1 */\n height: 0; /* 1 */\n overflow: visible; /* 2 */\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\npre {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/* Text-level semantics\n ========================================================================== */\n\n/**\n * Remove the gray background on active links in IE 10.\n */\n\na {\n background-color: transparent;\n}\n\n/**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n\nabbr[title] {\n border-bottom: none; /* 1 */\n text-decoration: underline; /* 2 */\n text-decoration: underline dotted; /* 2 */\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\nb,\nstrong {\n font-weight: bold;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd em font sizing in all browsers.\n */\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\nsmall {\n font-size: 80%;\n}\n\n/**\n * Prevent sub and sup elements from affecting the line height in\n * all browsers.\n */\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/* Embedded content\n ========================================================================== */\n\n/**\n * Remove the border on images inside links in IE 10.\n */\n\nimg {\n border-style: none;\n}\n\n/* Forms\n ========================================================================== */\n\n/**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n\nbutton,\ninput { /* 1 */\n overflow: visible;\n}\n\n/**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n\nbutton,\n[type="button"],\n[type="reset"],\n[type="submit"] {\n -webkit-appearance: button;\n}\n\n/**\n * Remove the inner border and padding in Firefox.\n */\n\nbutton::-moz-focus-inner,\n[type="button"]::-moz-focus-inner,\n[type="reset"]::-moz-focus-inner,\n[type="submit"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus styles unset by the previous rule.\n */\n\nbutton:-moz-focusring,\n[type="button"]:-moz-focusring,\n[type="reset"]:-moz-focusring,\n[type="submit"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Correct the padding in Firefox.\n */\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\n/**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from fieldset elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * fieldset elements in all browsers.\n */\n\nlegend {\n box-sizing: border-box; /* 1 */\n color: inherit; /* 2 */\n display: table; /* 1 */\n max-width: 100%; /* 1 */\n padding: 0; /* 3 */\n white-space: normal; /* 1 */\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Firefox, and Opera.\n */\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\n * Remove the default vertical scrollbar in IE 10+.\n */\n\ntextarea {\n overflow: auto;\n}\n\n/**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n\n[type="checkbox"],\n[type="radio"] {\n box-sizing: border-box; /* 1 */\n padding: 0; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n\n[type="number"]::-webkit-inner-spin-button,\n[type="number"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n[type="search"] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n\n[type="search"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to inherit in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/* Interactive\n ========================================================================== */\n\n/*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n\ndetails {\n display: block;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\nsummary {\n display: list-item;\n}\n\n/* Misc\n ========================================================================== */\n\n/**\n * Add the correct display in IE 10+.\n */\n\ntemplate {\n display: none;\n}\n\n/**\n * Add the correct display in IE 10.\n */\n\n[hidden] {\n display: none;\n}\n/*!\n * Gutenberg\n *\n * MIT Fabien Sa\n * https://github.com/BafS/Gutenberg\n */\n\n* {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n *,\n *:before,\n *:after,\n p:first-letter,\n div:first-letter,\n blockquote:first-letter,\n li:first-letter,\n p:first-line,\n div:first-line,\n blockquote:first-line,\n li:first-line {\n background: transparent !important;\n box-shadow: none !important;\n text-shadow: none !important;\n }\n \n html {\n font-size: 16px;\n margin: 0;\n padding: 0;\n }\n \n body {\n -moz-osx-font-smoothing: grayscale;\n -webkit-font-smoothing: antialiased;\n background: #fff !important;\n color: #000 !important;\n font-family: Arial, sans-serif, "Helvetica Neue", Helvetica;\n font-size: 1rem;\n line-height: 1.5;\n margin: 0 auto;\n text-rendering: optimizeLegibility;\n }\n \n p,\n blockquote,\n table,\n ul,\n ol,\n dl {\n margin-bottom: 1.5rem;\n margin-top: 0;\n }\n \n p:last-child,\n ul:last-child,\n ol:last-child {\n margin-bottom: 0;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: #000;\n font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n line-height: 1.2;\n margin-bottom: 0.75rem;\n margin-top: 0;\n }\n \n h1 {\n font-size: 2.5rem;\n }\n \n h2 {\n font-size: 2rem;\n }\n \n h3 {\n font-size: 1.75rem;\n }\n \n h4 {\n font-size: 1.5rem;\n }\n \n h5 {\n font-size: 1.25rem;\n }\n \n h6 {\n font-size: 1rem;\n }\n \n a,\n a:visited {\n color: #000;\n text-decoration: underline;\n word-wrap: break-word;\n }\n \n table {\n border-collapse: collapse;\n }\n \n thead {\n display: table-header-group;\n }\n \n table,\n th,\n td {\n border-bottom: 1px solid #000;\n }\n \n td,\n th {\n padding: 0px;\n page-break-inside: avoid;\n }\n \n code,\n pre,\n kbd {\n border: 1px solid #bbb;\n font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n font-size: 85%;\n }\n \n code,\n kbd {\n padding: 3px;\n }\n \n pre {\n margin-bottom: 1.5rem;\n padding: 10px 12px;\n }\n \n pre code,\n pre kbd {\n border: 0;\n }\n \n ::-webkit-input-placeholder {\n color: transparent;\n }\n \n :-moz-placeholder {\n color: transparent;\n }\n \n ::-moz-placeholder {\n color: transparent;\n }\n \n :-ms-input-placeholder {\n color: transparent;\n }\n \n blockquote {\n border: 0;\n border-left: 5px solid #bbb;\n margin-left: 1px;\n padding: 12px 1.5rem;\n }\n \n [dir=\'rtl\'] blockquote {\n border-left: 0;\n border-right: 5px solid #bbb;\n margin-left: 0;\n margin-right: 1px;\n }\n \n blockquote:first-child {\n margin-top: 0;\n }\n \n blockquote p:last-child,\n blockquote ul:last-child,\n blockquote ol:last-child {\n margin-bottom: 0;\n }\n \n blockquote footer {\n display: block;\n font-size: 80%;\n }\n \n img {\n border: 0;\n display: block;\n max-width: 100% !important;\n vertical-align: middle;\n }\n \n hr {\n border: 0;\n border-bottom: 2px solid #bbb;\n height: 0;\n margin: 2.25rem 0;\n padding: 0;\n }\n \n dt {\n font-weight: bold;\n }\n \n dd {\n margin: 0;\n margin-bottom: 0.75rem;\n }\n \n abbr[title],\n acronym[title] {\n border: 0;\n text-decoration: none;\n }\n \n table,\n blockquote,\n pre,\n code,\n figure,\n li,\n hr,\n ul,\n ol,\n a,\n tr {\n page-break-inside: avoid;\n }\n \n h2,\n h3,\n h4,\n p,\n a {\n orphans: 3;\n widows: 3;\n }\n \n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n page-break-after: avoid;\n page-break-inside: avoid;\n }\n \n h1+p,\n h2+p,\n h3+p {\n page-break-before: avoid;\n }\n \n img {\n page-break-after: auto;\n page-break-before: auto;\n page-break-inside: avoid;\n }\n \n pre {\n white-space: pre-wrap !important;\n word-wrap: break-word;\n }\n \n body {\n padding-bottom: 1cm;\n padding-left: 1cm;\n padding-right: 1cm;\n padding-top: 0.5cm;\n }\n \n a[href^=\'http\']:after,\n a[href^=\'ftp\']:after {\n content: " (" attr(href) ")";\n font-size: 80%;\n }\n \n a[href$=\'.jpg\']:after,\n a[href$=\'.jpeg\']:after,\n a[href$=\'.gif\']:after,\n a[href$=\'.png\']:after {\n display: none;\n }\n \n abbr[title]:after,\n acronym[title]:after {\n content: " (" attr(title) ")";\n }\n \n .page-break,\n .break-before,\n .page-break-before {\n page-break-before: always;\n }\n \n .break-after,\n .page-break-after {\n page-break-after: always;\n }\n \n .avoid-break-inside {\n page-break-inside: avoid;\n }\n \n .no-print {\n display: none;\n }\n \n a.no-reformat:after {\n content: \'\';\n }\n \n abbr[title].no-reformat:after,\n acronym[title].no-reformat:after {\n content: \'\';\n }\n \n .no-reformat abbr:after,\n .no-reformat acronym:after,\n .no-reformat a:after {\n content: \'\';\n }\n /*Custom CSS*/\n .right {\n display: flex;\n justify-content: flex-end;\n margin-left: auto;\n margin-right: 0;\n } \n .text {\n margin-top:0in;\n margin-right:0in;\n margin-bottom:3.0pt;\n margin-left:0in;\n line-height:106%;\n font-size:12.5pt;\n } \n .logo-row {\n width: 99%;\n }\n .logo {\n width: 120; \n line-height:110%;\n text-align: center;\n margin-top: 4pt;\n }\n .logo img, .logo svg {\n width: 52;\n height: auto;\n }\n span.logo-text {\n font-size:8.0pt;\n display: block;\n white-space:nowrap;\n line-height: 110%;\n margin-top: 4pt;\n } \n .heading, .heading-row {\n margin-left:12.75pt;\n clear: both;\n }\n .heading {\n font-size:14.5pt;\n line-height:102%;\n }\n .heading-row, .heading-row table { \n font-size: 13.5pt;\n }\n .heading-row {\n margin-top: 14pt;\n }\n .heading table, .heading-row table, .heading-row td {\n border: 0;\n }\n .table-data {\n border: 0;\n border-collapse:collapse;\n margin-left:6.95pt;\n font-size:12.5pt;\n width: 99%;\n page-break-inside: auto;\n }\n .table-data td, .table-data th {\n padding:0 5.75pt 0 5.15pt;\n }\n .table-data td, .table-data th {\n border-top:none;\n border-left:none;\n border-right:solid black 1.0pt;\n vertical-align: middle;\n height: 30pt;\n }\n .table-data th {\n border-bottom:double black 1.5pt;\n } \n .table-data td {\n border-bottom:solid black 1.0pt;\n }\n .table-data th:first-child, .table-data td:first-child {\n border-left:solid black 1.0pt;\n } \n .center {\n text-align: center;\n } \n .left {\n text-align: left;\n }\n .table-data tr.footer-field td {\n height:32pt;\n vertical-align: middle;\n }\n @page { size: auto; margin: 0mm; }\n','\n</style>\n</head>\n<body onload="').concat(n?"window.print()":"","\" style='word-wrap:break-word' ").concat(r?'onafterprint="self.close()"':"",">\n ").concat(e,"\n</body>\n</html>")},Hr=function(){var e=Mr((function(){var e,t;return qr(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)}}(),Zr=function(){var e=Mr((function(){var e;return qr(this,(function(t){switch(t.label){case 0:return[4,Hr()];case 1:return e=t.sent(),[2,'\n<div class="logo-row right">\n'.concat(e,"\n</div> \n ")]}}))}));return function(){return e.apply(this,arguments)}}(),Yr=function(e){setTimeout((function(){!function(e){var t=window.open("","Print-Window");t&&(t.document.open(),t.document.write(e),t.document.close())}(e)}),300)};function Qr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Jr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Qr(a,r,o,i,l,"next",e)}function l(e){Qr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Wr(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Vr=function(){var e=Jr((function(e){var t,n,r,o,a,i,l,c,s;return Wr(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Goods Received Note</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Delivered To: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>GRN#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Received From: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.source)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(V(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th> \n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Purchase Price</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i,l,c;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(r=e.itemCode)&&void 0!==r?r:"",'</td>\n <td valign="middle">').concat(null!==(o=e.itemDescription)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(null!==(a=e.batchNumber)&&void 0!==a?a:"",'</td> \n <td valign="middle" class="center">').concat(V(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(i=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==i?i:""," ").concat(null!==(l=e.quantityRequiredUoM)&&void 0!==l?l:"",'</td>\n <td valign="middle" class="center">').concat(null!==(c=null===(n=e.purchasePrice)||void 0===n?void 0:n.toLocaleString())&&void 0!==c?c:"","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle">&nbsp;</td>\n <td valign="middle">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</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 &nbsp;\n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),Kr=function(){var e=Jr((function(e){var t;return Wr(this,(function(n){switch(n.label){case 0:return[4,Vr(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function Xr(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function $r(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Xr(a,r,o,i,l,"next",e)}function l(e){Xr(a,r,o,i,l,"throw",e)}i(void 0)}))}}function eo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var to=function(){var e=$r((function(e){var t,n,r,o,a,i,l,c,s;return eo(this,(function(u){switch(u.label){case 0:return r=Math.max(0,25-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=u.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text center" style="text-transform: uppercase;font-size: 20pt;">\n <b>Inventory Transfer</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer From: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;">\n <span>Transfer#: </span>\n <b><span>').concat(null==e?void 0:e.operationNumber,'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Transfer To: </span>\n <b><span>').concat(null!==(l=null==e?void 0:e.destination)&&void 0!==l?l:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(V(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0"> \n <tr>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Code No.</b></th>\n <th valign="middle" class="left" style="border-top:solid black 1.0pt;"><b>Item Description (name, formulation, strength)</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Batch No.</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Expiry</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Quantity</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Unit Cost</b></th>\n <th valign="middle" style="border-top:solid black 1.0pt;"><b>Total Cost</b></th>\n </tr> \n ').concat((null==e?void 0:e.items)?null==e?void 0:e.items.map((function(e){var t,n,r,o,a,i;return'\n <tr class="data-row">\n <td valign="middle">'.concat(null!==(n=e.itemCode)&&void 0!==n?n:"",'</td>\n <td valign="middle">').concat(null!==(r=e.itemDescription)&&void 0!==r?r:"",'</td> \n <td valign="middle" class="center">').concat(null!==(o=e.batchNumber)&&void 0!==o?o:"",'</td> \n <td valign="middle" class="center">').concat(V(e.expiryDate),'</td> \n <td valign="middle" class="center">').concat(null!==(a=null===(t=e.quantityRequired)||void 0===t?void 0:t.toLocaleString())&&void 0!==a?a:""," ").concat(null!==(i=e.quantityRequiredUoM)&&void 0!==i?i:"",'</td>\n <td valign="middle" class="center">').concat("",'</td>\n <td valign="middle" class="center">').concat("","</td>\n </tr> \n ")})).join(""):"","\n ").concat(r>0?Array(r).fill(0).map((function(e){return'\n <tr class="data-row">\n <td valign="middle">&nbsp;</td>\n <td valign="middle">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</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 &nbsp;\n </td>\n </tr>\n <tr class="footer-field">\n <td valign="middle" colspan="4" style="border:0;"><br/><br/>Signature</td>\n <td valign="middle" colspan="3" style="border:0;"><br/><br/>Signature</td>\n </tr> \n </table> \n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),no=function(){var e=$r((function(e){var t;return eo(this,(function(n){switch(n.label){case 0:return[4,to(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function ro(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function oo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ro(a,r,o,i,l,"next",e)}function l(e){ro(a,r,o,i,l,"throw",e)}i(void 0)}))}}function ao(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var io=function(){var e=oo((function(e){var t,n,r,o,a,i,l,c;return ao(this,(function(s){switch(s.label){case 0:return r=Math.max(0,28-(null!==(n=null==e||null===(t=e.items)||void 0===t?void 0:t.length)&&void 0!==n?n:0)),[4,Zr()];case 1:return o=s.sent(),[2,"\n <div>\n ".concat(o,'\n <div class="heading text">\n <b>HMIS FORM 017: REQUISITION AND ISSUE VOUCHER</b>\n </div>\n <div class="heading-row text">\n <span>Name of Health Unit: </span>\n <b><span>').concat(null!==(a=null==e?void 0:e.organizationName)&&void 0!==a?a:"",'</span></b>\n </div>\n <div class="heading-row text">\n <table style="width:99%" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td style="text-align: left;">\n <span>Dept/section/ward/dispensary: </span>\n <b><span>').concat(null!==(i=null==e?void 0:e.location)&&void 0!==i?i:"",'</span></b>\n </td>\n <td style="text-align: right;"> \n <span>Date: </span>\n <b><span>').concat(V(null==e?void 0:e.operationDate),'</span></b>\n </td>\n </tr>\n </table>\n </div>\n <table class="table-data" border="0" cellspacing="0" cellpadding="0">\n <tr>\n <td colspan="4" valign="top" style=\'border:solid black 1.0pt;height:40pt\'>\n <div class=\'text\'><b>Ordered by (Name and signature):</b></div>\n <p class=\'text\' style=\'margin-top: 1pt;\'>').concat(null!==(l=e.orderedBy)&&void 0!==l?l:"&nbsp;","</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:"&nbsp;",'</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">&nbsp;</td>\n <td valign="middle">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</td>\n <td valign="middle" class="center">&nbsp;</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 &amp; Signature receiver:</td>\n <td valign="middle" colspan="4">Name &amp; Signature issuer:</td>\n </tr>\n </table>\n </div>\n ')]}}))}));return function(t){return e.apply(this,arguments)}}(),lo=function(){var e=oo((function(e){var t;return ao(this,(function(n){switch(n.label){case 0:return[4,io(e)];case 1:return t=n.sent(),Yr(Gr(t,null==e?void 0:e.documentTitle,!0,ie)),[2]}}))}));return function(t){return e.apply(this,arguments)}}();function co(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function so(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uo=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=((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){co(a,r,o,i,l,"next",e)}function l(e){co(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(){var e,n,o,a,i,l,c,s;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),n=null,o=null,t.requisitionStockOperationUuid&&(L(t.requisitionStockOperationUuid).then((function(t){t.error||(e=t)})).catch((function(e){e.error})),!e)?[2,null]:((e||"stockissue"===(null==e?void 0:e.operationType)||"transferout"===(null==e?void 0:e.operationType))&&(a={},(null==t?void 0:t.uuid)&&(a.stockOperationUuid=t.uuid),(d=a,m="".concat(r.restBaseUrl,"/stockmanagement/stockoperationitemcost?v=default&stockOperationUuid=").concat(d),p=new AbortController,(0,r.openmrsFetch)(m,{method:"GET",headers:{"Content-Type":"application/json"},signal:p.signal})).then((function(e){e.error||(n=null==e?void 0:e.results)})).catch((function(e){e.error}))),(e||"requisition"===(null==e?void 0:e.operationType))&&(i={},null==t||t.uuid,i.locationUuid=t.atLocationUuid,i.stockOperationUuid=t.uuid,i.v=U.Default,i.groupBy="LocationStockItem",i.includeStockItemName="true",i.date=JSON.stringify(null!==(l=null==e?void 0:e.dateCreated)&&void 0!==l?l:null==t?void 0:t.dateCreated),function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockiteminventory").concat(z(e)),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal})}(i).then((function(e){e.error||(o=null==e?void 0:e.results)})).catch((function(e){e.error}))),[4,Lr(t,t.stockOperationItems,e,n,o)]);case 1:return(c=u.sent())?"receipt"!==(null==t?void 0:t.operationType)?[3,3]:[4,Kr(c)]:[3,8];case 2:return u.sent(),[3,7];case 3:return"transferout"!==(null==t?void 0:t.operationType)?[3,5]:[4,no(c)];case 4:return u.sent(),[3,7];case 5:return[4,lo(c)];case 6:u.sent(),u.label=7;case 7:return[3,9];case 8:console.info(c),u.label=9;case 9:return[3,11];case 10:return s=u.sent(),console.info(s),[3,11];case 11:return[2]}var d,m,p}))}));return function(){return e.apply(this,arguments)}}());return l().createElement(a.zxk,{onClick:o,kind:"tertiary",renderIcon:function(e){return l().createElement(C.FB,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){so(e,t,n[t])}))}return e}({size:16},e))}},n("print","Print "))};function mo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const po=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Dispatch",operation:t,requireReason:!0,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(gt.bS,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){mo(e,t,n[t])}))}return e}({size:16},e))}},n("approve","Dispatch"))};function Ao(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const go=function(e){var t=e.operation,n=(0,E.useTranslation)().t,o=(0,i.useCallback)((function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"Complete Dispatch",operation:t,requireReason:!1,closeModal:function(){return e()}})}),[t]);return l().createElement(a.zxk,{onClick:o,renderIcon:function(e){return l().createElement(me.aP,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ao(e,t,n[t])}))}return e}({size:16},e))}},n("complete","Complete Dispatch "))};function fo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){fo(e,t,n[t])}))}return e}const _o=function(e){var t,n,r,o,i=e.operation,c=e.operations,s=(0,E.useTranslation)().t,u={uuid:"",name:"Stock Issue",description:"",operationType:"stockissue",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1},d=(n=(t=i).uuid,r=vo({},t),o=null!=(o={requisitionStockOperationUuid:n})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r);return l().createElement(a.zxk,{onClick:function(){Uo(d,!1,u,c,!1)},kind:"tertiary",renderIcon:function(e){return l().createElement(gt.ei,vo({size:16},e))}},s("issueStock","Issue Stock "))};var ho=n(2496),bo={};bo.styleTagTransform=h(),bo.setAttributes=g(),bo.insert=p().bind(null,"head"),bo.domAPI=d(),bo.insertStyleElement=v(),s()(ho.Z,bo);const yo=ho.Z&&ho.Z.locals?ho.Z.locals:void 0;function ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Co(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Eo(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Co(a,r,o,i,l,"next",e)}function l(e){Co(a,r,o,i,l,"throw",e)}i(void 0)}))}}function wo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function So(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){wo(e,t,n[t])}))}return e}function Do(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Oo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ko(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ko(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}const No=function(e){var t,n,o,c,s,u,d,m,p,A,g,f,v,_,h,b,y,k,C,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L,R,M,G,H,Z,Y,J,W,V,K,X,$,ee,te,ne,re,oe,ae,ie,le,ce,se,ue,de,me,pe,Ae,ge,fe,ve,_e,he,be,ye,ke,Ce,Ee,we,Se,De,Oe=(0,E.useTranslation)().t,xe=e.isEditing,Ne=e.canEdit,Ie=e.canPrint,Te=function(e){var t=Sr((0,i.useState)(!0),2),n=t[0],r=t[1],o=Sr((0,i.useState)(!1),2),a=o[0],l=o[1],c=Sr((0,i.useState)(),2),s=c[0],u=c[1];return(0,i.useEffect)((function(){r(!0),function(e,t,n){return Er.apply(this,arguments)}(e.operation,e.model,e.operations).then((function(e){u(e),r(!1)})).catch((function(){l(!0)}))}),[e.model,e.operation,e.operations]),{isLoading:n,isError:a,result:s}}(e),Be=Te.isLoading,Pe=Te.isError,Ue=Te.result,je=Oo((0,i.useState)(null==e?void 0:e.isEditing),2),ze=je[0],Fe=je[1],Le=Oo((0,i.useState)(null==e?void 0:e.isEditing),2),Re=Le[0],Me=Le[1],qe=Oo((0,i.useState)(0),2),Ge=qe[0],He=qe[1];if(Be)return l().createElement(a.MHR,null);if(Pe)return Q(),void(0,r.showSnackbar)({kind:"error",title:Oe("error","Error"),subtitle:Oe("errorLoadingStockOperation","Error loading stock item"),timeoutInMs:5e3,isLowContrast:!0});var Ze=[{name:"".concat(xe?null==e||null===(t=e.model)||void 0===t?void 0:t.operationTypeName:null==e||null===(n=e.operation)||void 0===n?void 0:n.name," Details"),component:l().createElement(zn,Do(So({},e),{isEditing:"Stock Issue"===(null==e||null===(o=e.operation)||void 0===o?void 0:o.name)?!xe:xe,setup:Ue,canEdit:"Stock Issue"===(null==e||null===(c=e.operation)||void 0===c?void 0:c.name)?!Ne:Ne,model:xe||"Stock Issue"===(null==e||null===(s=e.operation)||void 0===s?void 0:s.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,onSave:Eo((function(){return xo(this,(function(e){return Fe(!0),He(1),[2]}))})),operation:null==e?void 0:e.operation}))},{name:Oe("stockItems","Stock Items"),component:l().createElement(pr,Do(So({},e),{isEditing:xe,setup:Ue,canEdit:Ne,model:xe||"Stock Issue"===(null==e||null===(u=e.operation)||void 0===u?void 0:u.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,onSave:Eo((function(){return xo(this,(function(e){return Me(!0),He(2),[2]}))}))})),disabled:!(xe||ze)},{name:(null==Ue?void 0:Ue.requiresDispatchAcknowledgement)?"Submit/Dispatch":"Submit/Complete",component:l().createElement(br,Do(So({},e),{isEditing:xe,setup:Ue,canEdit:Ne,locked:!1,model:xe||"Stock Issue"===(null==e||null===(d=e.operation)||void 0===d?void 0:d.name)?null==e?void 0:e.model:null==Ue?void 0:Ue.dto,requiresDispatchAcknowledgement:xe?"return"===(null==e||null===(m=e.model)||void 0===m?void 0:m.operationType)||"issuestock"===(null==e||null===(p=e.model)||void 0===p?void 0:p.operationType):Ue.requiresDispatchAcknowledgement,actions:{onSave:function(){var t=Eo((function(t){return xo(this,(function(n){switch(n.label){case 0:return[4,Po(t,e.isEditing,e.operation,e.operations,e.canPrint)];case 1:return n.sent(),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),onGoBack:function(){He(1)},onComplete:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Complete",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onSubmit:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Submit",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))})),onDispatch:Eo((function(){return xo(this,(function(t){switch(t.label){case 0:return[4,jo("Dispatch",!0,null==e?void 0:e.model)];case 1:return t.sent(),[2]}}))}))}})),disabled:!(e.isEditing||Re)}];return l().createElement(l().Fragment,null,xe||"Stock Issue"!==e.operation.name?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",margin:"5px"}},l().createElement("div",{style:{margin:"10px"}},xe&&l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement("span",{className:yo.textHeading},Oe("status","Status "),":"),l().createElement("span",{style:{marginLeft:"2px",color:"".concat(q(null==e||null===(A=e.model)||void 0===A?void 0:A.status))}},null==e||null===(g=e.model)||void 0===g?void 0:g.status)),l().createElement("div",{className:yo.statusContainer},(null==e||null===(f=e.model)||void 0===f?void 0:f.dateCreated)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("started","Started"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(v=e.model)||void 0===v?void 0:v.dateCreated.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(_=e.model)||void 0===_?void 0:_.creatorFamilyName,"  ",null==e||null===(h=e.model)||void 0===h?void 0:h.creatorGivenName))),(null==e||null===(b=e.model)||void 0===b?void 0:b.submittedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("submitted","Submitted"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(y=e.model)||void 0===y?void 0:y.submittedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(k=e.model)||void 0===k?void 0:k.submittedByFamilyName,"  ",null==e||null===(C=e.model)||void 0===C?void 0:C.submittedByGivenName))),(null==e||null===(w=e.model)||void 0===w?void 0:w.dispatchedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("dispatched","Dispatched"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(S=e.model)||void 0===S?void 0:S.dispatchedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(D=e.model)||void 0===D?void 0:D.dispatchedByFamilyName,"  ",null==e||null===(O=e.model)||void 0===O?void 0:O.dispatchedByGivenName))),(null==e||null===(x=e.model)||void 0===x?void 0:x.returnedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("returned","Returned"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(N=e.model)||void 0===N?void 0:N.returnedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(I=e.model)||void 0===I?void 0:I.returnedByFamilyName,"  ",null==e||null===(T=e.model)||void 0===T?void 0:T.returnedByGivenName),l().createElement("span",{className:yo.text},null==e||null===(B=e.model)||void 0===B?void 0:B.returnReason))),(null==e||null===(P=e.model)||void 0===P?void 0:P.completedDate)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("completed","Completed"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(U=e.model)||void 0===U?void 0:U.completedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(j=e.model)||void 0===j?void 0:j.completedByFamilyName,"  ",null==e||null===(z=e.model)||void 0===z?void 0:z.completedByGivenName))),"CANCELLED"===(null==e||null===(F=e.model)||void 0===F?void 0:F.status)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("cancelled","Cancelled"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(L=e.model)||void 0===L?void 0:L.cancelledDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(R=e.model)||void 0===R?void 0:R.cancelledByFamilyName,"  ",null==e||null===(M=e.model)||void 0===M?void 0:M.cancelledByGivenName,l().createElement("span",{className:yo.text},null==e||null===(G=e.model)||void 0===G?void 0:G.cancelReason)))),"REJECTED"===(null==e||null===(H=e.model)||void 0===H?void 0:H.status)&&l().createElement("div",null,l().createElement("span",{className:yo.textHeading},Oe("rejected","Rejected"),":"),l().createElement("div",{className:yo.statusDescriptions},l().createElement("span",{className:yo.text},(0,r.formatDate)((0,r.parseDate)(null==e||null===(Z=e.model)||void 0===Z?void 0:Z.rejectedDate.toString()),{time:!0,mode:"standard"})),l().createElement("span",{className:yo.text},"By"),l().createElement("span",{className:yo.text},null==e||null===(Y=e.model)||void 0===Y?void 0:Y.rejectedByFamilyName,"  ",null==e||null===(J=e.model)||void 0===J?void 0:J.rejectedByGivenName,l().createElement("span",null,null==e||null===(W=e.model)||void 0===W?void 0:W.rejectionReason)))))),(!(null==e||null===(K=e.model)||void 0===K||null===(V=K.permission)||void 0===V?void 0:V.canEdit)&&((null==e||null===($=e.model)||void 0===$||null===(X=$.permission)||void 0===X?void 0:X.canApprove)||(null==e||null===(te=e.model)||void 0===te||null===(ee=te.permission)||void 0===ee?void 0:ee.canReceiveItems))||(null==e||null===(re=e.model)||void 0===re||null===(ne=re.permission)||void 0===ne?void 0:ne.canEdit)||Ie||(null==e||null===(ae=e.model)||void 0===ae||null===(oe=ae.permission)||void 0===oe?void 0:oe.isRequisitionAndCanIssueStock))&&l().createElement("div",{style:{margin:"10px",display:"flex",flexDirection:"row"}},l().createElement(l().Fragment,null,!(null==e||null===(le=e.model)||void 0===le||null===(ie=le.permission)||void 0===ie?void 0:ie.canEdit)&&(null==e||null===(se=e.model)||void 0===se||null===(ce=se.permission)||void 0===ce?void 0:ce.canApprove)&&l().createElement(l().Fragment,null,(!(null==e?void 0:e.model)||(null==e||null===(ue=e.model)||void 0===ue?void 0:ue.operationTypeName)===Zt.RETURN_OPERATION_TYPE||(null==e||null===(de=e.model)||void 0===de?void 0:de.operationTypeName)===Zt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(xr,{operation:null==e?void 0:e.model})),!(!(null==e?void 0:e.model)||(null==e||null===(me=e.model)||void 0===me?void 0:me.operationTypeName)===Zt.RETURN_OPERATION_TYPE||(null==e||null===(pe=e.model)||void 0===pe?void 0:pe.operationTypeName)===Zt.STOCK_ISSUE_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(po,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ir,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Br,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Ur,{operation:null==e?void 0:e.model}))),!(null==e||null===(ge=e.model)||void 0===ge||null===(Ae=ge.permission)||void 0===Ae?void 0:Ae.canEdit)&&(null==e||null===(ve=e.model)||void 0===ve||null===(fe=ve.permission)||void 0===fe?void 0:fe.canReceiveItems)&&l().createElement(l().Fragment,null,l().createElement("div",{style:{margin:"2px"}},l().createElement(go,{operation:null==e?void 0:e.model})),l().createElement("div",{style:{margin:"2px"}},l().createElement(Br,{operation:null==e?void 0:e.model}))),(null==e||null===(he=e.model)||void 0===he||null===(_e=he.permission)||void 0===_e?void 0:_e.canEdit)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(Ur,{operation:null==e?void 0:e.model})),(null==e||null===(ye=e.model)||void 0===ye||null===(be=ye.permission)||void 0===be?void 0:be.isRequisitionAndCanIssueStock)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(_o,{operation:null==e?void 0:e.model,operations:void 0})),((null==e||null===(Ce=e.model)||void 0===Ce||null===(ke=Ce.permission)||void 0===ke?void 0:ke.isRequisitionAndCanIssueStock)||(null==e||null===(Ee=e.model)||void 0===Ee?void 0:Ee.operationType)===Zt.STOCK_ISSUE_OPERATION_TYPE||(null==e||null===(we=e.model)||void 0===we?void 0:we.operationType)===Zt.REQUISITION_OPERATION_TYPE||(null==e||null===(Se=e.model)||void 0===Se?void 0:Se.operationType)===Zt.RECEIPT_OPERATION_TYPE||(null==e||null===(De=e.model)||void 0===De?void 0:De.operationType)===Zt.TRANSFER_OUT_OPERATION_TYPE)&&l().createElement("div",{style:{margin:"2px"}},l().createElement(uo,{operation:null==e?void 0:e.model}))))):l().createElement(l().Fragment,null),l().createElement(Nn,null,l().createElement(Ht,{tabs:Ze,selectedIndex:Ge,onChange:He})))};function Io(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function To(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Io(a,r,o,i,l,"next",e)}function l(e){Io(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Bo(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var Po=function(){var e=To((function(e,t,n,o,a){var i,l,c,s;return Bo(this,(function(o){switch(o.label){case 0:i=e,o.label=1;case 1:return o.trys.push([1,3,,4]),"requisition"===n.operationType&&delete i.destinationName,n.operationType===Zt.STOCK_ISSUE_OPERATION_TYPE&&(delete i.completedDate,delete i.completedBy,delete i.completedByFamilyName,delete i.completedByGivenName,delete i.operationTypeUuid,delete i.permission,delete i.locked,i.operationTypeUuid="66666666-6666-6666-6666-666666666666"),[4,(t?M:R)(i)];case 2:return(null==(l=o.sent())?void 0:l.data)&&(ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation")),(0,r.showToast)({critical:!0,title:"".concat(t?"Edit":"Add"," Stock Operation"),kind:"success",description:"Stock Operation ".concat(t?"Edited":"Added"," Successfully")}),Q()),[3,4];case 3:return c=o.sent(),s=le(c),(0,r.showNotification)({description:s.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))}));return function(t,n,r,o,a){return e.apply(this,arguments)}}(),Uo=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(No,{model:e,onSave:function(e){return Po(e,t,n,r,o)},isEditing:t,operation:n,canEdit:!t||"NEW"===(null==e?void 0:e.status)}))},jo=function(){var e=To((function(e,t,n){var o;return Bo(this,(function(a){return o=(0,r.showModal)("stock-operation-dialog",{title:e,operation:n,requireReason:t,closeModal:function(){return o()}}),[2]}))}));return function(t,n,r){return e.apply(this,arguments)}}();function zo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Fo=function(e){var t,n,r=e.operationUuid,o=e.operationNumber,c=e.model,s=e.operations,u=(t=(0,i.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return zo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zo(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),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(){Uo(null!=c?c:d,!0,p,s,!1)}},o||"".concat(null==c?void 0:c.operationNumber)))};function Lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ro(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||Mo(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mo(e,t){if(e){if("string"==typeof e)return Lo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}const qo=function(e){var t=e.conceptUuid,n=e.onFilterChange,r=e.filterName,o=Ft(t),c=o.items,s=o.isLoading,u=Ro((0,i.useState)(!1),2),d=u[0],m=u[1],p=Ro((0,i.useState)([]),2),A=p[0],g=p[1];return(0,i.useEffect)((function(){switch(m(!0),r){case te.STATUS:g(Nt.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 Lo(e)}(t=c.answers)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Mo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m(s));break;case te.OPERATION:jt().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:St.filtersAlign,id:"multiSelect",label:r,size:"md",labelInline:!0,items:A,itemToString:function(e){return e?e.display:"Not Set"},onChange:function(e){var t=e.selectedItems;t&&n(t.map((function(e){return e.display})),r)},placeholder:"Filter by ".concat(r),style:{minWidth:"auto",width:"auto"}})};function Go(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ho(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ho(e,t,n[t])}))}return e}function Yo(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Qo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Go(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Go(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Jo=function(){var e,t=(0,E.useTranslation)().t,n=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))},o=(0,i.useMemo)((function(){return{uuid:"",name:"",description:"",operationType:"",hasSource:!1,sourceType:"Location",hasDestination:!1,destinationType:"Location",hasRecipient:!1,recipientRequired:!1,availableWhenReserved:!1,allowExpiredBatchNumbers:!1,stockOperationTypeLocationScopes:[],creator:void 0,dateCreated:void 0,changedBy:void 0,dateChanged:void 0,dateVoided:void 0,voidedBy:void 0,voidReason:"",voided:!1}}),[]),c=Ct({v:U.Full,totalCount:!0}),s=c.items,u=c.tableHeaders,d=c.currentPage,m=c.pageSizes,p=c.totalItems,A=c.goTo,g=c.currentPageSize,f=c.setPageSize,v=c.isLoading,_=Qo((0,i.useState)(s),2),h=_[0],b=_[1],y=Qo((0,i.useState)(null),2),k=y[0],C=y[1],w=Qo((0,i.useState)(null),2),S=w[0],D=w[1],O=Qo((0,i.useState)([]),2),x=O[0],N=O[1],I=Qo((0,i.useState)([]),2),T=I[0],B=I[1],P=Qo((0,i.useState)([]),2),j=P[0],z=P[1],F=(0,r.useConfig)(),L=function(){var e=(0,r.showModal)("stock-operation-dialog",{title:"complete",closeModal:function(){return e()}});ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))};(0,i.useEffect)((function(){M()}),[k,S,x,T,j,d,g,s]);var R=(0,i.useCallback)((function(e,t){t===te.SOURCES?N(e):t===te.OPERATION?z(e):B(e)}),[]),M=function(){var e=s;x.length>0&&(e=e.filter((function(e){return x.includes(e.sourceName)}))),j.length>0&&(e=e.filter((function(e){return j.includes(e.operationTypeName)}))),T.length>0&&(e=e.filter((function(e){return T.includes(e.status)}))),k&&S?e=e.filter((function(e){var t=new Date(e.operationDate);return t>=k&&t<=S})):k?e=e.filter((function(e){return new Date(e.operationDate)>=k})):S&&(e=e.filter((function(e){return new Date(e.operationDate)<=S}))),b(e)},q=(0,i.useMemo)((function(){return null==h?void 0:h.map((function(n,r){var i,c,s,u,d,m,p,A,g,f,v,_,b,y,k,C,E,w,S;return Yo(Zo({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),operationTypeName:"".concat(null==n?void 0:n.operationTypeName),operationNumber:l().createElement(Fo,{model:h[r],operations:e}),status:"".concat(null==n?void 0:n.status),source:"".concat(null!==(i=null==n?void 0:n.sourceName)&&void 0!==i?i:""),destination:"".concat(null!==(c=null==n?void 0:n.destinationName)&&void 0!==c?c:""),location:l().createElement(l().Fragment,null," ",null!==(s=null==n?void 0:n.sourceName)&&void 0!==s?s:""," ",(null==n?void 0:n.sourceName)&&(null==n?void 0:n.destinationName)?l().createElement(me.ol,{size:16}):""," ",null!==(u=null==n?void 0:n.destinationName)&&void 0!==u?u:""," "),responsiblePerson:"".concat(null!==(m=null!==(d=null==n?void 0:n.responsiblePersonFamilyName)&&void 0!==d?d:null==n?void 0:n.responsiblePersonOther)&&void 0!==m?m:""," ").concat(null!==(p=null==n?void 0:n.responsiblePersonGivenName)&&void 0!==p?p:""),operationDate:V(null==n?void 0:n.operationDate),details:l().createElement("div",{className:"tbl-expand-display-fields"},l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("created","Created")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.dateCreated))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(A=n.creatorFamilyName)&&void 0!==A?A:""," ",null!==(g=n.creatorGivenName)&&void 0!==g?g:""))),"NEW"!==(null==n?void 0:n.status)&&(null==n?void 0:n.status)!==Dt&&(null==n?void 0:n.submittedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("submitted","Submitted")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.submittedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(f=n.submittedByFamilyName)&&void 0!==f?f:""," ",null!==(v=n.submittedByGivenName)&&void 0!==v?v:""))),(null==n?void 0:n.completedDate)&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},t("completed","Completed")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.completedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(_=n.completedByFamilyName)&&void 0!==_?_:""," ",null!==(b=n.completedByGivenName)&&void 0!==b?b:""))),(null==n?void 0:n.status)===Ot&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"}," ",t("cancelled","Cancelled")),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.cancelledDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(y=n.cancelledByFamilyName)&&void 0!==y?y:""," ",null!==(k=n.cancelledByGivenName)&&void 0!==k?k:""),l().createElement("p",null,n.cancelReason))),(null==n?void 0:n.status)===xt&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Rejected"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.rejectedDate))," ",t("by","By"),l().createElement("span",{className:"action-by"},null!==(C=n.rejectedByFamilyName)&&void 0!==C?C:""," ",null!==(E=n.rejectedByGivenName)&&void 0!==E?E:""),l().createElement("p",null,n.rejectionReason))),(null==n?void 0:n.status)===Dt&&l().createElement("div",{className:"field-label"},l().createElement("span",{className:"field-title"},"Returned"),l().createElement("span",{className:"field-desc"},l().createElement("span",{className:"action-date"},V(null==n?void 0:n.returnedDate))," ","By",l().createElement("span",{className:"action-by"},null!==(w=n.returnedByFamilyName)&&void 0!==w?w:""," ",null!==(S=n.returnedByGivenName)&&void 0!==S?S:""),l().createElement("p",null,n.returnReason)))),actions:l().createElement(a.PQB,{flipped:"true","aria-label":"overflow-menu"},l().createElement(a.laM,{itemText:"Complete",onClick:L}),l().createElement(a.laM,{itemText:"Edit",onClick:function(){Uo(h[r],!0,o,e,!1)}}))})}))}),[L,h,o,e,s]);return v?l().createElement(a.gqd,{className:St.dataTableSkeleton,showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement("div",{className:St.tableOverride},l().createElement(a.x45,null,t("Stock operations to track movement of stock.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:q,headers:u,isSortable:!0,useZebraStyles:!0,render:function(o){var i=o.rows,c=o.headers,u=o.getHeaderProps,d=o.getTableProps,m=o.getRowProps,p=o.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:St.toolbarContent},l().createElement(a.Ys1,{className:St.patientListSearch,expanded:!0,onChange:p,placeholder:"Filter Table",size:"sm"}),l().createElement("div",{className:St.filterContainer},l().createElement(a.Mtg,{className:St.dateAlign,datePickerType:"range",dateFormat:X,value:[k,S],onChange:function(e){var t=Qo(e,2);!function(e){var t=Qo(e,2),n=t[0],r=t[1];n&&(C(n),S&&n&&S<n&&D(n)),r&&(D(r),k&&r&&k>r&&C(r))}([t[0],t[1]])}},l().createElement(a.aj6,{placeholder:K}),l().createElement(a.aj6,{placeholder:K})),l().createElement(qo,{conceptUuid:F.stockSourceTypeUUID,filterName:te.SOURCES,onFilterChange:R}),l().createElement(qo,{filterName:te.STATUS,onFilterChange:R}),l().createElement(qo,{filterName:te.OPERATION,onFilterChange:R})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Rt,{onOperationTypeSelected:function(t){Uo(_n(),!1,t,e,!1)},onOperationLoaded:function(t){e=t}}))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,l().createElement(a.MOD,null),c.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Yo(Zo({},u({header:e,isSortable:e.isSortable})),{className:r.isDesktop?St.desktopHeader:St.tabletHeader,key:"".concat(e.key)}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,i.map((function(e,n){var o,i,u,d,p,A,g,f,v,_,b,y,k,C,E,w,S,D,O,x,N,I,T,B,P,U,j,z,F,L;return l().createElement(l().Fragment,{key:e.id},l().createElement(a.RcE,Zo({className:r.isDesktop?St.desktopRow:St.tabletRow},m({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))),l().createElement(a.WdL,{colSpan:c.length+2},l().createElement(l().Fragment,null,l().createElement(a.SmK,null,l().createElement(a.s1N,{head:!0},l().createElement(a.agF,{head:!0},t("dateCreated","Date Created")),l().createElement(a.agF,{head:!0},t("dateCompleted","Date Completed")),l().createElement(a.agF,{head:!0},t("batchNumber","Batch Number")),l().createElement(a.agF,{head:!0},"Qty"))),l().createElement(a.FxI,null,l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(o=h[n])||void 0===o?void 0:o.dateCreated)?V(null===(i=h[n])||void 0===i?void 0:i.dateCreated):""," ",(null===(u=h[n])||void 0===u?void 0:u.dateCreated)?"By":""," ",(null===(d=h[n])||void 0===d?void 0:d.dateCreated)?null===(p=h[n])||void 0===p?void 0:p.creatorFamilyName:""),l().createElement(a.agF,null,(null===(A=h[n])||void 0===A?void 0:A.completedDate)?V(null===(g=h[n])||void 0===g?void 0:g.completedDate):""," ",(null===(f=h[n])||void 0===f?void 0:f.completedDate)?"By":""," ",(null===(v=h[n])||void 0===v?void 0:v.completedDate)?null===(_=h[n])||void 0===_?void 0:_.creatorFamilyName:""),l().createElement(a.agF,null,(null===(b=h[n])||void 0===b?void 0:b.stockOperationItems)?null===(y=h[n].stockOperationItems)||void 0===y?void 0:y.map((function(e){return e.batchNo}))[0]:""),l().createElement(a.agF,null,(null===(k=h[n])||void 0===k?void 0:k.stockOperationItems)?null===(C=h[n].stockOperationItems)||void 0===C?void 0:C.map((function(e){return e.quantity}))[0]:"")),l().createElement(a.s1N,null,l().createElement(a.agF,{noWrap:!0},(null===(E=h[n])||void 0===E?void 0:E.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(w=h[n])||void 0===w?void 0:w.dateCreated):""," ",(null===(S=h[n])||void 0===S?void 0:S.stockOperationItems.map((function(e){return e.quantity}))[1])?"By":""," ",(null===(D=h[n])||void 0===D?void 0:D.stockOperationItems.map((function(e){return e.quantity}))[1])?null===(O=h[n])||void 0===O?void 0:O.creatorFamilyName:""),l().createElement(a.agF,null,(null===(x=h[n])||void 0===x?void 0:x.stockOperationItems.map((function(e){return e.quantity}))[1])?V(null===(N=h[n])||void 0===N?void 0:N.completedDate):""," ",(null===(I=h[n])||void 0===I?void 0:I.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(T=h[n])||void 0===T?void 0:T.completedDate)?"By":""," ",(null===(B=h[n])||void 0===B?void 0:B.stockOperationItems.map((function(e){return e.quantity}))[1])&&(null===(P=h[n])||void 0===P?void 0:P.completedDate)?null===(U=s[n])||void 0===U?void 0:U.creatorFamilyName:""),l().createElement(a.agF,null,(null===(j=h[n])||void 0===j?void 0:j.stockOperationItems)?null===(z=h[n].stockOperationItems)||void 0===z?void 0:z.map((function(e){return e.batchNo}))[1]:""),l().createElement(a.agF,null,(null===(F=h[n])||void 0===F?void 0:F.stockOperationItems)?null===(L=h[n].stockOperationItems)||void 0===L?void 0:L.map((function(e){return e.quantity}))[1]:""))))))})))),0===i.length?l().createElement("div",{className:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("div",{className:St.tileContent},l().createElement("p",{className:St.content},t("noOperationsToDisplay","No Stock Items to display")),l().createElement("p",{className:St.helper},t("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:d,pageSize:g,pageSizes:m,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==g&&f(t),n!==d&&A(n)},className:St.paginationOverride}))};var Wo={uuid:void 0,isDrug:void 0,drugUuid:void 0,drugName:void 0,conceptUuid:void 0,commonName:void 0,acronym:void 0,conceptName:void 0,hasExpiration:void 0,preferredVendorUuid:void 0,preferredVendorName:void 0,purchasePrice:void 0,purchasePriceUoMUuid:void 0,purchasePriceUoMName:void 0,dispensingUnitName:void 0,dispensingUnitUuid:void 0,dispensingUnitPackagingUoMUuid:void 0,dispensingUnitPackagingUoMName:void 0,defaultStockOperationsUoMUuid:void 0,defaultStockOperationsUoMName:void 0,reorderLevel:void 0,reorderLevelUoMUuid:void 0,reorderLevelUoMName:void 0,dateCreated:void 0,creatorGivenName:void 0,creatorFamilyName:void 0,voided:void 0,packagingUnits:void 0,permission:void 0,categoryUuid:void 0,categoryName:void 0,expiryNotice:void 0};function Vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ko(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Vo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xo(e){return e?"".concat(e.name).concat(e.concept?" (".concat(e.concept.display,")"):""):""}const $o=function(e){var t,n,o,c,s=Ko((0,i.useState)(""),2),u=s[0],d=s[1],m=(0,E.useTranslation)().t,p=(t=u,o={v:U.Default,q:t,limit:20},c=function(e){var t="".concat(r.restBaseUrl,"/drug").concat(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||o),{drugList:c.items.results,isLoading:c.isLoading}),A=p.isLoading,g=p.drugList,f=Ko((0,i.useState)(!1),2),v=f[0],_=f[1];return l().createElement("div",null,l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:g||[],initialSelectedItem:null!==(n=null==g?void 0:g.find((function(t){return t.uuid===e.drugUuid})))&&void 0!==n?n:"",itemToString:Xo,onChange:function(t){var n,o,a,l,c;_(!1),null===(n=e.onDrugChanged)||void 0===n||n.call(e,t.selectedItem),i(null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.uuid),(null==t||null===(a=t.selectedItem)||void 0===a?void 0:a.uuid)&&((c=null==t||null===(l=t.selectedItem)||void 0===l?void 0:l.uuid)&&function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitem?drugUuid=").concat(e,"&limit=1");return(0,r.openmrsFetch)(t).then((function(e){return e.data}))}(c).then((function(e){var t,n,r=0!==(null!==(n=null==e||null===(t=e.results)||void 0===t?void 0:t.length)&&void 0!==n?n:0);_(r)})))},onInputChange:function(e){d(e)},inputValue:u,placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}}),A&&l().createElement(a.lSo,{status:"active",iconDescription:"Searching",description:"Searching..."}),v&&l().createElement("div",{style:{color:"#da1e28"}},m("itemAlreadyExists","Item already exits")))};var ea=ln.z.string().max(255).nullish(),ta=ln.z.object({isDrug:ln.z.boolean(),drugUuid:ln.z.string().nullish(),drugName:ln.z.string().nullish(),commonName:ea,acronym:ea,hasExpiration:ln.z.boolean(),expiryNotice:ln.z.coerce.number().nullish(),uuid:ln.z.string().nullish(),conceptUuid:ln.z.string().nullish(),conceptName:ln.z.string().nullish(),preferredVendorUuid:ln.z.string().nullish(),preferredVendorName:ln.z.string().nullish(),purchasePrice:ln.z.number().nullish(),purchasePriceUoMUuid:ln.z.string().nullish(),purchasePriceUoMName:ln.z.string().nullish(),categoryUuid:ln.z.string().nullish(),categoryName:ln.z.string().nullish(),dispensingUnitUuid:ln.z.string().nullish(),dispensingUnitName:ln.z.string().nullish(),dispensingUnitPackagingUoMUuid:ln.z.string().nullish(),dispensingUnitPackagingUoMName:ln.z.string().nullish(),defaultStockOperationsUoMUuid:ln.z.string().nullish(),defaultStockOperationsUoMName:ln.z.string().nullish(),reorderLevel:ln.z.number().nullish(),reorderLevelUoMUuid:ln.z.string().nullish(),reorderLevelUoMName:ln.z.string().nullish(),dateCreated:ln.z.coerce.date().nullish(),creatorGivenName:ln.z.string().nullish(),creatorFamilyName:ln.z.string().nullish(),voided:ln.z.boolean().nullish()}).refine((function(e){var t=e.isDrug,n=e.drugUuid;return!t||!!n}),{message:"Drug required",path:["drugUuid"]}).refine((function(e){var t=e.isDrug,n=e.dispensingUnitUuid;return!t||!!n}),{message:"Dispensing Unit required",path:["dispensingUnitUuid"]}).refine((function(e){var t=e.hasExpiration,n=e.expiryNotice;return!t||!!n}),{message:"Expiry Notice required",path:["expiryNotice"]});function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ra=function(e){return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o=t.field,i=o.onChange,c=o.value,s=o.ref;return l().createElement(a.SYO,(n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){na(e,t,n[t])}))}return e}({},e),r=null!=(r={onChange:function(t,n,r){i(t,n,r),e.onChange&&e.onChange(t,n,r)},id:e.name,ref:s,defaultSelected:e.id,value:c})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})),n),e.options.map((function(t,n){return l().createElement(a.EUY,{key:"".concat(n,"-").concat(e.name,"-").concat(t.value),id:"".concat(e.name,"-").concat(t.value),labelText:t.label,value:t.value,checked:c===t.value,onChange:function(){return i(t.value)},ref:s})})))}})},oa=function(e){return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n,r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.Y2U,{label:e.label,id:"".concat(e.name,"-").concat(e.id,"-").concat(null===(n=e.row)||void 0===n?void 0:n.uuid),value:null!==(o=null===(r=e.row)||void 0===r?void 0:r.factor)&&void 0!==o?o:s,min:e.min,hideSteppers:e.hideSteppers||!1,ref:u,onChange:function(t,n){c(t,n),e.onChange&&e.onChange(t,n)}})}})},aa=function(e){var t=Ft((0,r.useConfig)().dispensingUnitsUUID),n=t.items.setMembers;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n;null===(n=e.onDispensingUnitChange)||void 0===n||n.call(e,t.selectedItem),c(t.selectedItem.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.dispensingUnitUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.display)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})};function ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function la(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ia(e,t,n[t])}))}return e}function ca(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(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}}const sa=function(e){var t=ca({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onPreferredVendorChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){return t.uuid===e.preferredVendorUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid,invalidText:e.invalidText})}})},ua=function(e){var t=(0,E.useTranslation)().t,n=Ft((0,r.useConfig)().stockItemCategoryUUID),o=n.items.answers,i=n.isLoading,c=e.itemType?null==o?void 0:o.filter((function(t){return t.display===(null==e?void 0:e.itemType)})):o;return i?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(n){var r,i,s=n.field,u=s.onChange,d=s.value,m=s.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:c||[],onChange:function(t){var n,r;null===(n=e.onCategoryUuidChange)||void 0===n||n.call(e,t.selectedItem),u(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==o?void 0:o.find((function(t){return t.uuid===e.categoryUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(t(null==e?void 0:e.display)):""},shouldFilterItem:function(){return!0},value:null!==(i=t(null==o||null===(r=o.find((function(e){return e.uuid===d})))||void 0===r?void 0:r.display))&&void 0!==i?i:"",placeholder:e.placeholder,ref:m,invalid:e.invalid,invalidText:e.invalidText})}})},da=function(e){var t,n=(0,i.useMemo)((function(){return(null==e?void 0:e.packagingUnits.length)>0?null==e?void 0:e.packagingUnits.find((function(t){return(null==t?void 0:t.uuid)===(null==e?void 0:e.dispensingUnitPackagingUoMUuid)})):null}),[null==e?void 0:e.packagingUnits]);return e.isLoading?l().createElement(a.xNL,null):(null==e?void 0:e.packagingUnits)&&(null==e?void 0:e.packagingUnits.length)>0?l().createElement("div",null,l().createElement(on.Qr,{name:e.controllerName,control:e.control,defaultValue:null!==(t=null==n?void 0:n.uuid)&&void 0!==t?t:"",render:function(t){var r,o=t.field,i=o.onChange,c=o.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"sm",items:null!==(r=e.packagingUnits)&&void 0!==r?r:[],onChange:function(t){var n,r;null===(n=e.onDispensingUnitPackagingUoMUuidChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),i(null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:n,itemToString:function(e){return(null==e?void 0:e.packagingUomName)?"".concat(null==e?void 0:e.packagingUomName," - ").concat(null==e?void 0:e.factor," "):"Not set"},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText,ref:c})}})):l().createElement(l().Fragment,null)},ma=function(e){var t,n,r,o,i,c,s,u,d=e.stockItemUuid,m=e.control,p=e.formState.errors,A=(0,E.useTranslation)().t,g=he(d),f=g.item,v=g.isLoading;return f&&f.packagingUnits&&f.packagingUnits.length>0?l().createElement(l().Fragment,null,l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"dispensingUnitPackagingUoMUuid",controllerName:"dispensingUnitPackagingUoMUuid",control:m,title:A("dispensingUnitOfMeasurement","Dispensing packaging unit of measurement:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.dispensingUnitPackagingUoMUuid,invalidText:p.dispensingUnitPackagingUoMUuid&&(null==p||null===(t=p.dispensingUnitPackagingUoMUuid)||void 0===t?void 0:t.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"defaultStockOperationsUoMUuid",controllerName:"defaultStockOperationsUoMUuid",control:m,title:A("defaultStockOperationsPackagingUnit:","Default stock operations packaging unit:"),placeholder:A("chooseAPackagingUoM","Choose a packaging UoM"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.defaultStockOperationsUoMUuid,invalidText:p.defaultStockOperationsUoMUuid&&(null==p||null===(n=p.defaultStockOperationsUoMUuid)||void 0===n?void 0:n.message)}),v?l().createElement(a.iJ5,null):l().createElement(oa,{id:"reorderLevel",name:"reorderLevel",control:m,controllerName:"reorderLevel",size:"md",allowEmpty:!0,label:A("orderLevel","Reorder level:"),invalid:!!p.reorderLevel,value:null!==(s=f.reorderLevel)&&void 0!==s?s:"",invalidText:p.reorderLevel&&(null==p||null===(r=p.reorderLevel)||void 0===r?void 0:r.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"reorderLevelUoMUuid",controllerName:"reorderLevelUoMUuid",control:m,title:A("reorderLevelPackagingUnit:","Reorder level packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.reorderLevelUoMUuid,invalidText:p.reorderLevelUoMUuid&&(null==p||null===(o=p.reorderLevelUoMUuid)||void 0===o?void 0:o.message)}),v?l().createElement(a.iJ5,null):l().createElement(oa,{id:"purchasePrice",name:"purchasePrice",control:m,controllerName:"purchasePrice",size:"md",allowEmpty:!0,label:A("purchasePrice","Purchase Price:"),value:null!==(u=f.purchasePrice)&&void 0!==u?u:"",invalid:!!p.purchasePrice,invalidText:p.purchasePrice&&(null==p||null===(i=p.purchasePrice)||void 0===i?void 0:i.message)}),l().createElement(da,{dispensingUnitPackagingUoMUuid:null==f?void 0:f.purchasePriceUoMUuid,name:"purchasePriceUoMUuid",controllerName:"purchasePriceUoMUuid",control:m,title:A("purchasePricePackagingUnit","Purchase price packaging unit:"),placeholder:A("notSet","Not Set"),isLoading:v,packagingUnits:f.packagingUnits,invalid:!!p.purchasePriceUoMUuid,invalidText:p.purchasePriceUoMUuid&&(null==p||null===(c=p.purchasePriceUoMUuid)||void 0===c?void 0:c.message)})):l().createElement(l().Fragment,null)};function pa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const Aa=function(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/concept").concat(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 pa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pa(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=u[0],m=u[1],p=(0,i.useMemo)((function(){return""===d.trim()?c:c.filter((function(e){return e.display.toLowerCase().includes(d.trim().toLowerCase())}))}),[d,c]);return s?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var n=t.field,r=n.onChange,o=n.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:p,onChange:function(t){var n;null===(n=e.onConceptUuidChange)||void 0===n||n.call(e,t.selectedItem),r(t.selectedItem.uuid)},initialSelectedItem:(null==c?void 0:c.find((function(t){return t.uuid===e.conceptUuid})))||{},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},onInputChange:function(e){m(e)},inputValue:d,placeholder:e.placeholder,ref:o,invalid:e.invalid,invalidText:e.invalidText})}})};var ga=[{label:"Pharmaceuticals",value:!0},{label:"Non Pharmaceuticals",value:!1}],fa=[{label:"Yes",value:!0},{label:"No",value:!1}];function va(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _a(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function ha(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return va(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?va(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ba=(0,i.forwardRef)((function(e){var t,n,o,c,s,u,d,m,p,A,g,f=e.model,v=e.onSave,_=e.isEditing,h=e.handleTabChange,b=(0,E.useTranslation)().t,y=(0,on.cI)({defaultValues:f,mode:"all",resolver:(0,an.F)(ta)}),k=y.handleSubmit,C=y.control,w=y.formState,S=w.errors,D=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){_a(a,r,o,i,l,"next",e)}function l(e){_a(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,3,4]),N(!0),e.uuid=f.uuid,[4,v(e)];case 1:return t.sent(),h(1),ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),[3,4];case 2:return t.sent(),[3,4];case 3:return N(!1),[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),O=ha((0,i.useState)(!1),2),x=O[0],N=O[1],T=ha((0,i.useState)(!1),2),B=T[0],P=T[1],U=ha((0,i.useState)(""),2),j=U[0],z=U[1],F=ha((0,i.useState)(!1),2),L=F[0],R=F[1];return(0,i.useEffect)((function(){var e,t;P(null!==(e=f.isDrug)&&void 0!==e&&e),z(!0===f.isDrug?"Pharmaceuticals":!1===f.isDrug?"Non Pharmaceuticals":void 0),R(null!==(t=f.hasExpiration)&&void 0!==t&&t)}),[f.hasExpiration,f.isDrug]),l().createElement("form",{className:"".concat(I.formContainer," ").concat(I.verticalForm)},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("itemType","Item Type"),title:b("itemType","Item Type")},l().createElement(ra,{control:C,name:"isDrug",controllerName:"isDrug",legendText:"",invalid:!!S.isDrug,invalidText:S.isDrug&&(null==S||null===(t=S.isDrug)||void 0===t?void 0:t.message),onChange:function(e){var t=ga.find((function(t){return t.value===e})),n=t?t.label:"";P(e),z(n)},options:ga})),B&&l().createElement($o,{name:"drugUuid",controllerName:"drugUuid",control:C,title:b("pleaseSpecify","Please specify:"),placeholder:"Choose a drug",invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(n=S.drugUuid)||void 0===n?void 0:n.message)}),null!=B&&!B&&l().createElement(Aa,{name:"conceptUuid",controllerName:"conceptUuid",control:C,title:b("pleaseSpecify","Please specify")+":",placeholder:b("chooseAnItem","Choose an item"),invalid:!!S.drugUuid,invalidText:S.drugUuid&&(null==S||null===(o=S.drugUuid)||void 0===o?void 0:o.message)}),l().createElement(Cn,{id:"commonName",name:"commonName",control:C,controllerName:"commonName",maxLength:255,size:"md",value:"".concat(null!==(g=null==f?void 0:f.commonName)&&void 0!==g?g:""),labelText:b("commonName","Common name")+":",invalid:!!S.commonName,invalidText:S.commonName&&(null==S||null===(c=S.commonName)||void 0===c?void 0:c.message)}),l().createElement(Cn,{id:"acronym",maxLength:255,name:"acronym",control:C,controllerName:"acronym",size:"md",labelText:b("abbreviation","Abbreviation")+":",invalid:!!S.acronym,invalidText:S.acronym&&(null==S||null===(s=S.acronym)||void 0===s?void 0:s.message)}),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("hasExpiration","Does the item expire?"),title:b("hasExpiration","Does the item expire?")},l().createElement(ra,{name:"hasExpiration",controllerName:"hasExpiration",control:C,legendText:"",invalid:!!S.hasExpiration,invalidText:S.hasExpiration&&(null==S||null===(u=S.hasExpiration)||void 0===u?void 0:u.message),onChange:function(e){R(e)},options:fa})),L&&l().createElement(a.cwH,{className:"clear-margin-bottom",legendText:b("expirationNotice","Expiration Notice (days)"),title:b("expirationNotice","Expiration Notice (days)")},l().createElement(oa,{id:"expiryNotice",name:"expiryNotice",control:C,controllerName:"expiryNotice",min:0,size:"md",allowEmpty:!0,label:b("expiryNoticeDays","Expiration Notice (days)"),invalid:!!S.expiryNotice,invalidText:S.expiryNotice&&(null==S||null===(d=S.expiryNotice)||void 0===d?void 0:d.message)}))),l().createElement(sa,{name:"preferredVendorUuid",controllerName:"preferredVendorUuid",control:C,title:b("whoIsThePreferredVendor","Who is the preferred vendor?"),placeholder:b("chooseVendor","Choose vendor"),invalid:!!S.preferredVendorUuid,invalidText:S.preferredVendorUuid&&(null==S||null===(m=S.preferredVendorUuid)||void 0===m?void 0:m.message)}),l().createElement(ua,{name:"categoryUuid",controllerName:"categoryUuid",control:C,itemType:"Pharmaceuticals"===j?"Drugs":"Non Pharmaceuticals"===j?"Non Drugs":void 0,title:b("category:","Category")+":",placeholder:b("chooseACategory","Choose a category"),invalid:!!S.categoryUuid,invalidText:S.categoryUuid&&(null==S||null===(p=S.categoryUuid)||void 0===p?void 0:p.message)}),B&&l().createElement(aa,{name:"dispensingUnitUuid",controllerName:"dispensingUnitUuid",control:C,title:b("dispensingUnit","Dispensing Unit")+":",placeholder:b("dispensingUnitHolder","Choose a dispensing unit"),invalid:!!S.dispensingUnitUuid,invalidText:S.dispensingUnitUuid&&(null==S||null===(A=S.dispensingUnitUuid)||void 0===A?void 0:A.message)}),B&&_&&l().createElement(ma,{control:C,formState:w,stockItemUuid:f.uuid}),l().createElement("div",{style:{display:"flex",flexDirection:"row-reverse"}},l().createElement(a.zxk,{name:"save",type:"button",className:"submitButton",onClick:k(D),kind:"primary",renderIcon:Ar.vc},x?l().createElement(a.lSo,null):b("save","Save")),l().createElement(a.zxk,{kind:"secondary",onClick:Q},b("cancel","Cancel"))))}));const ya=ba;function ka(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ca(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(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 ka(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ka(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=(0,r.usePagination)(a.results,u),p=m.goTo,A=m.results,g=m.currentPage,f=(0,i.useMemo)((function(){return[{key:"location",header:"Location"},{key:"name",header:"Name"},{key:"quantity",header:"Quantity Threshold"},{key:"evaluationFrequency",header:"Frequency Check"},{key:"actionFrequency",header:"Notification Frequency"},{key:"alertRole",header:"Alert Role"},{key:"mailRole",header:"Mail Role"},{key:"enabled",header:"Enabled?"},{header:"actions",key:"actions"}]}),[]);return{items:A,totalItems:null==a?void 0:a.totalCount,currentPage:g,currentPageSize:u,paginatedItems:A,goTo:p,pageSizes:[10,20,30,40,50],isLoading:l,isError:c,setPageSize:d,tableHeaders:f}}var Ea=n(4563),wa={};wa.styleTagTransform=h(),wa.setAttributes=g(),wa.insert=p().bind(null,"head"),wa.domAPI=d(),wa.insertStyleElement=v(),s()(Ea.Z,wa);const Sa=Ea.Z&&Ea.Z.locals?Ea.Z.locals:void 0;function Da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Da(e,t,n[t])}))}return e}function xa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ia(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Na(e,t,n[t])}))}return e}function Ta(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 Ba(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return xa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xa(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Pa=function(e){var t,n,o=e.model,c=e.stockItemUuid,s=(0,E.useTranslation)().t,u=Ba((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=_e(d).items,A=Bt().stockLocations,g=Pt({v:U.Default}),f=g.items,v=(g.isError,g.isLoading,Ba((0,i.useState)(Ia({enabled:!0},o)),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=Ia({},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="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(t?"/"+e.uuid:""),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:Oa({},e)})}(_).then((function(){(0,r.showToast)({critical:!0,title:s("addedRule","Add Rule"),kind:"success",description:s("stockruleaddedsuccessfully","Stock Rule Added Successfully")}),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingRule', 'error adding a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[_,o,s,c]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:b},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement(a.cwH,null,l().createElement("section",{className:Sa.section},l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"location",className:"select-field",labelText:s("location","Location"),id:"location",value:(null==_?void 0:_.locationUuid)?_.locationUuid:"",onChange:function(e){var t=A.find((function(t){return t.id===e.target.value}));h(Ta(Ia({},_),{locationUuid:t.id}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseLocation","Choose the location")}),null==A?void 0:A.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"name",type:"text",labelText:s("name","Rule Name"),size:"md",onChange:function(e){o&&(o.name=e.target.value),h(Ta(Ia({},_),{name:e.target.value}))},value:null==o?void 0:o.name,placeholder:"e.g Panado Alert"})),l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"quantityUnit",className:"select-field",labelText:s("quantityUnit","Quantity Unit"),id:"quantityUnit",value:(null==_?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(Ta(Ia({},_),{stockItemPackagingUOMUuid:t.uuid}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:s("chooseQuantityUnit","Choose the Unit of Quantity")}),null==p?void 0:p.results.map((function(e){return l().createElement(a.QlF,{key:e.uuid,value:e.uuid,text:e.packagingUomName})})))),l().createElement("section",{className:Sa.section},l().createElement(a.oil,{id:"quantity",type:"number",labelText:s("quantity","Quantity Threshold"),size:"md",onChange:function(e){o&&(o.quantity=Number(e.target.value)),h(Ta(Ia({},_),{quantity:Number(e.target.value)}))},value:null==o?void 0:o.quantity,placeholder:"e.g 30 Boxes"})))),l().createElement(a.cwH,null,l().createElement("section",{className:Sa.section},l().createElement(a.PhF,{name:"alertRole",className:"select-field",labelText:s("alertRole","Alert Role"),id:"alertRole",value:(null==_?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(Ta(Ia({},_),{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:Sa.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(Ta(Ia({},_),{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:Sa.section},l().createElement(a.oil,{id:"evaluationFrequency",type:"number",labelText:s("evaluationFrequency","Frequency Check (Minutes)"),size:"md",onChange:function(e){o&&(o.evaluationFrequency=Number(e.target.value)),h(Ta(Ia({},_),{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(Ta(Ia({},_),{actionFrequency:Number(e.target.value)}))},value:null==o?void 0:o.actionFrequency,placeholder:"e.g 3600 Minutes"}))),l().createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"center"}},l().createElement(a.cwH,{className:"clear-margin-bottom"},l().createElement(a.cOn,{className:Sa.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enabled);h(Ta(Ia({},_),{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:Sa.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==_?void 0:_.enableDescendants);h(Ta(Ia({},_),{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")))))},Ua=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Add Stock Rule",l().createElement(Pa,{stockItemUuid:t}))}),[]);return l().createElement(a.zxk,{onClick:r,size:"md",kind:"primary"},n("stockmanagement.addnewrule","Add New Rule"))};var ja=n(4907),za={};za.styleTagTransform=h(),za.setAttributes=g(),za.insert=p().bind(null,"head"),za.domAPI=d(),za.insertStyleElement=v(),s()(ja.Z,za);const Fa=ja.Z&&ja.Z.locals?ja.Z.locals:void 0;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=e.stockItemUuid,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockrule").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}({v:U.Default,totalCount:!0,stockItemUuid:n}),i=o.items,c=o.isLoading,s=o.isError;return c||s?l().createElement(a.iTo,null):l().createElement(l().Fragment,null,l().createElement("div",{className:Fa.filterContainer},l().createElement(a.Ltx,{id:"stockRulesFiter",items:(t=i.results,function(e){if(Array.isArray(e))return La(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 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)||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 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,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,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 Ma(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ma(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-rule-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t,n,a;(t=o,n="".concat(r.restBaseUrl,"/stockmanagement/stockrule/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){d(!1),(0,r.showToast)({critical:!0,title:c("deletingRule","Delete Rule"),kind:"success",description:c("stockruledeletedsuccessfully","Stock Rule Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingRule', 'error deleting a rule"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteRule","Delete Rule"),renderIcon:function(e){return l().createElement(pe.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){qa(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function Ha(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Za=function(e){var t=e.data,n=(e.stockItemUuid,(0,E.useTranslation)().t),r=(0,i.useCallback)((function(){Y("Edit Stock Rule",l().createElement(Pa,{model:t,stockItemUuid:t.stockItemUuid}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){return r()},iconDescription:n("editStockRule","Edit Stock Rule"),renderIcon:function(e){return l().createElement(vt.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){Ha(e,t,n[t])}))}return e}({size:16},e))}})};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}const Wa=function(e){var t=e.stockItemUuid,n=(e.model,e.canEdit,(0,E.useTranslation)().t),o=Ca({v:U.Default,totalCount:!0,stockItemUuid:t}),c=o.isLoading,s=o.items,u=o.tableHeaders,d=o.currentPage,m=o.currentPageSize,p=o.pageSizes,A=o.totalItems,g=o.setPageSize,f=o.goTo,v=(0,i.useMemo)((function(){return null==s?void 0:s.map((function(e,t){var n,r;return Ja(Qa({},e),{id:"".concat(null==e?void 0:e.id,"-").concat(t),key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),dateCreated:V(null==e?void 0:e.dateCreated),location:null==e?void 0:e.locationName,quantity:"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(r=null==e?void 0:e.packagingUomName)&&void 0!==r?r:""),name:"".concat(null==e?void 0:e.name),description:"".concat(null==e?void 0:e.description),evaluationFrequency:"".concat(null==e?void 0:e.evaluationFrequency," minutes"),actionFrequency:"".concat(null==e?void 0:e.actionFrequency," minutes"),lastActionDate:V(null==e?void 0:e.lastActionDate),nextActionDate:V(null==e?void 0:e.nextActionDate),enabled:e.enabled?"Yes":"No",actions:l().createElement(l().Fragment,null,l().createElement(Za,{data:s[t],stockItemUuid:s[t].stockItemUuid}),l().createElement(Ga,{uuid:s[t].uuid}))})}))}),[s]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:St.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:St.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(Ra,{stockItemUuid:t})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:""},"Refresh")),l().createElement(Ua,{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,Ja(Qa({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?St.desktopHeader:St.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,Qa({className:r.isDesktop?St.desktopRow:St.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:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("div",{className:St.tileContent},l().createElement("p",{className:St.content},n("noRulesToDisplay","No Stock rules to display")),l().createElement("p",{className:St.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:St.paginationOverride}))};function Va(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ka(e){return function(e){if(Array.isArray(e))return Va(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 Va(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Va(e,t):void 0}}(e)||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 Xa=function(e){var t=Ft((0,r.useConfig)().packagingUnitsUUID),n=t.items.answers;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i,c,s,u,d,m,p,A=t.field.onChange;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:"".concat(e.name,"-").concat(e.row.id,"-").concat(e.row.uuid),size:"md",items:void 0!==(null===(r=e.row)||void 0===r?void 0:r.packagingUomUuid)?Ka(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(Ka(null!=n?n:[])):n||[],onChange:function(t){var n,r;null===(n=e.onPackageUnitChange)||void 0===n||n.call(e,null==t?void 0:t.selectedItem),A((null==t||null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)||"")},initialSelectedItem:void 0!==(null===(c=e.row)||void 0===c?void 0:c.packagingUomUuid)?{uuid:null===(s=e.row)||void 0===s?void 0:s.packagingUomUuid,display:null===(u=e.row)||void 0===u?void 0:u.packagingUomName}:null,selectedItem:void 0!==(null===(d=e.row)||void 0===d?void 0:d.packagingUomUuid)?{uuid:null===(m=e.row)||void 0===m?void 0:m.packagingUomUuid,display:null===(p=e.row)||void 0===p?void 0:p.packagingUomName}:null,itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},shouldFilterItem:function(){return!0},placeholder:e.placeholder,invalid:e.invalid,invalidText:e.invalidText})}})};var $a=ln.z.object({id:ln.z.string().nullish(),uuid:ln.z.string().nullish(),stockItemUuid:ln.z.string().nullish(),packagingUomName:ln.z.string().nullish(),packagingUomUuid:ln.z.string().nullish(),factor:ln.z.coerce.number().nullish(),isDefaultStockOperationsUoM:ln.z.boolean().nullish(),isDispensingUnit:ln.z.boolean().nullish()});function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ti(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ni(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ti(e,t,n[t])}))}return e}function ri(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 oi(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)||ii(e,t)||function(){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 ai(e){return function(e){if(Array.isArray(e))return ei(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ii(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 ii(e,t){if(e){if("string"==typeof e)return ei(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ei(e,t):void 0}}const li=function(e){var t=e.stockItemUuid,n=e.handleTabChange,o=Ee(),c=o.items,s=o.isLoading,u=o.setStockItemUuid,d=o.mutate,m=oi((0,i.useState)(c),2),p=m[0],A=m[1],g=oi((0,i.useState)({packagingUomUuid:void 0,factor:0,packagingUomName:""}),2),f=g[0],v=g[1];(0,i.useEffect)((function(){u(t)}),[t,u]),(0,i.useEffect)((function(){A(c)}),[c]);var _=(0,E.useTranslation)().t,h=(0,i.useMemo)((function(){return[{key:"packaging",header:_("packagingUnit","Packaging Unit"),styles:{width:"50%"}},{key:"quantity",header:_("packSize","Pack Size"),styles:{width:"50%"}},{key:"action",header:_("action","Actions"),styles:{width:"50%"}}]}),[_]),b=(0,on.cI)({defaultValues:{},mode:"all",resolver:(0,an.F)($a)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(on.RV,b,l().createElement(a.wQF,{rows:ai(c).concat([{}]),headers:h,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:De.packagingTableContainer},l().createElement(a.iA_,ri(ni({},r()),{className:De.packingTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,ri(ni({},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:De.packingTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(ci,{row:e,id:"".concat(t,"-").concat(null==e?void 0:e.uuid),onChange:function(t){return function(e,t){var n="number"==typeof t?t:parseFloat(t);A((function(t){return t.map((function(t){return t.uuid===e.uuid?ri(ni({},t),{factor:n}):t}))}))}(e,t)}})})),l().createElement(ci,{row:f||{},id:"new-package-unit",isEditing:!0,onChangePackageUnit:function(e){return t=e,void v(ri(ni({},f),{packagingUomUuid:t.uuid,packagingUomName:t.display}));var t},onChange:function(e){return function(e){v(ri(ni({},f),{factor:Number(e)}))}(e)}}))))}}),l().createElement("div",{className:De.packageUnitsBtn},l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=b.reset,o=f?{factor:f.factor,packagingUomUuid:f.packagingUomUuid,stockItemUuid:t}:null,a=p.filter((function(e){var t=c.find((function(t){return t.uuid===e.uuid}));return t&&t.factor!==e.factor})),i=o.packagingUomUuid?function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}(o).then((function(){(0,r.showSnackbar)({title:_("savePackingUnitTitle","Package Unit"),subtitle:_("savePackingUnitMessage","Package Unit saved successfully"),kind:"success"}),v({factor:0,packagingUomUuid:void 0,packagingUomName:""})}),(function(){(0,r.showSnackbar)({title:_("savePackagingUnitErrorTitle","Package Unit"),subtitle:_("savePackagingUnitErrorMessage","Error saving package unit"),kind:"error"})})):Promise.resolve({status:"no-create"}),l=a.map((function(e){return function(e,t){var n="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},signal:o.signal,body:e})}(e,e.uuid).then((function(){(0,r.showSnackbar)({title:_("updatePackingUnitTitle","Package Unit"),subtitle:_("updatePackingUnitMessage","Package Unit {{ name }} updated successfully",{name:e.packagingUomName}),kind:"success"})}),(function(){(0,r.showSnackbar)({title:_("updatePackagingUnitErrorTitle","Package Unit"),subtitle:_("updatePackagingUnitErrorMessage","Error updating package unit {{name}}",{name:e.packagingUomName}),kind:"error"})}))}));Promise.all([i].concat(ai(l))).then((function(){d(),ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem")),e(),n(0)}))},kind:"primary",renderIcon:Ar.vc},_("save","Save"))))};var ci=function(e){var t=e.isEditing,n=e.row,r=e.id,o=e.onChange,i=e.onChangePackageUnit,c=(0,on.Gc)(),s=c.control,u=c.formState.errors;return l().createElement(l().Fragment,null,l().createElement(a.SCH,null,l().createElement(a.pj1,null,t?l().createElement(Xa,{row:n,controllerName:"packagingUomUuid",name:"packagingUomUuid",placeholder:"Filter",control:s,onPackageUnitChange:function(e){return i(e)},invalid:!!u.packagingUomUuid}):(!t||!n.uuid.startsWith("new-item"))&&(null==n?void 0:n.packagingUomName)),l().createElement(a.pj1,null,l().createElement(oa,{row:n,controllerName:"factor",name:"factor",min:0,control:s,id:r,invalid:!!u.factor,hideSteppers:!0,onChange:function(e,t){return o(t.value)}})),l().createElement(a.pj1,null,l().createElement(Ae,{closeModal:function(){return!0},row:n}))))};function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ui(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 si(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(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 di=n(3162),mi=n(4655),pi={};pi.styleTagTransform=h(),pi.setAttributes=g(),pi.insert=p().bind(null,"head"),pi.domAPI=d(),pi.insertStyleElement=v(),s()(mi.Z,pi);const Ai=mi.Z&&mi.Z.locals?mi.Z.locals:void 0;function gi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vi(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)||_i(e,t)||function(){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){if(e){if("string"==typeof e)return gi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gi(e,t):void 0}}const hi=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=vi((0,i.useState)([]),2),g=A[0],f=A[1],v="tablet"===(0,r.useLayoutType)(),_=vi((0,i.useState)(n),1)[0],h=[10,20,30,40,50],b=vi((0,i.useState)(10),2),y=b[0],k=b[1],C=(0,r.usePagination)(_,y),w=C.goTo,S=C.results,D=C.currentPage;(0,i.useEffect)((function(){var e=[];S.map((function(t,n){return e.push((r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){fi(e,t,n[t])}))}return e}({},t),o=null!=(o={id:n++})?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})),r));var r,o})),f(e)}),[S,g]);var O=function(e){var n=x(_,t);if("Download As CSV"==e.currentTarget.innerText){var r=new Blob([n],{type:"text/csv;charset=utf-8"});(0,di.saveAs)(r,"data.csv")}else if("Download As Json"==e.currentTarget.innerText){var o=new Blob([n],{type:"application/json"});(0,di.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 gi(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||_i(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:Ai.tableContainer},d&&l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Ai.toolbarContent},o?o({onInputChange:u}):l().createElement(l().Fragment,null,l().createElement(a.PQB,{size:"sm",kind:"tertiary",renderIcon:vt.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:Ai.itemListSearch,expanded:!0,onChange:u,placeholder:m("searchThisList","Search this list"),size:"sm"})))),l().createElement(a.iA_,i(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,n.map((function(e){return l().createElement(a.xDH,r({header:e}),e.header)})))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(a.SCH,{key:e.id},e.cells.map((function(e){return l().createElement(a.pj1,{key:e.id},e.value)})))})))),0===t.length?l().createElement("div",{className:Ai.tileContainer},l().createElement(a.n9L,{className:Ai.tile},l().createElement("div",{className:Ai.tileContent},l().createElement("p",{className:Ai.content},m("No data","No data to display")),l().createElement("p",{className:Ai.helper},m("checkFilters","Check the filters above"))))):null,l().createElement(a.tlE,{forwardText:"Next page",backwardText:"Previous page",page:D,pageSize:y,pageSizes:h,totalItems:c||(null==_?void 0:_.length),className:Ai.pagination,onChange:function(e){var t=e.pageSize,n=e.page;if(t!==y&&k(t),n!==D){if(s)return void s(n);w(n)}}})))})))},bi=function(e){var t=(0,E.useTranslation)().t,n=Bt().stockLocations;return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ki(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ci(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){ki(e,t,n[t])}))}return e}function Ei(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 wi(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 yi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yi(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 Si=function(e){var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=wi((0,i.useState)(),2),c=o[0],s=o[1],u=function(e){var t=ui((0,i.useState)({startIndex:0,v:(null==e?void 0:e.v)||U.Default,limit:10,q:null==e?void 0:e.q,totalCount:!0}),2),n=t[0],o=t[1],a=ui((0,i.useState)(10),2),l=a[0],c=a[1],s=ui((0,i.useState)(null),2),u=s[0],d=s[1],m=ui((0,i.useState)(1),2),p=m[0],A=m[1],g=ui((0,i.useState)(null==e?void 0:e.stockItemUuid),2),f=g[0],v=g[1],_=ui((0,i.useState)(null==e?void 0:e.partyUuid),2),h=_[0],b=_[1],y=ui((0,i.useState)(null==e?void 0:e.locationUuid),2),k=y[0],C=y[1],E=ui((0,i.useState)(null==e?void 0:e.stockBatchUuid),2),w=E[0],S=E[1];(0,i.useEffect)((function(){o({startIndex:p-1,v:U.Default,limit:l,q:u,totalCount:!0,stockItemUuid:f,partyUuid:h,locationUuid:k,stockBatchUuid:w})}),[u,p,l,f,h,k,w]);var D=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemtransaction").concat(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),O=D.items,x=D.isLoading,N=D.isError,I=(0,i.useMemo)((function(){return[{key:"date",header:"Date"},{key:"location",header:"Location"},{key:"transaction",header:"Transaction"},{key:"in",header:"IN"},{key:"out",header:"OUT"},{key:"batch",header:"Batch"},{key:"reference",header:"Reference"},{key:"status",header:"Status"}]}),[]);return{items:O.results,totalCount:O.totalCount,currentPage:p,currentPageSize:l,setCurrentPage:A,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:d,tableHeaders:I,setStockItemUuid:v,setLocationUuid:C,setPartyUuid:b,setStockBatchUuid:S}}(c),d=u.isLoading,m=u.items,p=u.tableHeaders,A=u.totalCount,g=u.setCurrentPage,f=u.setStockItemUuid,v=u.setLocationUuid,_=wi((0,i.useState)(null),2),h=(_[0],_[1],wi((0,i.useState)(null),2));h[0],h[1],(0,i.useEffect)((function(){f(t)}),[t,f]);var b,y=(0,on.cI)({}).control,k=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e){var t,n,r,o,a,i,c;return Ei(Ci({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),date:V(null==e?void 0:e.dateCreated),location:e.operationSourcePartyName&&e.operationDestinationPartyName?e.operationSourcePartyName===(null==e?void 0:e.partyName)?(e.quantity,l().createElement(l().Fragment,null,l().createElement("span",{className:"transaction-location"},e.operationSourcePartyName),l().createElement(me.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(me.Xd,{size:16})," ",e.operationSourcePartyName)):null==e?void 0:e.partyName:null==e?void 0:e.partyName,transaction:(null==e?void 0:e.isPatientTransaction)?"Patient Dispense":e.stockOperationTypeName,quantity:"".concat(null==e||null===(t=e.quantity)||void 0===t?void 0:t.toLocaleString()," ").concat(null!==(o=null==e?void 0:e.packagingUomName)&&void 0!==o?o:""),batch:e.stockBatchNo?"".concat(e.stockBatchNo).concat(e.expiration?" (".concat(V(e.expiration),")"):""):"",reference:(null==e?void 0:e.stockOperationUuid)?l().createElement(Fo,{operationUuid:null==e?void 0:e.stockOperationUuid,operationNumber:null==e?void 0:e.stockOperationNumber,operations:b}):l().createElement(l().Fragment,null),status:null!==(a=null==e?void 0:e.stockOperationStatus)&&void 0!==a?a:"",in:(null==e?void 0:e.quantity)>=0?"".concat(null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString()," ").concat(null!==(i=null==e?void 0:e.packagingUomName)&&void 0!==i?i:""," of ").concat(e.packagingUomFactor):"",out:(null==e?void 0:e.quantity)<0?"".concat(null===(r=-1*(null==e?void 0:e.quantity))||void 0===r?void 0:r.toLocaleString()," ").concat(null!==(c=null==e?void 0:e.packagingUomName)&&void 0!==c?c:""," of ").concat(e.packagingUomFactor):""})}))}),[m,b]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(hi,{children:function(){return l().createElement("div",{style:{display:"flex",justifyContent:"space-between"}},l().createElement(bi,{onLocationIdChange:function(e){v(e),s(Ei(Ci({},c),{locationUuid:e}))},name:"TransactionLocationUuid",placeholder:n("filterByLocation","Filter by Location"),control:y,controllerName:"TransactionLocationUuid"}))},columns:p,data:k,totalItems:A,goToPage:g,hasToolbar:!0})},Di=function(e){var t=(0,E.useTranslation)().t,n=Bt().stockLocations;return l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(r){var o,i=r.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:null!=n?n:[],onChange:function(t){var n,r,o,a;null===(r=e.onLocationIdChange)||void 0===r||r.call(e,null!==(a=null==t||null===(n=t.selectedItem)||void 0===n?void 0:n.id)&&void 0!==a?a:""),c((null==t||null===(o=t.selectedItem)||void 0===o?void 0:o.name)||"")},initialSelectedItem:"".concat(null===(o=n[0])||void 0===o?void 0:o.name),itemToString:function(e){return t("location","".concat(null==e?void 0:e.name))},shouldFilterItem:function(){return!0},placeholder:e.placeholder,ref:u,value:s,invalid:e.invalid,invalidText:e.invalidText})}})};function Oi(e,t){(null==t||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,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ni(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){xi(e,t,n[t])}))}return e}function Ii(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 Ti=function(e){var t,n,r=e.stockItemUuid,o=(t=(0,i.useState)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Oi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oi(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=$n(c),d=u.isLoading,m=u.items,p=u.totalCount,A=u.setCurrentPage,g=u.setStockItemUuid,f=u.setLocationUuid,v=(0,E.useTranslation)().t,_=(0,on.cI)({}).control;(0,i.useEffect)((function(){g(r)}),[r,g]);var h=(0,i.useMemo)((function(){return[{key:"location",header:v("location","Location")},{key:"batch",header:v("batchNumber","Batch Number")},{key:"quantity",header:v("quantity","Quantity")},{key:"packaging",header:v("packagingUnit","Packaging Unit")},{key:"expires",header:v("expires","Expires")}]}),[v]),b=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n,r,o,a,i;return Ii(Ni({},e),{id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:V(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})}))}),[m]);return d?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(hi,{children:function(){return l().createElement(l().Fragment,null,l().createElement(Di,{control:_,onLocationIdChange:function(e){f(e),s(Ii(Ni({},c),{locationUuid:e}))},placeholder:v("filterByLocation","Filter by Location"),name:"BatchLocationUuid",controllerName:"BatchLocationUuid"}))},columns:h,data:b,totalItems:p,goToPage:A,hasToolbar:!0})};function Bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Pi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bi(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 Ui(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ji=function(e){var t=e.stockItemUuid,n=function(e){var t=Pi((0,i.useState)({startIndex:0,v:e||U.Default,limit:10,q:null,totalCount:!0}),2),n=t[0],r=t[1],o=Pi((0,i.useState)(10),2),a=o[0],l=o[1],c=Pi((0,i.useState)(null),2),s=c[0],u=c[1],d=Pi((0,i.useState)(1),2),m=d[0],p=d[1],A=Pi((0,i.useState)(),2),g=A[0],f=A[1],v=Pi((0,i.useState)(),2),_=v[0],h=v[1],b=Pi((0,i.useState)(),2),y=b[0],k=b[1],C=Pi((0,i.useState)(),2),E=C[0],w=C[1];(0,i.useEffect)((function(){r({startIndex:m-1,v:U.Default,limit:a,q:s,totalCount:!0,stockItemUuid:g,partyUuid:_,locationUuid:y,stockBatchUuid:E})}),[s,m,a,g,_,y,E]);var S,D=fe(n),O=D.items,x=D.isLoading,N=D.isError;return{items:null!==(S=O.results)&&void 0!==S?S:[],totalCount:O.totalCount,currentPage:m,currentPageSize:a,setCurrentPage:p,setPageSize:l,pageSizes:[10,20,30,40,50],isLoading:x,isError:N,setSearchString:u,setStockItemUuid:f,setLocationUuid:k,setPartyUuid:h,setStockBatchUuid:w}}(U.Default),r=n.isLoading,o=n.items,c=n.totalCount,s=n.setCurrentPage,u=n.setStockItemUuid,d=(0,E.useTranslation)().t;(0,i.useEffect)((function(){u(t)}),[t,u]);var m=(0,i.useMemo)((function(){return[{key:"location",header:d("location","Location")},{key:"quantity",header:d("quantity","Quantity")},{key:"packaging",header:d("packagingUnit","Packaging Unit")}]}),[]),p=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e,t){var n,r,o,a,i,l,c;return l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Ui(e,t,n[t])}))}return e}({},e),c=null!=(c={id:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),key:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),uuid:"".concat(e.partyUuid).concat(e.stockBatchUuid).concat(t),expires:V(null==e?void 0:e.expiration),location:null==e?void 0:e.partyName,quantity:null!==(r=null==e||null===(n=e.quantity)||void 0===n?void 0:n.toLocaleString())&&void 0!==r?r:"",batch:null!==(o=e.batchNumber)&&void 0!==o?o:"",packaging:"".concat(null!==(a=e.quantityUoM)&&void 0!==a?a:""," of ").concat(null!==(i=e.quantityFactor)&&void 0!==i?i:"")})?c:{},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(c)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(c)).forEach((function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(c,e))})),l}))}),[o]);return r?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(hi,{columns:m,data:p,totalItems:c,goToPage:s,hasToolbar:!1})};var zi=n(501),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,Ri=function(e){var t=ca({v:U.Default}),n=t.items.results;return t.isLoading?l().createElement(a.znL,null):l().createElement(on.Qr,{name:e.controllerName,control:e.control,render:function(t){var r,o,i=t.field,c=i.onChange,s=i.value,u=i.ref;return l().createElement(a.CtY,{titleText:e.title,name:e.name,control:e.control,controllerName:e.controllerName,id:e.name,size:"md",items:n||[],onChange:function(t){var n,r;null===(n=e.onSourceChange)||void 0===n||n.call(e,t.selectedItem),c(null===(r=t.selectedItem)||void 0===r?void 0:r.uuid)},initialSelectedItem:(null==n?void 0:n.find((function(t){var n;return t.uuid===(null===(n=e.row)||void 0===n?void 0:n.uuid)})))||{},itemToString:function(e){return e&&(null==e?void 0:e.name)?"".concat(null==e?void 0:e.name):""},shouldFilterItem:function(){return!0},value:null!==(o=null==n||null===(r=n.find((function(e){return e.uuid===s})))||void 0===r?void 0:r.name)&&void 0!==o?o:"",placeholder:e.placeholder,ref:u,invalid:e.invalid})}})};function Mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qi(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 Mi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mi(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 Gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(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}function Zi(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 Yi=function(e){e.isEditing;var t=e.stockItemUuid,n=(0,E.useTranslation)().t,o=function(e){var t=qi((0,i.useState)({startIndex:0,v:e||U.Default,q:null,totalCount:!0}),2),n=t[0],o=t[1],a=qi((0,i.useState)(),2),l=a[0],c=a[1];(0,i.useEffect)((function(){o({startIndex:0,v:U.Default,totalCount:!0,stockItemUuid:l})}),[l]);var s=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(n),u=s.items,d=s.isLoading,m=s.isError;return{items:u.results,totalCount:u.totalCount,isLoading:d,isError:m,setStockItemUuid:c}}(),c=o.items,s=o.isLoading,u=o.setStockItemUuid;(0,i.useEffect)((function(){u(t)}),[t,u]);var d=(0,i.useMemo)((function(){return[{key:"source",header:n("source","Source"),styles:{width:"50%"}},{key:"code",header:n("code","Code"),styles:{width:"50%"}},{key:"action",header:n("action","Actions"),styles:{width:"50%"}}]}),[n]),m=(0,on.cI)({defaultValues:{},mode:"all",resolver:(0,an.F)(ta)});return s?l().createElement(a.gqd,{showHeader:!1,rowCount:5,columnCount:5,zebra:!0}):l().createElement(on.RV,m,l().createElement(a.wQF,{rows:null!=c?c:[],headers:d,isSortable:!1,useZebraStyles:!0,render:function(e){var t=e.headers,n=e.getHeaderProps,r=e.getTableProps;return l().createElement(a.xJi,{className:Li.referencesTableContainer},l().createElement(a.iA_,Zi(Hi({},r()),{className:Li.referencesTable}),l().createElement(a.ssF,null,l().createElement(a.SCH,null,t.map((function(e){var t,r;return l().createElement(a.xDH,Zi(Hi({},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:Li.referencesTableBody},null==c?void 0:c.map((function(e,t){return l().createElement(Qi,{row:e,key:"".concat(t,"-").concat(null==e?void 0:e.uuid)})})),l().createElement(Qi,{row:{},key:"bottom-row",isEditing:!0}))))}}),l().createElement(a.zxk,{name:"save",type:"submit",className:"submitButton",onClick:function(){var e=(0,m.getValues)(),o=e.code,a=e.references;(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})})({referenceCode:o,stockItemUuid:t,stockSourceUuid:a}).then((function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference")),(0,r.showSnackbar)({title:n("saveReferenceTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceMessage","Stock Item Reference saved successfully"),kind:"success"})}),(function(e){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitemreference"));var t=le(e);(0,r.showSnackbar)({title:n("saveStockItemReferenceErrorTitle","StockItem Reference"),subtitle:n("saveStockItemReferenceErrorMessage","Error saving stock item reference"+t.join(",")),kind:"error"})}))},kind:"primary",renderIcon:Ar.vc},n("save","Save")))};var Qi=function(e){var t,n=e.isEditing,o=e.row,i=e.key,c=(0,E.useTranslation)().t,s=(0,on.Gc)(),u=s.control,d=(s.formState.errors,function(e){var t,n,a;e.preventDefault(),(t=o.uuid,n="".concat(r.restBaseUrl,"/stockmanagement/stockitemreference/").concat(t),a=new AbortController,(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:a.signal})).then((function(){(0,r.showSnackbar)({title:c("deletePackagingUnitTitle","Delete StockItem reference"),kind:"success",subtitle:c("deleteStockItemReferenceMesaage","StockItem reference deleted Successfully")})}),(function(e){var t=le(e);(0,r.showSnackbar)({title:c("deleteStockItemReferenceTitle","Error Deleting a stockitem reference"),kind:"error",subtitle:t.join(",")})}))});return l().createElement(a.SCH,null,l().createElement(a.pj1,null,n?l().createElement(Ri,{row:o,name:"references",controllerName:"references",control:u,placeholder:c("filter","Filter...")}):(!n||!o.uuid.startsWith("new-item"))&&(null==o?void 0:o.stockSourceName)),l().createElement(a.pj1,null,l().createElement("div",{className:Li.referencesTableCell},l().createElement(Cn,{id:"".concat(o.uuid,"-").concat(i),name:"code",control:u,size:"md",value:null!==(t=null==o?void 0:o.referenceCode)&&void 0!==t?t:"",controllerName:"code",labelText:""}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Delete",kind:"ghost",renderIcon:pe.ZN,onClick:function(e){return d(e)}}))))};function Ji(e,t){(null==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 Wi=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 Ji(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ji(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=function(e){d(e)},p=[{name:c("stockItemDetails","Stock Item Details"),component:l().createElement(ya,{handleTabChange:m,model:o,onSave:a,isEditing:r})},{name:c("packagingUnits","Packaging Units"),component:l().createElement(li,{isEditing:!0,handleTabChange:m,stockItemUuid:o.uuid}),disabled:!r},{name:c("transactions","Transactions"),component:l().createElement(Si,{stockItemUuid:o.uuid}),disabled:!r},{name:c("batchInformation","Batch Information"),component:l().createElement(Ti,{stockItemUuid:o.uuid}),disabled:!r},{name:c("quantities","Quantities"),component:l().createElement(ji,{stockItemUuid:o.uuid}),disabled:!r},{name:c("stockRules","Rules"),component:l().createElement(Wa,{stockItemUuid:o.uuid}),disabled:!r},{name:c("references","References"),component:l().createElement(Yi,{stockItemUuid:o.uuid,isEditing:r}),disabled:!r}];return l().createElement(Ht,{onChange:m,tabs:p,selectedIndex:u})};function Vi(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 Ki=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){Vi(a,r,o,i,l,"next",e)}function l(e){Vi(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?ye:be)(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,Xi(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)}}(),Xi=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)||e.conceptName||""),l().createElement(Wi,{model:e,onSave:function(e){return Ki(e,t)},isEditing:t}))};const $i=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Xi(Wo,!1)}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnew","Add New"))};var el=n(1048),tl={};tl.styleTagTransform=h(),tl.setAttributes=g(),tl.insert=p().bind(null,"head"),tl.domAPI=d(),tl.insertStyleElement=v(),s()(el.Z,tl);const nl=el.Z&&el.Z.locals?el.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:nl.spacing},l().createElement(a.EUY,{labelText:"All",value:"",id:"is-drug-all"}),l().createElement(a.EUY,{labelText:"Pharmaceuticals",value:"true",id:"is-drug-drug"}),l().createElement(a.EUY,{labelText:"Non Pharmaceuticals",value:"false",id:"is-drug-other"}))};function 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 al(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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.")}()}const il=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"))},ll=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,Xi(n,!0)},iconDescription:r("editStockItem","Edit Stock Item")},"".concat(null!==(t=null==n?void 0:n.drugName)&&void 0!==t?t:n.conceptName))};function cl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ul(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){sl(e,t,n[t])}))}return e}function dl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const ml=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(""),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stockitem"))},d=function(e){(0,E.useTranslation)().t;var t=al((0,i.useState)(1),2),n=t[0],o=t[1],a=al((0,i.useState)(10),2),l=a[0],c=a[1],s=al((0,i.useState)(null),2),u=s[0],d=s[1],m=al((0,i.useState)(""),2),p=m[0],A=m[1],g=al((0,i.useState)({startIndex:n-1,v:e||U.Default,limit:l,q:null,totalCount:!0}),2),f=g[0],v=g[1],_=ge(f),h=_.items,b=_.isLoading,y=_.isError,k=(0,r.usePagination)(h.results,l);return(0,i.useEffect)((function(){v({startIndex:n-1,v:U.Default,limit:l,q:u,totalCount:!0,isDrug:p})}),[u,n,l,p]),{items:k.results,pagination:k,totalCount:h.totalCount,currentPageSize:l,currentPage:n,setCurrentPage:o,setPageSize:c,pageSizes:[10,20,30,40,50],isLoading:b,isError:y,isDrug:p,setDrug:function(e){o(1),A(e)},setSearchString:d}}(U.Full),m=d.isLoading,p=d.items,A=d.totalCount,g=d.currentPageSize,f=d.setPageSize,v=d.pageSizes,_=d.currentPage,h=d.setCurrentPage,b=d.isDrug,y=d.setDrug,k=d.setSearchString,C=vn((function(e){k(e)}),1e3);(0,i.useEffect)((function(){C(c)}),[c,C]);var w=(0,i.useMemo)((function(){return[{id:0,header:n("type","Type"),key:"type"},{id:1,header:n("genericName","Generic Name"),key:"genericName"},{id:2,header:n("commonName","Common Name"),key:"commonName"},{id:3,header:n("tradeName","Trade Name"),key:"tradeName"},{id:4,header:n("dispensingUnitName","Dispensing UoM"),key:"dispensingUnitName"},{id:5,header:n("defaultStockOperationsUoMName","Bulk Packaging"),key:"defaultStockOperationsUoMName"},{id:6,header:n("reorderLevel","Reorder Level"),key:"reorderLevel"},{id:7,key:"actions",header:"Actions"}]}),[n]),S=(0,i.useMemo)((function(){return null==p?void 0:p.map((function(e,t){var r;return dl(ul({},e),{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),type:(null==e?void 0:e.drugUuid)?n("drug","Drug"):n("other","Other"),genericName:l().createElement(ll,{data:p[t]}),commonName:null==e?void 0:e.commonName,tradeName:(null==e?void 0:e.drugUuid)?null==e?void 0:e.conceptName:"",preferredVendorName:null==e?void 0:e.preferredVendorName,dispensingUoM:null==e?void 0:e.defaultStockOperationsUoMName,dispensingUnitName:null==e?void 0:e.dispensingUnitName,defaultStockOperationsUoMName:null==e?void 0:e.defaultStockOperationsUoMName,reorderLevel:(null==e?void 0:e.reorderLevelUoMName)&&(null==e?void 0:e.reorderLevel)?"".concat(null==e||null===(r=e.reorderLevel)||void 0===r?void 0:r.toLocaleString()," ").concat(null==e?void 0:e.reorderLevelUoMName):"",actions:l().createElement(a.ua7,{align:"bottom",label:"Edit Stock Item"},l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:function(){e.isDrug=!!e.drugUuid,Xi(e,!0)},iconDescription:n("editStockItem","Edit Stock Item"),renderIcon:function(e){return l().createElement(vt.I8,ul({size:16},e))}}))})}))}),[p,n]);return m?l().createElement(a.gqd,{role:"progressbar"}):l().createElement(l().Fragment,null,l().createElement(a.x45,null,n("panelDescription","Drugs and other stock items managed by the system.")),l().createElement(a.wQF,{rows:S,headers:w,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,d=e.getTableProps,m=e.getRowProps,p=e.getBatchActionProps;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.iG6,p()),l().createElement(a.Vj0,{style:{display:"flex",alignItems:"center"}},l().createElement(a.Ys1,{persistent:!0,value:c,onChange:function(e){return t=e.target.value,void s(t);var t}}),l().createElement(rl,{filterType:b,changeFilterType:y}),l().createElement(il,null),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement($i,null))),l().createElement(a.iA_,d(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,o.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,dl(ul({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?St.desktopHeader:St.tabletHeader,key:"".concat(e.key),isSortable:"name"!==e.key}),null!==(n=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==n?n:e.header)})),l().createElement(a.xDH,null))),l().createElement(a.RMI,null,t.map((function(e){return l().createElement(l().Fragment,{key:e.id},l().createElement(a.SCH,dl(ul({className:r.isDesktop?St.desktopRow:St.tabletRow},m({row:e})),{key:e.id}),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),0===t.length?l().createElement("div",{className:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("div",{className:St.tileContent},l().createElement("p",{className:St.content},n("noItemsToDisplay","No Stock Items to display")),l().createElement("p",{className:St.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:_,pageSize:g,pageSizes:v,totalItems:A,onChange:function(e){var t=e.page,n=e.pageSize;h(t),f(n)},className:St.paginationOverride}))};var pl=n(5104),Al={};Al.styleTagTransform=h(),Al.setAttributes=g(),Al.insert=p().bind(null,"head"),Al.domAPI=d(),Al.insertStyleElement=v(),s()(pl.Z,Al);const gl=pl.Z&&pl.Z.locals?pl.Z.locals:void 0;function fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vl(e){var t,n,o=function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(z(e)),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{items:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(e),a=o.items,l=o.isLoading,c=o.isError,s=(t=(0,i.useState)(10),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return fl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fl(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 _l=n(4300),hl={};hl.styleTagTransform=h(),hl.setAttributes=g(),hl.insert=p().bind(null,"head"),hl.domAPI=d(),hl.insertStyleElement=v(),s()(_l.Z,hl);const bl=_l.Z&&_l.Z.locals?_l.Z.locals:void 0;function yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kl(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 Cl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function El(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Cl(e,t,n[t])}))}return e}function wl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function Sl(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)||Ol(e,t)||function(){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 Dl(e){return function(e){if(Array.isArray(e))return yl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ol(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 Ol(e,t){if(e){if("string"==typeof e)return yl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yl(e,t):void 0}}var xl=ee();const Nl=function(e){var t,n,o,c,s=e.model,u=e.editMode,d=(0,E.useTranslation)().t,m=(0,r.useSession)(),p=Sl((0,i.useState)(El({},s)),2),A=p[0],g=p[1],f=Sl((0,i.useState)([]),2),v=f[0],_=f[1],h=Sl((0,i.useState)(!1),2),b=(h[0],h[1]),y=null==m||null===(t=m.user)||void 0===t?void 0:t.uuid,k=Ut(),C=k.types.results,w=k.isLoading,S=zt({v:U.Default}),D=S.items,O=S.isLoading,x=Sl((0,i.useState)(null),2),N=x[0],I=x[1],T=function(e){var t="".concat(r.restBaseUrl,"/user/").concat(e),n=(0,j.ZP)(t,r.openmrsFetch),o=n.data,a=n.error,i=n.isLoading;return{data:(null==o?void 0:o.data)||{},isLoading:i,isError:a}}(N),B=T.data,P=(T.isError,Pt({v:U.Default})),z=(P.items,P.isLoading),F=Bt().stockLocations,L=Sl((0,i.useState)(""),2),R=(L[0],L[1]),M=Sl((0,i.useState)([]),2),q=M[0],G=M[1],H=null!==(c=null==D?void 0:D.results)&&void 0!==c?c:[];(0,i.useEffect)((function(){(null==s?void 0:s.userUuid)&&I(s.userUuid)}),[s]);var Z,Y,J,W=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},V=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){kl(a,r,o,i,l,"next",e)}function l(e){kl(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(t){return e.preventDefault(),function(e){var t=new AbortController,n=null!=e.uuid,o="".concat(r.restBaseUrl,"/stockmanagement/userrolescope").concat(n?"/"+e.uuid:"");return(0,r.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal,body:e})}(A).then((function(e){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),(0,r.showToast)({critical:!0,title:d("addUserRole","Add User role"),kind:"success",description:d("successfullysaved","You have successfully saved user role scope ")}),Q()}),(function(e){(0,r.showNotification)({title:d("errorSaving user role scope', 'Error Saving user role scope"),kind:"error",critical:!0,description:null==e?void 0:e.message}),Q()})),[2]}))}));return function(t){return e.apply(this,arguments)}}();return w||z||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:bl.section},l().createElement("div",null,(null==D||null===(n=D.results)||void 0===n?void 0:n.length)>0&&l().createElement(l().Fragment,null,l().createElement("span",{className:bl.subTitle},d("user","User")),l().createElement(a.CtY,{id:"userName",size:"md",labelText:d("user","User"),items:q.length?q:H,onChange:function(e){var t,n,r,o=["d210eb66-2188-11ed-9dff-507b9dea1806","cca4be4b-2188-11ed-9dff-507b9dea1806","84bdd876-4694-11ed-8109-00155dcc3fc0","a49be648-6b0a-11ed-93a2-806d973f13a9","2083fd40-3391-11ed-a667-507b9dea1806"],a=null===(t=e.selectedItem)||void 0===t?void 0:t.roles.filter((function(e){return o.includes(e.uuid)})).filter((function(e){return e.uuid!==y}));g(wl(El({},A),{userUuid:null===(n=e.selectedItem)||void 0===n?void 0:n.uuid})),_(null!=a?a:[]),I(null==e||null===(r=e.selectedItem)||void 0===r?void 0:r.uuid)},shouldFilterItem:function(){return!0},itemToString:function(e){var t,n,r;return"".concat(null!==(r=null!==(n=null==e||null===(t=e.person)||void 0===t?void 0:t.display)&&void 0!==n?n:null==e?void 0:e.display)&&void 0!==r?r:"")},onInputChange:function(e){R(e),function(e){if(""===e.trim())b(!1);else{b(!0);var t=H.filter((function(e){return e.uuid!==y})).filter((function(t){var n,r,o;return(null!==(o=null!==(r=null==t||null===(n=t.person)||void 0===n?void 0:n.display)&&void 0!==r?r:null==t?void 0:t.display)&&void 0!==o?o:"").toLowerCase().includes(e.toLowerCase())}));G(t)}}(e)},placeholder:"Filter...",initialSelectedItem:null!==(Z=H.find((function(e){return e.uuid===(null==s?void 0:s.userUuid)})))&&void 0!==Z?Z:null})))),l().createElement("section",{className:bl.section},l().createElement("div",null,l().createElement(a.PhF,{name:"role",className:"select-field",labelText:d("role","Role"),id:"select-role",value:null!==(Y=A.role)&&void 0!==Y?Y:"placeholder-item",onChange:function(e){var t,n,r,o=null==F||null===(t=F.filter((function(e){return!e.id})))||void 0===t?void 0:t.map((function(e){return e.id})),a=null!==(r=null==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(wl(El({},A),{role:e.target.value,locations:a}))}},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"placeholder-item",text:d("Choose a role")}),u?l().createElement(a.QlF,{key:null==A?void 0:A.role,value:null==A?void 0:A.role,text:null==A?void 0:A.role}):null===(o=null!==(J=null==B?void 0:B.roles)&&void 0!==J?J:v)||void 0===o?void 0:o.map((function(e){return l().createElement(a.QlF,{key:e.display,value:e.display,text:e.display})}))))),l().createElement("section",{className:bl.section},l().createElement(a.cOn,{className:bl.checkboxGrid},l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.enabled);g(wl(El({},A),{enabled:n}))},checked:null==A?void 0:A.enabled,labelText:d("enabled","Enabled ?"),value:null==s?void 0:s.enabled,id:"chk-userEnabled"}),l().createElement(a.XZJ,{onChange:function(e,t){var n=!(null==A?void 0:A.permanent);g(wl(El({},A),{permanent:n,activeFrom:void 0,activeTo:void 0}))},name:"isPermanent",checked:null==A?void 0:A.permanent,value:null==s?void 0:s.permanent,labelText:d("permanent","Permanent ?"),id:"chk-userPermanent"}),!(null==A?void 0:A.permanent)&&l().createElement(l().Fragment,null,l().createElement(a.Mtg,{datePickerType:"range",light:!0,minDate:$(xl),locale:"en",dateFormat:X,onChange:function(e){g(wl(El({},A),{activeFrom:e[0],activeTo:e[1]}))}},l().createElement(a.aj6,{id:"date-picker-input-id-start",name:"activeFrom",placeholder:K,labelText:d("activeFrom","Active From"),value:$(null==A?void 0:A.activeFrom)}),l().createElement(a.aj6,{id:"date-picker-input-id-finish",name:"activeTo",placeholder:K,labelText:d("activeTo","Active To"),value:$(null==A?void 0:A.activeTo)}))))),l().createElement("br",null),l().createElement("section",{className:bl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:bl.sectionTitle}," ",d("stockOperation","Stock Operations")),l().createElement("div",{className:bl.hr}),l().createElement("span",{className:bl.subTitle},d("roleDescription","The role will be applicable to only selected stock operations.")))),l().createElement("section",{className:bl.section},l().createElement(a.cOn,{className:bl.checkboxGrid},(null==C?void 0:C.length)>0&&C.map((function(e){return l().createElement("div",{style:{display:"flex",flexDirection:"row"}},l().createElement(a.XZJ,{value:e.uuid,checked:W(e),className:bl.checkbox,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=Dl(A.operationTypes.filter((function(e){return e.operationTypeUuid!==(null==o?void 0:o.operationTypeUuid)})));g(wl(El({},A),{operationTypes:a}))}else{var i,l=null==C?void 0:C.find((function(t){var n;return t.uuid===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),c={operationTypeName:null==l?void 0:l.name,operationTypeUuid:null==l?void 0:l.uuid};g(wl(El({},A),{operationTypes:Dl(null!==(i=null==A?void 0:A.operationTypes)&&void 0!==i?i:[]).concat([c])}))}}(t,e.uuid,W(e))},labelText:e.name,id:e.uuid}))})))),l().createElement("br",null),l().createElement("section",{className:bl.section},l().createElement("div",{style:{display:"flex",flexDirection:"column"}},l().createElement("span",{className:bl.sectionTitle}," ",d("Locations")),l().createElement("div",{className:bl.hr}),l().createElement("span",{className:bl.subTitle},d("Use the toggle to apply this scope to the locations under the selected location.")))),l().createElement("section",{className:bl.section},l().createElement(a.cOn,{className:bl.checkboxGrid},(null==F?void 0:F.length)>0&&F.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=Dl(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(wl(El({},A),{locations:i}))}else{var l,c=null==F?void 0:F.find((function(t){var n;return t.id===(null==e||null===(n=e.target)||void 0===n?void 0:n.value)})),s={locationName:null==c?void 0:c.name,locationUuid:null==c?void 0:c.id,enableDescendants:!1},u=Dl(null!==(l=null==A?void 0:A.locations)&&void 0!==l?l:[]).concat([s]);g(wl(El({},A),{locations:u}))}}(t,e.id)},className:bl.checkbox,labelText:e.name,checked:null!=o}),o&&l().createElement(a.ZDl,{value:e.id,hideLabel:!0,className:bl.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},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit",onClick:V},d("save","Save")))))},Il=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock User Role Scope",l().createElement(Nl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewuserrolescope","Add New User Role Scope"))};function Tl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Bl=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock User Role",l().createElement(Nl,{model:t,editMode:!0}))}),[t]);return l().createElement(a.zxk,{kind:"ghost",onClick:r,iconDescription:n("editUserScope","Edit UserScope"),renderIcon:function(e){return l().createElement(vt.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){Tl(e,t,n[t])}))}return e}({size:16},e))}})};function Pl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ul(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const jl=function(e){var t,n,o=e.uuid,c=(0,E.useTranslation)().t,s=(t=(0,i.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return Pl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pl(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-user-scope-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/userrolescope/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope")),d(!1),(0,r.showToast)({critical:!0,title:c("deletingstockUserScope","Delete Stock User Scope"),kind:"success",description:c("stockuserscopedeletedsuccessfully","Stock User Scope Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingUserScope', 'error deleting a user scope"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteUserScope","Delete Stock User Scope"),renderIcon:function(e){return l().createElement(pe.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){Ul(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};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 Fl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(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 Ll(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 Rl=function(){var e=(0,E.useTranslation)().t,t=(0,r.useSession)(),n=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/userrolescope"))},o=vl({v:U.Default,totalCount:!0}),c=o.items,s=o.totalItems,u=o.currentPage,d=o.pageSizes,m=o.goTo,p=o.currentPageSize,A=o.setPageSize,g=o.isLoading,f=(0,i.useMemo)((function(){return[{id:0,header:e("user","User"),key:"user"},{id:1,header:e("role","Role"),key:"role"},{id:2,header:e("location","Location(s)"),key:"locations"},{id:3,header:e("stockOperations","Stock Operations"),key:"stockOperations"},{id:4,header:e("permanent","Permanent ?"),key:"permanent"},{id:5,header:e("ActiveFrom","Active From "),key:"activeFrom"},{id:6,header:e("activeTo","Active To"),key:"activeTo"},{id:7,header:e("enabled","Enabled ?"),key:"enabled"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),v=(0,i.useMemo)((function(){return null==c?void 0:c.map((function(n,r){var o,i,s,u,d,m,p=t.user.uuid===n.userUuid;return Ll(Fl({},n),{id:null==n?void 0:n.uuid,key:"key-".concat(null==n?void 0:n.uuid),uuid:"".concat(null==n?void 0:n.uuid),user:t.user.uuid===n.userUuid?"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName):l().createElement(a.rUS,{to:(m=null==n?void 0:n.uuid,"".concat("/user-role-scopes","/").concat(m))},"".concat(null==n?void 0:n.userFamilyName," ").concat(n.userGivenName)),roleName:null==n?void 0:n.role,locations:null==n||null===(o=n.locations)||void 0===o?void 0:o.map((function(e){var t="loc-".concat(null==n?void 0:n.uuid,"-").concat(e.locationUuid);return l().createElement("span",{key:t},null==e?void 0:e.locationName,(null==e?void 0:e.enableDescendants)?l().createElement(me.l2,{key:"".concat(t,"-").concat(r,"-0")}):l().createElement(me.Xd,{key:"".concat(t,"-").concat(r,"-1")})," ")})),stockOperations:null==n||null===(s=n.operationTypes)||void 0===s||null===(i=s.map((function(e){return null==e?void 0:e.operationTypeName})))||void 0===i?void 0:i.join(", "),permanent:(null==n?void 0:n.permanent)?e("yes","Yes"):e("no","No"),activeFrom:null!==(u=V(null==n?void 0:n.activeFrom))&&void 0!==u?u:"Not Set",activeTo:null!==(d=V(null==n?void 0:n.activeTo))&&void 0!==d?d:"Not Set",enabled:(null==n?void 0:n.enabled)?e("yes","Yes"):e("no","No"),actions:l().createElement("div",{style:{display:"flex"}},!p&&l().createElement(l().Fragment,null,l().createElement(Bl,{data:c[r]}),l().createElement(jl,{uuid:c[r].uuid})))})}))}),[t.user.uuid,c,e]);return g?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:gl.tableOverride},l().createElement(a.x45,null,e("panelDescription","To access stock management features, users must have assigned roles specifying location and stock operation type scopes.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:null!=v?v:[],headers:f,isSortable:!0,useZebraStyles:!0,render:function(t){var o=t.rows,i=t.headers,c=t.getHeaderProps,s=t.getTableProps,u=t.getRowProps,d=t.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:gl.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:n},"Refresh")),l().createElement(Il,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,Ll(Fl({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?gl.desktopHeader:gl.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,Fl({className:r.isDesktop?gl.desktopRow:gl.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:gl.tileContainer},l().createElement(a.n9L,{className:gl.tile},l().createElement("div",{className:gl.tileContent},l().createElement("p",{className:gl.content},e("noOperationsToDisplay","No Stock User scopes to display")),l().createElement("p",{className:gl.helper},e("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:u,pageSize:p,pageSizes:d,totalItems:s,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==u&&m(n)},className:gl.paginationOverride}))};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}var ql=n(8098),Gl={};Gl.styleTagTransform=h(),Gl.setAttributes=g(),Gl.insert=p().bind(null,"head"),Gl.domAPI=d(),Gl.insertStyleElement=v(),s()(ql.Z,Gl);const Hl=ql.Z&&ql.Z.locals?ql.Z.locals:void 0;function Zl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Yl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Yl(e,t,n[t])}))}return e}function Jl(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}const Wl=function(e){var t,n,o,c=e.model,s=(0,E.useTranslation)().t,u=Ft((0,r.useConfig)().stockSourceTypeUUID).items,d=(n=(0,i.useState)(Ql({},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 Zl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zl(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],p=d[1],A=(0,i.useCallback)((function(e){e.preventDefault(),c&&(m.uuid=c.uuid),function(e){var t,n,o,a=null!=e.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stocksource").concat(a?"/"+e.uuid:""),l=new AbortController;return(0,r.openmrsFetch)(i,{method:"POST",headers:{"Content-Type":"application/json"},signal:l.signal,body:(n=la({},e),o={sourceType:null==e||null===(t=e.sourceType)||void 0===t?void 0:t.uuid},o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))})),n)})}(m).then((function(){(0,r.showToast)({critical:!0,title:s("addedSource","Add Source"),kind:"success",description:s("stocksourceaddedsuccessfully","Stock Source Added Successfully")}),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),Q()}),(function(e){(0,r.showNotification)({title:s("errorAddingSource', 'error adding a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch()}),[m,c,s]);return l().createElement("div",null,l().createElement(a.l09,{onSubmit:A},l().createElement(a.xBx,null),l().createElement(a.fef,null,l().createElement("section",{className:Hl.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(Jl(Ql({},m),{name:e.target.value}))},value:null==c?void 0:c.name,placeholder:"e.g National Medical Stores"})),l().createElement("section",{className:Hl.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(Jl(Ql({},m),{acronym:e.target.value}))},value:null==c?void 0:c.acronym,labelText:s("acronym","Acronym/Code")})),l().createElement("section",{className:Hl.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(Jl(Ql({},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")))))},Vl=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("Add Stock Source",l().createElement(Wl,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("stockmanagement.addnewsource","Add New Source"))};var Kl=n(5551),Xl={};Xl.styleTagTransform=h(),Xl.setAttributes=g(),Xl.insert=p().bind(null,"head"),Xl.domAPI=d(),Xl.insertStyleElement=v(),s()(Kl.Z,Xl);const $l=Kl.Z&&Kl.Z.locals?Kl.Z.locals:void 0;function ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const tc=function(e){var t,n=e.onFilterChange,o=Ft((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:$l.filterContainer},l().createElement(a.Ltx,{id:"stockSourcesFiter",items:(t=i.answers,function(e){if(Array.isArray(e))return ec(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 ec(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ec(e,t):void 0}}(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 nc=n(6940),rc={};rc.styleTagTransform=h(),rc.setAttributes=g(),rc.insert=p().bind(null,"head"),rc.domAPI=d(),rc.insertStyleElement=v(),s()(nc.Z,rc);const oc=nc.Z&&nc.Z.locals?nc.Z.locals:void 0;function ac(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ic(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const lc=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 ac(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ac(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=s[0],d=s[1],m=l().useCallback((function(){var e=(0,r.showModal)("delete-stock-modal",{close:function(){return e()},uuid:o,onConfirmation:function(){var t=[];t.push(o),function(e){var t=e.reduce((function(e,t,n){return 0===n?e:e+=(e.length>0?",":"")+encodeURIComponent(t)}),"");t.length>0&&(t="?ids="+t);var n="".concat(r.restBaseUrl,"/stockmanagement/stocksource/").concat(e[0]).concat(t),o=new AbortController;return(0,r.openmrsFetch)(n,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:o.signal})}(t).then((function(){d(!1),ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource")),(0,r.showToast)({critical:!0,title:c("deletingSource","Delete Source"),kind:"success",description:c("stocksourcedeletedsuccessfully","Stock Source Deleted Successfully")})}),(function(e){d(!1),(0,r.showNotification)({title:c("errorDeletingSource', 'error deleting a source"),kind:"error",critical:!0,description:null==e?void 0:e.message})})).catch(),e()}})}),[c,o]),p=l().createElement(a.zxk,{kind:"ghost",size:"md",onClick:m,iconDescription:c("deleteSource","Delete Source"),renderIcon:function(e){return l().createElement(pe.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){ic(e,t,n[t])}))}return e}({size:16},e))}});return u?l().createElement(a.lSo,null):p};function cc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sc=function(e){var t=e.data,n=(0,E.useTranslation)().t,r=(0,i.useCallback)((function(){Y("Edit Stock Source",l().createElement(Wl,{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(vt.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){cc(e,t,n[t])}))}return e}({size:16},e))}})};function uc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){dc(e,t,n[t])}))}return e}function pc(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 Ac=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 uc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=o[0],s=o[1],u=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/stocksource"))},d=function(e){var t=ca(e),n=t.items,o=t.isLoading,a=t.isError,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return 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.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n.results,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,i.useMemo)((function(){return[{id:1,header:"Name",key:"name"},{id:2,header:"Acronym",key:"acronym"},{id:3,header:"Source Type",key:"sourceType"},{id:4,header:"actions",key:"actions"}]}),[]);return{items:m,totalItems:null==n?void 0:n.totalCount,currentPage:p,currentPageSize:c,paginatedItems:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:o,isError:a,setPageSize:s,tableHeaders:A}}({v:U.Default,totalCount:!0}),m=d.items,p=d.totalItems,A=d.tableHeaders,g=d.currentPage,f=d.pageSizes,v=d.goTo,_=d.currentPageSize,h=d.setPageSize,b=d.isLoading,y=(0,i.useMemo)((function(){return null==m?void 0:m.map((function(e,t){var n;return pc(mc({},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(sc,{data:m[t]}),l().createElement(lc,{uuid:m[t].uuid}))})}))}),[m]),k=function(e){s(e)},C=(0,i.useMemo)((function(){return c?y.filter((function(e){return e.sourceType===c})):y}),[y,c]);return b?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:oc.tableOverride},l().createElement(a.x45,null,n("panelDescription","List of partners who provide stock to the facility.")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:C,headers:A,isSortable:!0,useZebraStyles:!0,render:function(e){var t=e.rows,o=e.headers,i=e.getHeaderProps,c=e.getTableProps,s=e.getRowProps,d=e.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:oc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement("div",{style:{display:"flex",alignItems:"center"}},l().createElement(tc,{onFilterChange:k})),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:u},"Refresh")),l().createElement(Vl,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,pc(mc({},i({header:e,isSortable:e.isSortable})),{className:r.isDesktop?oc.desktopHeader:oc.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,mc({className:r.isDesktop?oc.desktopRow:oc.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:oc.tileContainer},l().createElement(a.n9L,{className:oc.tile},l().createElement("div",{className:oc.tileContent},l().createElement("p",{className:oc.content},n("noSourcesToDisplay","No Stock sources to display")),l().createElement("p",{className:oc.helper},n("checkFilters","Check the filters above"))))):null)}}),l().createElement(a.tlE,{page:g,pageSize:_,pageSizes:f,totalItems:p,onChange:function(e){var t=e.pageSize,n=e.page;t!==_&&h(t),n!==g&&v(n)},className:oc.paginationOverride}))};function gc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fc(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 vc(){return vc=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){fc(a,r,o,i,l,"next",e)}function l(e){fc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(a){switch(a.label){case 0:t=e.locationPayload,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,(0,r.openmrsFetch)("".concat(r.restBaseUrl,"/location/"),{method:"POST",headers:{"Content-Type":"application/json"},body:t})];case 2:return[2,a.sent()];case 3:return n=a.sent(),o=le(n),(0,r.showToast)({description:o.join(", "),title:"Error on saving form",kind:"error",critical:!0}),[3,4];case 4:return[2]}}))})),vc.apply(this,arguments)}var _c=n(2761),hc={};hc.styleTagTransform=h(),hc.setAttributes=g(),hc.insert=p().bind(null,"head"),hc.domAPI=d(),hc.insertStyleElement=v(),s()(_c.Z,hc);const bc=_c.Z&&_c.Z.locals?_c.Z.locals:void 0;function yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function kc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){kc(e,t,n[t])}))}return e}function Ec(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 yc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yc(e,t):void 0}}(e,t)||function(){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 wc=ln.z.object({name:ln.z.string().max(255)});const Sc=function(e){var t,n,o,c,s,u,d,m=e.showModal,p=e.onModalChange,A=e.handleCreateQuestion,g=e.headerTitle,f=e.initialData,v=(0,E.useTranslation)().t,_=Ec((0,i.useState)(!1),2),h=_[0],b=_[1],y=Ec((0,i.useState)(""),2),k=y[0],C=y[1],w=(o="".concat(r.restBaseUrl,"/locationtag/"),s=(c=(0,j.ZP)(o,r.openmrsFetch)).data,c.error,u=c.isLoading,c.isValidating,d=c.mutate,{locationTagList:(null==s||null===(t=s.data)||void 0===t?void 0:t.results)?null==s||null===(n=s.data)||void 0===n?void 0:n.results:[],loading:u,mutate:d}).locationTagList,S=(0,on.cI)({mode:"all",resolver:(0,an.F)(wc),defaultValues:{name:f.name||"",tags:f.tags||[]}}),D=S.handleSubmit,O=S.control,x=S.getValues,N=S.formState.isDirty;return l().createElement(a.lpG,{open:m,onClose:function(){return p(!1)},preventCloseOnClickOutside:!0,size:"md"},l().createElement(a.xBx,{title:g}),l().createElement("form",{onSubmit:D((function(e){var t,n,r,o=x(),a=null!==(r=null==o||null===(n=o.tags)||void 0===n||null===(t=n.selectedItems)||void 0===t?void 0:t.map((function(e){return e.uuid})))&&void 0!==r?r:[],i={name:o.name,tags:a};wc.safeParse(e).success&&(b(!1),A(i))}),(function(e){C(Object.entries(e)[0][1].message),b(!0)}))},l().createElement(a.fef,{hasScrollingContent:!0},l().createElement(a.Kqy,{gap:3},l().createElement(a.cwH,{legendText:""},l().createElement(on.Qr,{name:"name",control:O,rules:{required:!0},render:function(e){var t,n=e.field,r=e.fieldState;return l().createElement(l().Fragment,null,l().createElement(a.oil,Cc({id:"location",labelText:v("location","Location Name"),placeholder:v("locationPlaceholder","Add a location"),invalidText:null===(t=r.error)||void 0===t?void 0:t.message},n)))}}),l().createElement("div",{className:bc.loaderContainer},l().createElement(on.Qr,{name:"tags",control:O,render:function(e){var t,n,r=e.field;return e.fieldState,l().createElement(a._nR,(t=Cc({id:"tag",titleText:"Select tag(s)",helperText:"This is helper text",items:null!=w?w:[]},r),n={itemToString:function(e){return e?e.display:""},selectionFeedback:"top-after-reopen"},n=null!=n?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}}))),h&&l().createElement(a.K0D,{lowContrast:!0,title:v("error","Error"),style:{minWidth:"100%",margin:"0rem",padding:"0rem"},role:"alert",kind:"error",subtitle:v("pleaseFillField",k)+".",onClose:function(){return b(!1)}}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{onClick:function(){return p(!1)},kind:"secondary"},v("cancel","Cancel")),l().createElement(a.zxk,{disabled:!N,type:"submit"},l().createElement("span",null,v("save","Save"))))))},Dc=function(e){var t=e.showModal,n=e.onModalChange,o=e.mutate,a=(0,E.useTranslation)().t,c=a("addLocation","Create new Location"),s=(0,i.useCallback)((function(e){var t=e.name,i=e.tags;(function(e){return vc.apply(this,arguments)})({locationPayload:{name:t,tags:i}}).then((function(){(0,r.showToast)({title:a("formCreated","Add Location"),kind:"success",critical:!0,description:a("Location ".concat(t," was created successfully."))}),o(),n(!1)})).catch((function(e){(0,r.showNotification)({title:a("errorCreatingForm","Error creating location"),kind:"error",critical:!0,description:null==e?void 0:e.message}),n(!1)})),n(!1)}),[n,o,a]);return l().createElement(l().Fragment,null,l().createElement(Sc,{onModalChange:n,showModal:t,handleCreateQuestion:s,headerTitle:c,initialData:{uuid:"",name:"",tags:[]}}))};function Oc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Nc=function(){var e,t,n=(0,E.useTranslation)().t,o=(e=(0,i.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Oc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oc(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=Bt(),n=t.stockLocations,o=t.error,a=t.isLoading,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,i.useState)(10),2),c=l[0],s=l[1],u=(0,r.usePagination)(n,c),d=u.goTo,m=u.results,p=u.currentPage,A=(0,E.useTranslation)().t,g=(0,i.useMemo)((function(){return[{id:0,header:A("name","Name"),key:"name"},{id:1,header:A("tags","Tags"),key:"tags"},{id:2,header:A("childLocations","Child Locations"),key:"childLocations"},{id:3,header:A("actions","Actions"),key:"actions"}]}),[A]),f=(0,i.useMemo)((function(){return n.map((function(e){var t,n,r,o,a,i;return{id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),name:"".concat(null==e?void 0:e.name),tags:null!==(a=null==e||null===(n=e.meta.tag)||void 0===n||null===(t=n.filter((function(e){return"SUBSETTED"!==e.code})).map((function(e){return e.code})))||void 0===t?void 0:t.join(", "))&&void 0!==a?a:"",childLocations:null!==(i=null==e||null===(o=e.childLocations)||void 0===o||null===(r=o.map((function(e){return e.display})))||void 0===r?void 0:r.join(", "))&&void 0!==i?i:""}}))}),[n]);return{items:n,currentPage:p,currentPageSize:c,paginatedQueueEntries:m,goTo:d,pageSizes:[10,20,30,40,50],isLoading:a,error:o,setPageSize:s,tableHeaders:g,tableRows:f}}(U.Full),d=u.tableHeaders,m=u.tableRows,p=u.items,A=u.isLoading,g=function(){ce("".concat(r.restBaseUrl,"/Location?_summary=data"))};return A?l().createElement(a.gqd,{role:"progressbar"}):(null==p?void 0:p.length)?l().createElement(hi,{columns:d,data:m},(function(e){var t=e.onInputChange;return l().createElement(l().Fragment,null,l().createElement(a.Ys1,{persistent:!0,onChange:t}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:g},"Refresh")),c?l().createElement(Dc,{onModalChange:s,showModal:c,mutate:j.JG}):null,l().createElement(a.zxk,{kind:"ghost",renderIcon:function(e){return l().createElement(me.mm,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){xc(e,t,n[t])}))}return e}({size:16},e))},onClick:function(){return s(!0)}},n("createLocation","Create Location")))})):l().createElement("div",{className:St.tileContainer},l().createElement(a.n9L,{className:St.tile},l().createElement("p",{className:St.content},"No stock items to display")))};var Ic=n(557),Tc={};Tc.styleTagTransform=h(),Tc.setAttributes=g(),Tc.insert=p().bind(null,"head"),Tc.domAPI=d(),Tc.insertStyleElement=v(),s()(Ic.Z,Tc);const Bc=Ic.Z&&Ic.Z.locals?Ic.Z.locals:void 0;function Pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Uc,jc=ln.z.object({startDate:ln.z.coerce.date().optional(),endDate:ln.z.coerce.date().optional(),location:ln.z.string({required_error:"Location Required"}).min(1,{message:"Location Required"}),reportName:ln.z.string({required_error:"Report Name Required"}).min(1,{message:"Report Name Required"}),stockReportItemCategory:ln.z.string().optional(),mostLeastMoving:ln.z.string().optional(),mostLeastMovingName:ln.z.string().optional(),stockItemUuid:ln.z.string().optional(),stockItemName:ln.z.string().optional(),patientUuid:ln.z.string().optional(),patientName:ln.z.string().optional(),locationUuid:ln.z.string().optional(),childLocations:ln.z.boolean().optional(),stockSourceUuid:ln.z.string().optional(),stockSource:ln.z.string().optional(),stockSourceDestinationUuid:ln.z.string().optional(),stockSourceDestination:ln.z.string().optional(),inventoryGroupBy:ln.z.string().optional(),stockItemCategory:ln.z.string().optional(),inventoryGroupByName:ln.z.string().optional(),stockItemCategoryConceptUuid:ln.z.string().optional(),reportSystemName:ln.z.string().optional(),maxReorderLevelRatio:ln.z.number().optional(),fullFillment:ln.z.string().array().optional(),limit:ln.z.string().optional(),date:ln.z.coerce.date().optional()}).superRefine((function(e,t){"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName&&(e.startDate||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"Start Date is required ",path:["startDate"]}),e.endDate||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"End Date is required",path:["endDate"]})),"Stock Status Report"!==e.reportName&&"Stock-Out Report"!==e.reportName||(e.date||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"Date is required ",path:["date"]}),e.inventoryGroupBy||t.addIssue({code:ln.z.ZodIssueCode.custom,message:"Inventory by is required ",path:["inventoryGroupBy"]}))}));function zc(e){var t="".concat(r.restBaseUrl,"/stockmanagement/batchjob"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}!function(e){e.Date="Date",e.StartDate="StartDate",e.EndDate="EndDate",e.StockItemCategory="StockItemCategory",e.Location="Location",e.ChildLocations="ChildLocations",e.StockSource="StockSource",e.StockSourceDestination="StockSourceDestination",e.InventoryGroupBy="InventoryGroupBy",e.MaxReorderLevelRatio="MaxReorderLevelRatio",e.Patient="Patient",e.StockItem="StockItem",e.Limit="Limit",e.MostLeastMoving="MostLeastMoving",e.Fullfillment="Fullfillment"}(Uc||(Uc={}));var Fc=function(e){return Lc(e)?4:e?20:null},Lc=function(e){return"STOCK_FORECAST_REPORT"===e||"STOCK_EXPIRY_FORECAST_REPORT"===e},Rc="Completed";function Mc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function qc(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function Gc(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)||Zc(e,t)||function(){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 Hc(e){return function(e){if(Array.isArray(e))return Mc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Zc(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 Zc(e,t){if(e){if("string"==typeof e)return Mc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mc(e,t):void 0}}const Yc=function(e){var t,n,o,c,s,u=e.model,d=(0,E.useTranslation)().t,m=(0,r.useConfig)().stockItemCategoryUUID,p=function(){var e,t,n="".concat(r.restBaseUrl,"/stockmanagement/report?v=default"),o=(0,j.ZP)(n,r.openmrsFetch),a=o.data,i=o.error,l=o.isLoading;return{reportTypes:null!==(t=null==a||null===(e=a.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[],isLoading:l,isError:i}}(),A=p.reportTypes,g=p.isLoading,f=Bt().stockLocations,v=Ft(m),_=v.items,h=(v.isLoading,Gc((0,i.useState)(!1),2)),b=h[0],y=h[1],k=Gc((0,i.useState)(!1),2),C=k[0],w=k[1],S=Gc((0,i.useState)(!1),2),D=S[0],O=S[1],x=Gc((0,i.useState)(!1),2),N=x[0],I=x[1],T=Gc((0,i.useState)(!1),2),B=T[0],P=T[1],U=Gc((0,i.useState)(!1),2),z=U[0],F=U[1],L=Gc((0,i.useState)(!1),2),R=L[0],M=L[1],q=Gc((0,i.useState)(!1),2),G=q[0],H=q[1],Z=Gc((0,i.useState)(!1),2),Y=Z[0],J=Z[1],W=Gc((0,i.useState)(!1),2),te=W[0],ne=W[1],re=Gc((0,i.useState)(!1),2),oe=re[0],ae=re[1],ie=Gc((0,i.useState)(!1),2),le=ie[0],ce=ie[1],se=Gc((0,i.useState)(!1),2),ue=se[0],de=se[1],me=Gc((0,i.useState)(!1),2),pe=me[0],Ae=me[1],ge=Gc((0,i.useState)(!1),2),fe=ge[0],ve=ge[1],_e=Gc((0,i.useState)(""),2),he=_e[0],be=_e[1];(0,i.useEffect)((function(){var e=!1;if(he){var t,n,r,o,a,i,l,c,s,u,d,m,p,g,f,v=null==A?void 0:A.find((function(e){return e.name===he}));v&&(y(null===(t=v.parameters)||void 0===t?void 0:t.some((function(e){return e===Uc.Date}))),w(null===(n=v.parameters)||void 0===n?void 0:n.some((function(e){return e===Uc.StartDate}))),O(null===(r=v.parameters)||void 0===r?void 0:r.some((function(e){return e===Uc.EndDate}))),I(null===(o=v.parameters)||void 0===o?void 0:o.some((function(e){return e===Uc.StockItemCategory}))),P(null===(a=v.parameters)||void 0===a?void 0:a.some((function(e){return e===Uc.Location}))),F(null===(i=v.parameters)||void 0===i?void 0:i.some((function(e){return e===Uc.ChildLocations}))),M(null===(l=v.parameters)||void 0===l?void 0:l.some((function(e){return e===Uc.StockSource}))),H(null===(c=v.parameters)||void 0===c?void 0:c.some((function(e){return e===Uc.StockSourceDestination}))),J(null===(s=v.parameters)||void 0===s?void 0:s.some((function(e){return e===Uc.InventoryGroupBy}))),ne(null===(u=v.parameters)||void 0===u?void 0:u.some((function(e){return e===Uc.MaxReorderLevelRatio}))),ce(null===(d=v.parameters)||void 0===d?void 0:d.some((function(e){return e===Uc.StockItem}))),ae(null===(m=v.parameters)||void 0===m?void 0:m.some((function(e){return e===Uc.Patient}))),de(null===(p=v.parameters)||void 0===p?void 0:p.some((function(e){return e===Uc.Limit}))),Ae(null===(g=v.parameters)||void 0===g?void 0:g.some((function(e){return e===Uc.MostLeastMoving}))),ve(null===(f=v.parameters)||void 0===f?void 0:f.some((function(e){return e===Uc.Fullfillment}))),e=!0)}e||(y(!1),w(!1),O(!1),I(!1),P(!1),F(!1),M(!1),H(!1),J(!1),ne(!1),ce(!1),ae(!1),de(!1),Ae(!1),ve(!1))}),[he,A]);var ye=(0,i.useMemo)((function(){var e,t;return[{display:"All Categories",name:"All Categories",uuid:""}].concat(Hc(null!==(t=_&&(null==_||null===(e=_.answers)||void 0===e?void 0:e.length)>0?null==_?void 0:_.answers:null==_?void 0:_.setMembers)&&void 0!==t?t:[]))}),[_]),ke=(0,on.cI)({mode:"all",resolver:(0,an.F)(jc)}),Ce=ke.handleSubmit,Ee=ke.control,we=ke.formState,Se=we.errors,De=(we.defaultValues,we.isDirty,ke.setValue);if(g)return l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Loading data..."});var Oe=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){qc(a,r,o,i,l,"next",e)}function l(e){qc(a,r,o,i,l,"throw",e)}i(void 0)}))}}((function(e){var t,n,o,a,i,l,c,s,u,m,p,g,f,v,_,h,y,k,E,w,S,O,x,I,T,P,U,j,F,L,M,q,H,Z,J,W,K,X;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function($){switch($.label){case 0:n=null===(t=A.find((function(t){return t.name===e.reportName})))||void 0===t?void 0:t.systemName,$.label=1;case 1:return $.trys.push([1,,3,4]),o="\r\n",a="param.report=".concat(n).concat(o),fe&&(a+=xe(Uc.Fullfillment,(null!==(i=e.fullFillment)&&void 0!==i?i:["All"]).join(","),(null!==(l=e.fullFillment)&&void 0!==l?l:["All"]).join(", "),d("stockmanagement.report.edit.fullfillment"),o)),oe&&(a+=xe(Uc.Patient,null!==(s=e.patientUuid)&&void 0!==s?s:"",null!==(u=null===(c=e.patientName)||void 0===c?void 0:c.trim())&&void 0!==u?u:"All Patients",d("Patients"),o)),le&&(a+=xe(Uc.StockItem,null!==(p=e.stockItemUuid)&&void 0!==p?p:"",null!==(g=null===(m=e.stockItemName)||void 0===m?void 0:m.trim())&&void 0!==g?g:"All Stock Items",d("Stock Item"),o)),N&&(a+=xe(Uc.StockItemCategory,null!==(v=e.stockItemCategoryConceptUuid)&&void 0!==v?v:"",null!==(_=null===(f=e.stockItemCategory)||void 0===f?void 0:f.trim())&&void 0!==_?_:"All Categories",d("Stock Item Category"),o)),Y&&(a+=xe(Uc.InventoryGroupBy,null!==(y=e.inventoryGroupBy)&&void 0!==y?y:"LocationStockItemBatchNo",null!==(k=null===(h=e.inventoryGroupByName)||void 0===h?void 0:h.trim())&&void 0!==k?k:"Stock Item Batch Number",d("stockmanagement.report.edit.inventorygroupby"),o)),B&&(a+=xe(Uc.Location,e.location,null!==(w=null===(E=e.location)||void 0===E?void 0:E.trim())&&void 0!==w?w:"",d("Location"),o),z&&(a+=xe(Uc.ChildLocations,e.childLocations?"true":"false",e.childLocations?"Yes":"No",d("Include Child Locations"),o))),te&&(a+=xe(Uc.MaxReorderLevelRatio,(null!==(S=e.maxReorderLevelRatio)&&void 0!==S?S:0).toString(),(null!==(O=e.maxReorderLevelRatio)&&void 0!==O?O:0).toString()+"%",d("stockmanagement.report.edit.maxreorderlevelratio"),o)),R&&(a+=xe(Uc.StockSource,null!==(I=e.stockSourceUuid)&&void 0!==I?I:"",null!==(T=null===(x=e.stockSource)||void 0===x?void 0:x.trim())&&void 0!==T?T:"All Sources",d("stockmanagement.report.edit.stocksource"),o)),G&&(a+=xe(Uc.StockSourceDestination,null!==(U=e.stockSourceDestinationUuid)&&void 0!==U?U:"",null!==(j=null===(P=e.stockSourceDestination)||void 0===P?void 0:P.trim())&&void 0!==j?j:"All Destinations",d("stockmanagement.report.edit.stocksourcedestination"),o)),pe&&(a+=xe(Uc.MostLeastMoving,null!==(L=e.mostLeastMoving)&&void 0!==L?L:"MostMoving",null!==(M=null===(F=e.mostLeastMovingName)||void 0===F?void 0:F.trim())&&void 0!==M?M:"Most Moving",d("stockmanagement.report.edit.mostleastmoving"),o)),ue&&(a+=xe(Uc.Limit,(null!==(H=null!==(q=e.limit)&&void 0!==q?q:Fc(e.reportSystemName))&&void 0!==H?H:20).toString(),(null!==(J=null!==(Z=e.limit)&&void 0!==Z?Z:Fc(e.reportSystemName))&&void 0!==J?J:20).toString(),d(function(e){return Lc(e)?"stockmanagement.report.edit.months":"stockmanagement.report.edit.limit"}(e.reportSystemName)),o)),b&&(a+=xe(Uc.Date,e.date?JSON.stringify(e.date).replaceAll('"',""):"",null!==(W=V(e.date))&&void 0!==W?W:"",d("stockmanagement.report.edit.date"),o)),C&&(a+=xe(Uc.StartDate,e.startDate?JSON.stringify(e.startDate).replaceAll('"',""):"",null!==(K=V(e.startDate))&&void 0!==K?K:"",d(function(e){return Lc(e)?"stockmanagement.report.edit.historicalstartdate":"Start Date"}(e.reportSystemName)),o)),D&&(a+=xe(Uc.EndDate,e.endDate?JSON.stringify(e.endDate).replaceAll('"',""):"",null!==(X=V(e.endDate))&&void 0!==X?X:"",d(function(e){return Lc(e)?"stockmanagement.report.edit.historicalenddate":"End Date"}(e.reportSystemName)),o)),[4,zc({batchJobType:"Report",description:e.reportName,parameters:a}).then((function(e){Q(),201===e.status?(0,r.showSnackbar)({title:d("batchJob","Batch Job"),subtitle:d("BatchJobSuccess","Batch job created successfully"),kind:"success"}):(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})})).catch((function(e){(0,r.showSnackbar)({title:d("BatchJobErrorTitle","Batch job"),subtitle:d("batchJobErrorMessage","Error creating batch job"),kind:"error"})}))];case 2:return $.sent(),[3,4];case 3:return[7];case 4:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),xe=function(e,t,n,r,o){return"param.".concat(e,".value=").concat(t).concat(o,"param.").concat(e,".value.desc=").concat(n).concat(o,"param.").concat(e,".description=").concat(r).concat(o)};return l().createElement(a.l09,{onSubmit:Ce(Oe,(function(e){console.error(e)}))},l().createElement("div",{className:Bc.reportContainer},l().createElement(l().Fragment,null,l().createElement("span",null,d("reportName","Report")),l().createElement(on.Qr,{control:Ee,name:"reportName",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"report",size:"md",labelText:d("reportName","Report"),items:A,itemToString:function(e){var t,n;return"".concat(null!==(n=null!==(t=null==e?void 0:e.name)&&void 0!==t?t:null==e?void 0:e.name)&&void 0!==n?n:"")},placeholder:"Filter...",onChange:function(e){var n,r=e.selectedItem;t(r.name),n=r.name,be(n)}})}})),N&&l().createElement(l().Fragment,null,l().createElement("span",null,d("stockItemCategory","Stock Item Category")),l().createElement(on.Qr,{control:Ee,name:"stockReportItemCategory",render:function(e){var t=e.field.onChange;return l().createElement(a.CtY,{id:"stockReportItem",size:"md",labelText:d("stockItemCategory","Stock Item Category"),items:ye,onChange:function(e){var n=e.selectedItem;t(n.uuid)},itemToString:function(e){return e&&(null==e?void 0:e.display)?"".concat(null==e?void 0:e.display):""},placeholder:"Filter..."})}})),C&&l().createElement(on.Qr,{control:Ee,name:"startDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"startDate",name:"startDate",placeholder:K,labelText:d("startDate","Start Date"),defaultValue:"",invalid:null==Se||null===(t=Se.startDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.startDate)||void 0===n?void 0:n.message}))}}),D&&l().createElement(on.Qr,{control:Ee,name:"endDate",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"endDate",name:"endDate",placeholder:K,labelText:d("endDate","End Date"),defaultValue:"",invalid:null==Se||null===(t=Se.endDate)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.endDate)||void 0===n?void 0:n.message}))}}),Y&&l().createElement(a.PhF,{id:"inventoryGroupBy",defaultValue:null==u?void 0:u.inventoryGroupBy,invalid:null==Se||null===(t=Se.inventoryGroupBy)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.inventoryGroupBy)||void 0===n?void 0:n.message,labelText:d("inventoryBy","Inventory by"),onChange:function(e){return De("inventoryGroupBy",e.target.value)}},l().createElement(a.QlF,{value:"",text:d("SelectOption","Select an option")}),l().createElement(a.QlF,{value:"StockItemOnly",text:d("stockItem","Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItem",text:d("lcationstockitem","Location and Stock Item")}),l().createElement(a.QlF,{value:"LocationStockItemBatchNo",text:d("locationBatchno","Location and Batch")})),B&&l().createElement(a.PhF,{name:"location",className:"select-field",labelText:d("location","Location"),id:"location",onChange:function(e){return De("location",e.target.value)},defaultValue:"",invalid:null==Se||null===(o=Se.location)||void 0===o?void 0:o.message,invalidText:null==Se||null===(c=Se.location)||void 0===c?void 0:c.message},l().createElement(a.QlF,{disabled:!0,hidden:!0,value:"",text:d("Choose a location")}),null===(s=null!=f?f:[])||void 0===s?void 0:s.map((function(e){return l().createElement(a.QlF,{key:e.id,value:e.id,text:e.name})}))),z&&l().createElement(on.Qr,{control:Ee,name:"childLocations",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.XZJ,{id:"childLocations",onChange:n,value:r,labelText:d("IncludeChildLocations","Include Child Locations")})}}),pe&&l().createElement(on.Qr,{control:Ee,name:"mostLeastMoving",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.SYO,{name:"mostLeastMoving",legendText:d("rank","Rank"),onChange:n,value:r},l().createElement(a.EUY,{value:"MostMoving",id:"mostLeastMovingMost",labelText:d("mostMoving","Most Moving")}),l().createElement(a.EUY,{value:"LeastMoving",id:"mostLeastMovingLeast",labelText:d("LeastMoving","Least Moving")}))}}),ue&&l().createElement(on.Qr,{control:Ee,name:"limit",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(a.Y2U,{id:"limitTop",allowEmpty:!0,value:r,onchange:n,label:d("limit","Limit"),defaultValue:20})}}),fe&&l().createElement("div",{style:{display:"flex",flexDirection:"row",gap:"0 1rem"}},l().createElement(on.Qr,{control:Ee,name:"fullFillment",render:function(e){var t=e.field,n=t.onChange,r=t.value;return l().createElement(l().Fragment,null,l().createElement(a.XZJ,{id:"allFulfillment",checked:null==r?void 0:r.includes("All"),onChange:function(e){var t=e.target.checked;n(t?["All"]:r.filter((function(e){return"All"!==e})))},labelText:d("all","All")}),l().createElement(a.XZJ,{id:"fullFulfillment",checked:null==r?void 0:r.includes("Full"),onChange:function(e){var t=e.target.checked;n(t?Hc(r.filter((function(e){return"All"!==e}))).concat(["Full"]):r.filter((function(e){return"Full"!==e})))},labelText:d("fullFulfillment","Full Fulfillment")}),l().createElement(a.XZJ,{id:"partialFulfillment",checked:null==r?void 0:r.includes("Partial"),onChange:function(e){var t=e.target.checked;n(t?Hc(r.filter((function(e){return"All"!==e}))).concat(["Partial"]):r.filter((function(e){return"Partial"!==e})))},labelText:d("partialFulfillment","Partial Fulfillment")}),l().createElement(a.XZJ,{id:"noneFulfillment",checked:null==r?void 0:r.includes("None"),onChange:function(e){var t=e.target.checked;n(t?Hc(r.filter((function(e){return"All"!==e}))).concat(["None"]):r.filter((function(e){return"None"!==e})))},labelText:d("noneFulfillment","Non Fulfillment")}))}})),b&&l().createElement(on.Qr,{control:Ee,name:"date",render:function(e){var t,n,r=e.field,o=r.onChange,i=r.value;return l().createElement(a.Mtg,{datePickerType:"single",maxDate:$(ee()),locale:"en",dateFormat:X,onChange:o,value:i},l().createElement(a.aj6,{id:"date",name:"date",placeholder:K,labelText:d("date","Date"),defaultValue:"",invalid:null==Se||null===(t=Se.date)||void 0===t?void 0:t.message,invalidText:null==Se||null===(n=Se.date)||void 0===n?void 0:n.message}))}})),l().createElement("div",{className:Bc.reportButton},l().createElement(a.zxk,{kind:"secondary",onClick:Q},d("cancel","Cancel")),l().createElement(a.zxk,{type:"submit"},d("continue","Continue"))))},Qc=function(){var e=(0,E.useTranslation)().t,t=(0,i.useCallback)((function(){Y("New Report",l().createElement(Yc,null))}),[]);return l().createElement(a.zxk,{onClick:t,size:"md",kind:"primary"},e("newReport","New Report"))};var Jc=n(5861),Wc={};Wc.styleTagTransform=h(),Wc.setAttributes=g(),Wc.insert=p().bind(null,"head"),Wc.domAPI=d(),Wc.insertStyleElement=v(),s()(Jc.Z,Wc);const Vc=Jc.Z&&Jc.Z.locals?Jc.Z.locals:void 0;var Kc=n(6811),Xc=n(3570),$c=n(7149),es={};es.styleTagTransform=h(),es.setAttributes=g(),es.insert=p().bind(null,"head"),es.domAPI=d(),es.insertStyleElement=v(),s()($c.Z,es);const ts=$c.Z&&$c.Z.locals?$c.Z.locals:void 0;var ns=function(e){var t=e.title,n=e.description,r=(0,E.useTranslation)().t;return l().createElement("div",{className:ts.tileContainer},l().createElement(a.n9L,{className:ts.tile},l().createElement("div",{className:ts.tileContent},l().createElement(vt.As,{size:"24"}),l().createElement("p",{className:ts.content},r("noPrivilagesTitle","".concat(t))),n&&l().createElement("p",{className:ts.helper},r("noViewPrivilegesDescription","".concat(n))))))};function rs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function os(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){rs(e,t,n[t])}))}return e}function as(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}var is=n(2033),ls={};ls.styleTagTransform=h(),ls.setAttributes=g(),ls.insert=p().bind(null,"head"),ls.domAPI=d(),ls.insertStyleElement=v(),s()(is.Z,ls);const cs=is.Z&&is.Z.locals?is.Z.locals:void 0;var ss="@openmrs/esm-stock-management-app",us={featureName:"stock-management",moduleName:ss},ds=n(3979),ms=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=e("manageStock","Manage Stock");return l().createElement(a.mh4,null,l().createElement(a.Ohc,{href:window.getOpenmrsSpaBase()+"stock-management",rel:"noopener noreferrer"},l().createElement("div",null,l().createElement("div",{className:"heading"},t),l().createElement("div",{className:"content"},e("stockManagement","Stock Management"))),l().createElement("div",{className:"iconWrapper"},l().createElement(me.ol,{size:16}))))}),us),ps=(0,r.getSyncLifecycle)((function(){return l().createElement(r.LeftNavMenu,null)}),us),As=(0,r.getSyncLifecycle)((function(){return"".concat(window.getOpenmrsSpaBase(),"stock-management"),l().createElement("div",{style:{backgroundColor:"white"}},l().createElement(ct,null),l().createElement(ht,null))}),us),gs=(0,r.getSyncLifecycle)(yt({title:"Overview",name:"stock-management"}),us),fs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Jo,null))}),us),vs=(0,r.getSyncLifecycle)(yt({title:"Operations",name:"operations"}),us),_s=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(ml,null))}),us),hs=(0,r.getSyncLifecycle)(yt({title:"Items",name:"items"}),us),bs=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Rl,null))}),us),ys=(0,r.getSyncLifecycle)(yt({title:"User role scopes",name:"user-scopes"}),us),ks=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Ac,null))}),us),Cs=(0,r.getSyncLifecycle)(yt({title:"Sources",name:"sources"}),us),Es=(0,r.getSyncLifecycle)((function(){return l().createElement("div",{style:{margin:"5px"}},l().createElement(Nc,null))}),us),ws=(0,r.getSyncLifecycle)(yt({title:"Locations",name:"locations"}),us),Ss=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t,t=function(){ce("".concat(r.restBaseUrl,"/stockmanagement/report?v=default"))},n=function(){var e,t,n,o,a,l,c,s="".concat(r.restBaseUrl,"/stockmanagement/batchjob?batchJobType=Report&v=default&limit=10&totalCount=true"),u=(0,j.ZP)(s,r.openmrsFetch),d=u.data,m=u.error,p=u.isLoading,A=(l=(0,i.useState)(10),c=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(l,c)||function(e,t){if(e){if("string"==typeof e)return Pc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pc(e,t):void 0}}(l,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=A[0],f=A[1],v=(0,r.usePagination)(null==d||null===(e=d.data)||void 0===e?void 0:e.results,g),_=v.goTo,h=v.results,b=v.currentPage;return{reports:null!==(a=null==d||null===(t=d.data)||void 0===t?void 0:t.results)&&void 0!==a?a:[],isLoading:p,isError:m,items:h,totalItems:null==d||null===(o=d.data)||void 0===o||null===(n=o.results)||void 0===n?void 0:n.length,currentPage:b,currentPageSize:g,paginatedItems:h,goTo:_,pageSizes:[10,20,30,40,50],setPageSize:f}}(),o=n.reports,c=n.isLoading,s=n.currentPage,u=n.pageSizes,d=n.totalItems,m=n.goTo,p=n.currentPageSize,A=n.setPageSize,g=(0,r.useSession)().user,f=g.privileges.filter((function(e){return"App: stockmanagement.reports"===e.display})).length>0,v=g.privileges.filter((function(e){return"Task: stockmanagement.reports.mutate"===e.display})).length>0,_=(0,i.useMemo)((function(){return[{id:0,header:e("report","Report"),key:"report"},{id:1,header:e("parameters","Parameters"),key:"parameters"},{id:2,header:e("dateRequested","Date Requested"),key:"dateRequested"},{id:3,header:e("requestedBy","Requested By"),key:"requestedBy"},{id:4,header:e("status","Status"),key:"status"},{id:8,header:e("actions","Actions"),key:"actions"}]}),[]),h=(0,i.useCallback)((function(e,t){e&&window.open(function(e,t){return"".concat(ae,"ws/rest/v1/stockmanagement/batchjobartifact?id=").concat(e).concat("&download=1")}(e),"_blank")}),[]),b=(0,i.useMemo)((function(){return null==o?void 0:o.map((function(e){var t,n,r;return as(os({},e),{checkbox:"isBatchJobActive",id:null==e?void 0:e.uuid,key:"key-".concat(null==e?void 0:e.uuid),uuid:"".concat(null==e?void 0:e.uuid),batchJobType:e.batchJobType,dateRequested:(r=e.dateCreated,r?W()(r).format("DD-MMM-YYYY HH:mm"):""),parameters:"",report:e.description,requestedBy:null==e||null===(t=e.owners)||void 0===t?void 0:t.map((function(t,n){return l().createElement("div",{key:"".concat(e.uuid,"-owner-").concat(n)},"".concat(t.ownerFamilyName," ").concat(t.ownerGivenName))})),status:l().createElement(l().Fragment,null,"Pending"===e.status&&l().createElement(a.lSo,{status:"active",iconDescription:"Loading",description:"Generating report..."}),"Failed"===e.status&&l().createElement(mt.Od,{className:"report-failed",title:e.status}),"Cancelled"===e.status&&l().createElement(Kc.mg,{className:"report-cancelled",title:e.status}),e.status===Rc&&l().createElement(Dr.Wz,{className:"report-completed",title:e.status,size:16}),"Expired"===e.status&&l().createElement(Xc.tK,{className:"report-expired",title:e.status})),actions:l().createElement("div",{key:"".concat(null==e?void 0:e.uuid,"-actions"),style:{display:"inline-block",whiteSpace:"nowrap"}},e.outputArtifactViewable&&"hide"===e.batchJobType&&l().createElement(a.zxk,{key:"".concat(null==e?void 0:e.uuid,"-actions-view"),type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Edit",kind:"ghost",renderIcon:pe.G7}),l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Copy",kind:"ghost",renderIcon:Me.CK}),(null==e?void 0:e.status)===Rc&&(null!==(n=e.outputArtifactSize)&&void 0!==n?n:0)>0&&l().createElement(a.zxk,{type:"button",size:"sm",className:"submitButton clear-padding-margin",iconDescription:"Download",kind:"ghost",renderIcon:vt.UW,onClick:function(){return h(e.uuid,e.outputArtifactFileExt)}}))})}))}),[o,h]);return c?l().createElement(a.gqd,{role:"progressbar"}):l().createElement("div",{className:Vc.tableOverride},l().createElement(a.x45,null,e("ReportDescription","List of reports requested by users")),l().createElement("div",{id:"table-tool-bar"},l().createElement("div",null),l().createElement("div",{className:"right-filters"})),l().createElement(a.wQF,{rows:b,headers:_,isSortable:!0,useZebraStyles:!0,render:function(n){var o=n.rows,i=n.headers,c=n.getHeaderProps,s=n.getTableProps,u=n.getRowProps,d=n.onInputChange;return l().createElement(a.xJi,null,l().createElement(a.fjU,{style:{position:"static",overflow:"visible",backgroundColor:"color"}},l().createElement(a.Vj0,{className:Vc.toolbarContent},l().createElement(a.Ys1,{persistent:!0,onChange:d}),l().createElement(a.Voz,null,l().createElement(a.VjL,{onClick:t},"Refresh")),v&&l().createElement(Qc,null))),l().createElement(a.iA_,s(),l().createElement(a.ssF,null,l().createElement(a.SCH,null,i.map((function(e){var t,n;return"details"!==e.key&&l().createElement(a.xDH,as(os({},c({header:e,isSortable:e.isSortable})),{className:r.isDesktop?Vc.desktopHeader:Vc.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,os({className:r.isDesktop?Vc.desktopRow:Vc.tabletRow},u({row:e})),e.cells.map((function(e){var t;return"details"!==(null==e||null===(t=e.info)||void 0===t?void 0:t.header)&&l().createElement(a.pj1,{key:e.id},e.value)}))))})))),f?0===o.length?l().createElement("div",{className:Vc.tileContainer},l().createElement(a.n9L,{className:Vc.tile},l().createElement("div",{className:Vc.tileContent},l().createElement("p",{className:Vc.content},e("noReportsToDisplay","No Stock reports to display")),l().createElement("p",{className:Vc.helper},e("checkFilters","Check the filters above"))))):null:l().createElement(ns,{title:"Can not view stock reports",description:"You have no permissions to view reports"}))}}),l().createElement(a.tlE,{page:s,pageSize:p,pageSizes:u,totalItems:d,onChange:function(e){var t=e.pageSize,n=e.page;t!==p&&A(t),n!==s&&m(n)},className:Vc.paginationOverride}))}),us),Ds=(0,r.getSyncLifecycle)(yt({title:"Reports",name:"reports"}),us),Os=(0,r.getSyncLifecycle)((function(){var e=(0,E.useTranslation)().t;return l().createElement("div",{className:cs.StockSettings},l().createElement("div",{className:cs.title},e("comingSoonUnderDev","Exciting updates are on the way! In the meantime, use the link below to access Admin UI settings.")),l().createElement(a.zxk,{onClick:function(){return(0,r.navigate)({to:"${openmrsBase}/admin/maintenance/settings.list?show=Stockmanagement"})},size:"md",renderIcon:function(){return l().createElement(pe.PG,{className:"cds--btn__icon",size:24})},kind:"ghost"},e("adminSettings","Admin settings")))}),us),xs=(0,r.getSyncLifecycle)(yt({title:"Settings",name:"settings"}),us),Ns=(0,r.getSyncLifecycle)((function(){return l().createElement(r.ExtensionSlot,{name:"stock-management-dashboard-slot"})}),us),Is=(0,r.getSyncLifecycle)((function(){var e="".concat(window.spaBase,"/stock-management");return(0,i.useEffect)((function(){return(0,r.setLeftNav)({name:"stock-page-dashboard-slot",basePath:e}),function(){return(0,r.unsetLeftNav)("stock-page-dashboard-slot")}}),[e]),l().createElement("main",{className:"omrs-main-content"},l().createElement(xe.BrowserRouter,{basename:window.spaBase},l().createElement(xe.Routes,null,l().createElement(xe.Route,{path:"/stock-management",element:l().createElement(Ye,null)}),l().createElement(xe.Route,{path:"/stock-management/:dashboard/*",element:l().createElement(Ye,null)}))))}),us),Ts=(0,r.getSyncLifecycle)((function(e){var t,n,o=e.title,c=e.requireReason,s=e.operation,u=e.closeModal,d=o.toLocaleLowerCase().trim(),m=(0,E.useTranslation)().t,p=de((0,i.useState)(""),2),A=p[0],g=p[1],f=de((0,i.useState)(!1),2),v=f[0],_=f[1],h=(t=function(e){var t;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(n){switch(e.preventDefault(),_(!0),t=null,d){case"submit":t="SUBMIT";break;case"dispatch":case"dispatchapproval":t="DISPATCH";break;case"complete":case"completedispatch":t="COMPLETE";break;case"cancel":t="CANCEL";break;case"reject":t="REJECT";break;case"return":t="RETURN";break;case"approve":t="APPROVE"}return t?(function(e){var t="".concat(r.restBaseUrl,"/stockmanagement/stockoperationaction"),n=new AbortController;return(0,r.openmrsFetch)(t,{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:e})}({name:t,uuid:null==s?void 0:s.uuid,reason:A}).then((function(){_(!1),(0,r.showSnackbar)({title:m("title","".concat(o," Operation")),subtitle:m("successMessage","You have successfully ".concat(o," operation ")),kind:"success"}),u(),Q(),ce("".concat(r.restBaseUrl,"/stockmanagement/stockoperation"))}),(function(e){_(!1);var t=le(e);(0,r.showSnackbar)({title:m("errorDescriptionTitle","Error on saving form"),subtitle:m("errorDescription",t.join(", ")),kind:"error"}),u(),Q()})),[2]):[2]}))},n=function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function i(e){ue(a,r,o,i,l,"next",e)}function l(e){ue(a,r,o,i,l,"throw",e)}i(void 0)}))},function(e){return n.apply(this,arguments)});return l().createElement("div",null,l().createElement(a.l09,{onSubmit:h},l().createElement(a.xBx,{closeModal:u,title:m("title","".concat(o," Operation"))}),l().createElement(a.fef,null,l().createElement("div",{className:P.modalBody},l().createElement("section",{className:P.section},l().createElement("h5",{className:P.section},"Would you really like to ",o," the operation ?")),l().createElement("br",null),c&&l().createElement("section",{className:P.section},l().createElement(a.Kx8,{labelText:m("notes","Please explain the reason:"),id:"nextNotes",name:"nextNotes",invalidText:"Required",maxCount:500,enableCounter:!0,onChange:function(e){return g(e.target.value)}})))),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:u},m("cancel","Cancel")),v?l().createElement(a.lSo,null):l().createElement(a.zxk,{type:"submit"},m("submit","Submit")))))}),us),Bs=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:I.productiveHeading03},o("deleteStock","Delete Stock source"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this source? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-modal",moduleName:ss}),Ps=(0,r.getSyncLifecycle)((function(e){var t=e.close,n=e.onConfirmation,r=e.uuid,o=(0,E.useTranslation)().t;return l().createElement(l().Fragment,null,l().createElement(a.xBx,{closeModal:t,className:I.productiveHeading03},o("deleteStockUserScope","Delete Stock User Scope"),"?"),l().createElement(a.fef,null,l().createElement("p",{className:I.bodyLong01},o("deleteConfirmationText","Are you sure you want to delete this User Scope? This action can't be undone.",{encounter:r}))),l().createElement(a.mzw,null,l().createElement(a.zxk,{size:"lg",kind:"secondary",onClick:function(){return t()}},o("cancel","Cancel")),l().createElement(a.zxk,{autoFocus:!0,kind:"danger",onClick:function(){return null==n?void 0:n()},size:"lg"},o("delete","Delete"))))}),{featureName:"delete-stock-user-scope-modal",moduleName:ss}),Us=(0,r.getSyncLifecycle)((function(e){var t=e.row,n=e.closeModal,o=(0,E.useTranslation)().t,c=Ee(),s=c.mutate,u=c.setStockItemUuid;(0,i.useEffect)((function(){u(t.stockItemUuid)}),[t.stockItemUuid,u]);var d,m,p=(d=(0,i.useState)(""),m=2,function(e){if(Array.isArray(e))return e}(d)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}}(d,m)||function(e,t){if(e){if("string"==typeof e)return Oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oe(e,t):void 0}}(d,m)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),A=p[0],g=p[1];return l().createElement("div",null,l().createElement(a.xBx,{closeModal:n,className:De.productiveHeading03},o("removePackagingUnit","Remove Packaging Unit"),"?"),l().createElement(a.fef,null,l().createElement("span",null,o("removePackagingUnitConfirmation","Would you really like to remove the packaging unit ".concat(null==t?void 0:t.packagingUomName," from the stock item?"))),l().createElement(a.Kx8,{id:"reason",labelText:o("reasonLabel","Please explain the reason:"),onChange:function(e){g(e.target.value)},maxLength:500,placeholder:o("reasonPlaceholder","Enter reason here")})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:n},o("no","No")),l().createElement(a.zxk,{kind:"danger",type:"submit",onClick:function(e){var a,i,l;e.preventDefault(),(a=t.uuid,i="".concat(r.restBaseUrl,"/stockmanagement/stockitempackaginguom/").concat(a),l=new AbortController,(0,r.openmrsFetch)(i,{method:"DELETE",headers:{"Content-Type":"application/json"},signal:l.signal})).then((function(){s(),n(),(0,r.showToast)({critical:!0,title:o("deletePackagingUnitTitle","Delete packing item "),kind:"success",description:o("deletePackagingUnitMesaage","Stock Item packing unit deleted Successfully")})}),(function(e){(0,r.showNotification)({title:o("deletePackingUnitErrorTitle","Error Deleting a stock item packing unit"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))},disabled:A.length<1},o("yes","Yes"))))}),{featureName:"delete-packaging-unit-modal",moduleName:ss}),js=(0,r.getSyncLifecycle)(Ae,{featureName:"delete-packging-unit-button",moduleName:ss}),zs=(0,r.getSyncLifecycle)((function(e){var t=e.closeModal,n=(0,E.useTranslation)().t,o=O((0,i.useState)(),2),c=o[0],s=o[1],u=O((0,i.useState)(!0),2),d=u[0],m=(u[1],O((0,i.useState)(!0),2)),p=(m[0],m[1]);return l().createElement("div",null,l().createElement(a.l09,null,l().createElement(a.xBx,{closeModal:t,title:n("importStockItems","Import Stock Items")}),l().createElement(a.fef,null,l().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"small",onChange:function(e){var t,n,r=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];r?(s(r),p(!1)):e.preventDefault()},onDelete:function(){p(!0)}})),l().createElement(a.mzw,null,l().createElement(a.zxk,{kind:"secondary",onClick:t},n("cancel","Cancel")),l().createElement(a.zxk,{type:"button",onClick:function(){if(c){var e=new FormData;c&&(e.append("file",c,"Import_Stock_Items.csv"),e.append("hasHeader",d?"true":"false")),function(e){return S.apply(this,arguments)}(e).then((function(e){(0,r.showToast)({critical:!0,title:n("rejectOrder","Uploaded Order"),kind:"success",description:n("Successfully uploaded","You have successfully uploaded stock items")}),t()}),(function(e){(0,r.showNotification)({title:n("errorUploadingItems', 'An error occurred uploading stock items"),kind:"error",critical:!0,description:null==e?void 0:e.message})}))}}},n("uploadStockItems","Upload StockItems")))))}),us),Fs=(0,r.getSyncLifecycle)((function(){var e=window.getOpenmrsSpaBase();return l().createElement(a.Ohc,{className:k.customTile,id:"menu-item",href:"".concat(e,"stock-management")},l().createElement("div",{className:"customTileTitle"},l().createElement(C.yG,{size:24})),l().createElement("div",null,"Stock Management"))}),us);function Ls(){(0,r.defineConfigSchema)(ss,o)}},3979:(e,t,n)=>{var r={"./en.json":[3574,574]};function o(e){if(!n.o(r,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],o=t[0];return n.e(t[1]).then((()=>n(o)))}o.keys=()=>Object.keys(r),o.id=3979,e.exports=o}}]);