@openmrs/esm-billing-app 1.0.2-pre.732 → 1.0.2-pre.737
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/4739.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_billing_app=globalThis.webpackChunk_openmrs_esm_billing_app||[]).push([[4739],{12149:(n,e,r)=>{r.d(e,{A:()=>o});var t=r(72996),i=r.n(t),a=r(70159),l=r.n(a)()(i());l.push([n.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-billing__billing-form__tablet___depIv{padding:1.5rem 1rem;background-color:#fff}.-esm-billing__billing-form__desktop___XrIGU{padding:0rem}.-esm-billing__billing-form__button___\\+KaHL{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-billing__billing-form__button___\\+KaHL .cds--inline-loading{min-height:1rem !important}.-esm-billing__billing-form__button___\\+KaHL .cds--inline-loading__text{font-size:unset !important}.-esm-billing__billing-form__mt2___XSCej{margin-top:2rem}.-esm-billing__billing-form__searchContent___rwtx-{position:absolute;background-color:#fff;min-width:230px;overflow:auto;border:1px solid #ddd;z-index:1;width:92%}.-esm-billing__billing-form__searchItem___gJRX7{border-bottom:.1rem solid;border-bottom-color:silver;cursor:pointer}.-esm-billing__billing-form__invalidInput___-CFhJ{border:2px solid red}.-esm-billing__billing-form__removeButton___JOb\\+t{color:#ee0909;right:20px;cursor:pointer}.-esm-billing__billing-form__form___dOD1L{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}.omrs-breakpoint-lt-desktop .-esm-billing__billing-form__form___dOD1L{background-color:#ededed}.omrs-breakpoint-gt-tablet .-esm-billing__billing-form__form___dOD1L{background-color:#fff}.-esm-billing__billing-form__grid___bVIsN{margin:1rem;display:flex;flex-direction:column;gap:1rem}.-esm-billing__billing-form__row___kfkPE{margin:.5rem 0rem 0rem;display:flex;flex-flow:row wrap;gap:1rem}.-esm-billing__billing-form__spacer___5WyoB{margin-top:1rem}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/billing-form/billing-form.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAsDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,oGAAA,CACA,2GAAA,CC1DF,4CACE,mBAAA,CACA,qBDFM,CCKR,6CACE,YAAA,CAGF,6CACE,WC2CW,CD1CX,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAEA,kEACE,0BAAA,CAGF,wEACE,0BAAA,CAIJ,yCACE,eCYW,CDTb,mDACE,iBAAA,CACA,qBAAA,CACA,eAAA,CACA,aAAA,CACA,qBAAA,CACA,SAAA,CACA,SAAA,CAGF,gDACE,yBAAA,CACA,0BAAA,CACA,cAAA,CAGF,kDACE,oBAAA,CAGF,mDACE,aAAA,CACA,UAAA,CACA,cAAA,CAGF,0CACE,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,yBAAA,CAGF,sEACE,wBAAA,CAGF,qEACE,qBDnEM,CCsER,0CACE,WC3CW,CD4CX,YAAA,CACA,qBAAA,CACA,QC9CW,CDiDb,yCACE,sBAAA,CACA,YAAA,CACA,kBAAA,CACA,QCrDW,CDwDb,4CACE,eCzDW",sourcesContent:["@use '@carbon/layout';\n\n$ui-01: #f4f4f4;\n$ui-02: #ffffff;\n$ui-03: #e0e0e0;\n$ui-04: #8d8d8d;\n$ui-05: #161616;\n$text-02: #525252;\n$text-03: #a8a8a8;\n$ui-background: #ffffff;\n$color-gray-30: #c6c6c6;\n$color-gray-70: #525252;\n$color-gray-100: #161616;\n$color-blue-60-2: #0f62fe;\n$color-blue-10: #edf5ff;\n$color-yellow-50: #feecae;\n$carbon--red-50: #fa4d56;\n$inverse-link: #78a9ff;\n$support-02: #24a148;\n$inverse-support-03: #f1c21b;\n$warning-background: #fff8e1;\n$openmrs-background-grey: #f4f4f4;\n$danger: #da1e28;\n$interactive-01: #0f62fe;\n$field-01: #f4f4f4;\n$grey-2: #e0e0e0;\n$labeldropdown: #c6c6c6;\n\n$brand-primary-10: #d9fbfb;\n$brand-primary-20: #9ef0f0;\n$brand-primary-30: #3ddbd9;\n$brand-primary-40: #08bdba;\n$brand-primary-50: #009d9a;\n\n/* 60,70 and 80 are already declared as brand-01, 02 and 03 respectively */\n\n$brand-primary-90: #022b30;\n$brand-primary-100: #081a1c;\n\n@mixin brand-01($property) {\n #{$property}: #005d5d;\n #{$property}: var(--brand-01);\n}\n\n@mixin brand-02($property) {\n #{$property}: #004144;\n #{$property}: var(--brand-02);\n}\n\n@mixin brand-03($property) {\n #{$property}: #007d79;\n #{$property}: var(--brand-03);\n}\n\n:root {\n --brand-01: #005d5d;\n --brand-02: #004144;\n --brand-03: #007d79;\n --bottom-nav-height: #{layout.$spacing-10};\n --workspace-header-height: #{layout.$spacing-09};\n --tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));\n --desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height));\n}\n\n$breakpoint-phone-min: 0px;\n$breakpoint-phone-max: 600px;\n$breakpoint-tablet-min: 601px;\n$breakpoint-tablet-max: 1023px;\n$breakpoint-small-desktop-min: 1024px;\n$breakpoint-small-desktop-max: 1439px;\n$breakpoint-large-desktop-min: 1440px;\n$breakpoint-large-desktop-max: 99999999px;\n\n/* These color variables will be removed in a future release */\n$brand-teal-01: #007d79;\n$brand-01: #005d5d;\n$brand-02: #004144;\n","@use '@carbon/layout';\n@use '@openmrs/esm-styleguide/src/vars' as *;\n\n.tablet {\n padding: layout.$spacing-06 layout.$spacing-05;\n background-color: $ui-02;\n}\n\n.desktop {\n padding: 0rem;\n}\n\n.button {\n height: layout.$spacing-10;\n display: flex;\n align-content: flex-start;\n align-items: baseline;\n min-width: 50%;\n\n :global(.cds--inline-loading) {\n min-height: layout.$spacing-05 !important;\n }\n\n :global(.cds--inline-loading__text) {\n font-size: unset !important;\n }\n}\n\n.mt2 {\n margin-top: layout.$spacing-07;\n}\n\n.searchContent {\n position: absolute;\n background-color: #fff;\n min-width: 230px;\n overflow: auto;\n border: 1px solid #ddd;\n z-index: 1;\n width: 92%;\n}\n\n.searchItem {\n border-bottom: 0.1rem solid;\n border-bottom-color: silver;\n cursor: pointer;\n}\n\n.invalidInput {\n border: 2px solid red;\n}\n\n.removeButton {\n color: #ee0909;\n right: 20px;\n cursor: pointer;\n}\n\n.form {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n height: calc(100vh - 6rem);\n}\n\n:global(.omrs-breakpoint-lt-desktop) .form {\n background-color: #ededed;\n}\n\n:global(.omrs-breakpoint-gt-tablet) .form {\n background-color: $ui-02;\n}\n\n.grid {\n margin: layout.$spacing-05;\n display: flex;\n flex-direction: column;\n gap: layout.$spacing-05;\n}\n\n.row {\n margin: layout.$spacing-03 0rem 0rem;\n display: flex;\n flex-flow: row wrap;\n gap: layout.$spacing-05;\n}\n\n.spacer {\n margin-top: layout.$spacing-05;\n}\n","// Code generated by @carbon/layout. DO NOT EDIT.\n//\n// Copyright IBM Corp. 2018, 2023\n//\n// This source code is licensed under the Apache-2.0 license found in the\n// LICENSE file in the root directory of this source tree.\n//\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-01: 0.125rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-02: 0.25rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-03: 0.5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-04: 0.75rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-05: 1rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-06: 1.5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-07: 2rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-08: 2.5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-09: 3rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-10: 4rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-11: 5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-12: 6rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-13: 10rem !default;\n\n/// @type Map\n/// @access public\n/// @group @carbon/layout\n$spacing: (\n spacing-01: $spacing-01,\n spacing-02: $spacing-02,\n spacing-03: $spacing-03,\n spacing-04: $spacing-04,\n spacing-05: $spacing-05,\n spacing-06: $spacing-06,\n spacing-07: $spacing-07,\n spacing-08: $spacing-08,\n spacing-09: $spacing-09,\n spacing-10: $spacing-10,\n spacing-11: $spacing-11,\n spacing-12: $spacing-12,\n spacing-13: $spacing-13,\n);\n"],sourceRoot:""}]),l.locals={tablet:"-esm-billing__billing-form__tablet___depIv",desktop:"-esm-billing__billing-form__desktop___XrIGU",button:"-esm-billing__billing-form__button___+KaHL",mt2:"-esm-billing__billing-form__mt2___XSCej",searchContent:"-esm-billing__billing-form__searchContent___rwtx-",searchItem:"-esm-billing__billing-form__searchItem___gJRX7",invalidInput:"-esm-billing__billing-form__invalidInput___-CFhJ",removeButton:"-esm-billing__billing-form__removeButton___JOb+t",form:"-esm-billing__billing-form__form___dOD1L",grid:"-esm-billing__billing-form__grid___bVIsN",row:"-esm-billing__billing-form__row___kfkPE",spacer:"-esm-billing__billing-form__spacer___5WyoB"};const o=l},64739:(n,e,r)=>{r.r(e),r.d(e,{default:()=>P});var t=r(16072),i=r.n(t),a=r(53941),l=r(27804),o=r(7790),s=r(55576),c=r(15847),u=r(54392),p=r(14720),m=r(50930),d=r(85072),b=r.n(d),g=r(97825),A=r.n(g),_=r(77659),f=r.n(_),y=r(55056),C=r.n(y),h=r(10540),v=r.n(h),$=r(41113),k=r.n($),E=r(12149),w={};w.styleTagTransform=k(),w.setAttributes=C(),w.insert=f().bind(null,"head"),w.domAPI=A(),w.insertStyleElement=v(),b()(E.A,w);const x=E.A&&E.A.locals?E.A.locals:void 0;function B(n,e){(null==e||e>n.length)&&(e=n.length);for(var r=0,t=new Array(e);r<e;r++)t[r]=n[r];return t}function I(n,e,r){return e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function N(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},t=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(r).filter((function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})))),t.forEach((function(e){I(n,e,r[e])}))}return n}function S(n,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):function(n){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e.push.apply(e,r)}return e}(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))})),n}function O(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var r=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=r){var t,i,a=[],l=!0,o=!1;try{for(r=r.call(n);!(l=(t=r.next()).done)&&(a.push(t.value),!e||a.length!==e);l=!0);}catch(n){o=!0,i=n}finally{try{l||null==r.return||r.return()}finally{if(o)throw i}}return a}}(n,e)||j(n,e)||function(){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 D(n){return function(n){if(Array.isArray(n))return B(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||j(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.")}()}function j(n,e){if(n){if("string"==typeof n)return B(n,e);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(n,e):void 0}}const P=function(n){var e=n.patientUuid,r=n.closeWorkspace,d="tablet"===(0,c.useLayoutType)(),b=(0,a.useTranslation)().t,g=(0,c.useConfig)(),A=g.defaultCurrency,_=g.postBilledItems,f=O((0,t.useState)(!1),2),y=f[0],C=f[1],h=O((0,t.useState)([]),2),v=h[0],$=h[1],k=(0,u.ly)(),E=k.data,w=k.error,B=k.isLoading;return i().createElement(o.lVW,{className:x.form},i().createElement("div",{className:x.grid},B?i().createElement(o.OuH,{description:(0,c.getCoreTranslation)("loading")+"..."}):w?i().createElement(o.jeF,{kind:"error",lowContrast:!0,title:b("billErrorService","Bill service error"),subtitle:b("errorLoadingBillServices","Error loading bill services")}):i().createElement(o.a32,{id:"searchItems",onChange:function(n){return function(n){var e,r,t;if(n){var i=v.find((function(e){return e.uuid===n.uuid}));if(i){var a=S(N({},i),{quantity:i.quantity+1});$(D(v).map((function(e){return e.uuid===n.uuid?a:e})))}else{var l={uuid:n.uuid,display:n.name,quantity:1,price:(null===(e=n.servicePrices)||void 0===e?void 0:e.length)>0?parseFloat(null===(t=n.servicePrices)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.price):0,billableService:n.uuid,paymentStatus:"PENDING",lineItemOrder:0};$(D(v).concat([l]))}}}(n.selectedItem)},itemToString:function(n){return(null==n?void 0:n.name)||""},items:null!=E?E:[],titleText:b("searchItems","Search items and services")}),v&&v.length>0&&i().createElement(o.XIK,{"aria-label":"sample table",className:x.mt2},i().createElement(o.ndF,null,i().createElement(o.Hjg,null,i().createElement(o.A0N,null,b("item","Item")),i().createElement(o.A0N,null,b("quantity","Quantity")),i().createElement(o.A0N,null,b("price","Price")),i().createElement(o.A0N,null,b("total","Total")),i().createElement(o.A0N,null,b("action","Action")))),i().createElement(o.BFY,null,v.map((function(n){return i().createElement(o.Hjg,null,i().createElement(o.nA6,null,n.display),i().createElement(o.nA6,null,i().createElement(o.Q7x,{id:n.uuid,min:1,value:n.quantity,onChange:function(e,r){var t,i,a,l=r.value,o=parseFloat(String(l));t=n.uuid,i=isNaN(o)?1:o,a=D(v).map((function(n){return n.uuid===t?S(N({},n),{quantity:i}):n})),$(a)}})),i().createElement(o.nA6,{id:n.uuid+"Price"},n.price),i().createElement(o.nA6,{id:n.uuid+"Total",className:"totalValue"},n.price*n.quantity),i().createElement(o.nA6,null,i().createElement(s.zH,{className:x.removeButton,onClick:function(){return e=n.uuid,r=D(v).filter((function(n){return n.uuid!==e})),void $(r);var e,r}})))})),i().createElement(o.Hjg,null,i().createElement(o.nA6,{colSpan:3}),i().createElement(o.nA6,{style:{fontWeight:"bold"}},b("grandTotal","Grand total"),":"),i().createElement(o.nA6,{id:"GrandTotalSum"},(0,p.aL)((0,p.Zz)(v),A)))))),i().createElement(o.Te$,{className:d?x.tablet:x.desktop},i().createElement(o.$nd,{className:x.button,kind:"secondary",disabled:y,onClick:r},b("discard","Discard")),i().createElement(o.$nd,{className:x.button,kind:"primary",onClick:function(){C(!0);var n={cashPoint:_.cashPoint,cashier:_.cashier,lineItems:[],payments:[],patient:e,status:"PENDING"};v.forEach((function(e){var r={quantity:e.quantity,price:e.price,lineItemOrder:0,paymentStatus:"PENDING",billableService:e.uuid};n.lineItems.push(r)}));var t="".concat(m.B,"bill");(0,u.Xn)(n).then((function(){C(!1),r(),(0,l.j)((function(n){return"string"==typeof n&&n.startsWith(t)}),void 0,{revalidate:!0}),(0,c.showSnackbar)({title:b("saveBill","Save Bill"),subtitle:b("billProcessingSuccess","Bill processing has been successful"),kind:"success",timeoutInMs:3e3})}),(function(n){C(!1),(0,c.showSnackbar)({title:b("billProcessingError","Bill processing error"),kind:"error",subtitle:null==n?void 0:n.message})}))},disabled:y||0===v.length,type:"submit"},y?i().createElement(o.OuH,{description:b("saving","Saving")+"..."}):b("saveAndClose","Save and close"))))}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_billing_app=globalThis.webpackChunk_openmrs_esm_billing_app||[]).push([[4739],{12149:(n,e,i)=>{i.d(e,{A:()=>a});var l=i(72996),t=i.n(l),r=i(70159),o=i.n(r)()(t());o.push([n.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79;--bottom-nav-height: 4rem;--workspace-header-height: 3rem;--tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));--desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height))}.-esm-billing__billing-form__tablet___depIv{padding:1.5rem 1rem;background-color:#fff}.-esm-billing__billing-form__desktop___XrIGU{padding:0rem}.-esm-billing__billing-form__button___\\+KaHL{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-billing__billing-form__button___\\+KaHL .cds--inline-loading{min-height:1rem !important}.-esm-billing__billing-form__button___\\+KaHL .cds--inline-loading__text{font-size:unset !important}.-esm-billing__billing-form__mt2___XSCej{margin-top:2rem}.-esm-billing__billing-form__searchContent___rwtx-{position:absolute;background-color:#fff;min-width:230px;overflow:auto;border:1px solid #ddd;z-index:1;width:92%}.-esm-billing__billing-form__searchItem___gJRX7{border-bottom:.1rem solid;border-bottom-color:silver;cursor:pointer}.-esm-billing__billing-form__invalidInput___-CFhJ{border:2px solid red}.-esm-billing__billing-form__removeButton___JOb\\+t{color:#ee0909;right:20px;cursor:pointer}.-esm-billing__billing-form__form___dOD1L{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}.omrs-breakpoint-lt-desktop .-esm-billing__billing-form__form___dOD1L{background-color:#ededed}.omrs-breakpoint-gt-tablet .-esm-billing__billing-form__form___dOD1L{background-color:#fff}.-esm-billing__billing-form__grid___bVIsN{margin:1rem;display:flex;flex-direction:column;gap:1rem}.-esm-billing__billing-form__row___kfkPE{margin:.5rem 0rem 0rem;display:flex;flex-flow:row wrap;gap:1rem}.-esm-billing__billing-form__spacer___5WyoB{margin-top:1rem}.-esm-billing__billing-form__selectedItemsContainer___EgCXw{margin-top:1rem}.-esm-billing__billing-form__selectedItemsContainer___EgCXw h4{margin-bottom:1rem;color:#525252;font-size:1rem;font-weight:600}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa{border:1px solid #e0e0e0;border-radius:.25rem;padding:1rem;margin-bottom:1rem;background-color:#f4f4f4}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemHeader___IPVIh{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemHeader___IPVIh .-esm-billing__billing-form__itemName___0pvcY{font-weight:600;font-size:1rem;color:#525252}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO{display:flex;flex-wrap:wrap;gap:1rem;margin-top:.5rem;align-items:flex-end}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb{display:flex;flex-direction:column;min-width:0}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:first-child{flex:1 1 auto;min-width:250px}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:nth-child(2){flex:0 0 140px;width:140px}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:last-child{flex:0 0 180px;width:180px;margin-left:auto;text-align:right}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb label{font-size:.875rem;font-weight:500;margin-bottom:.5rem;color:#525252;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .cds--list-box,.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .cds--number,.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .cds--combo-box,.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .cds--list-box__wrapper,.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .cds--list-box__field{width:100% !important;max-width:100% !important;min-width:0 !important}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .-esm-billing__billing-form__priceDisplay___MN5Zc,.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb .-esm-billing__billing-form__totalDisplay___mNY6D{font-size:.875rem;font-size:.875rem;font-weight:600;color:#525252;padding:.5rem 0;word-break:break-word}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__grandTotal___a5c-8{text-align:right;padding:1rem;border-top:2px solid #0f62fe;margin-top:1rem;background-color:#f4f4f4;font-size:1.125rem;font-weight:600;color:#525252}@media(max-width: 1056px){.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:nth-child(2){flex:1 1 100%;width:100%}}@media(max-width: 768px){.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa{padding:.75rem}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO{flex-direction:column;gap:.5rem}.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:first-child,.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:nth-child(2),.-esm-billing__billing-form__selectedItemsContainer___EgCXw .-esm-billing__billing-form__itemCard___-qABa .-esm-billing__billing-form__itemControls___T4bKO .-esm-billing__billing-form__controlSection___OAlFb:last-child{flex:1 1 100%;width:100%;max-width:100%}}","",{version:3,sources:["webpack://./node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/billing-form/billing-form.scss","webpack://./node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAsDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CACA,yBAAA,CACA,+BAAA,CACA,oGAAA,CACA,2GAAA,CC1DF,4CACE,mBAAA,CACA,qBDFM,CCKR,6CACE,YAAA,CAGF,6CACE,WC2CW,CD1CX,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAEA,kEACE,0BAAA,CAGF,wEACE,0BAAA,CAIJ,yCACE,eCYW,CDTb,mDACE,iBAAA,CACA,qBAAA,CACA,eAAA,CACA,aAAA,CACA,qBAAA,CACA,SAAA,CACA,SAAA,CAGF,gDACE,yBAAA,CACA,0BAAA,CACA,cAAA,CAGF,kDACE,oBAAA,CAGF,mDACE,aAAA,CACA,UAAA,CACA,cAAA,CAGF,0CACE,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,yBAAA,CAGF,sEACE,wBAAA,CAGF,qEACE,qBDnEM,CCsER,0CACE,WC3CW,CD4CX,YAAA,CACA,qBAAA,CACA,QC9CW,CDiDb,yCACE,sBAAA,CACA,YAAA,CACA,kBAAA,CACA,QCrDW,CDwDb,4CACE,eCzDW,CD4Db,4DACE,eC7DW,CD+DX,+DACE,kBChES,CDiET,aDzFM,CC0FN,cAAA,CACA,eAAA,CAGF,0GACE,wBAAA,CACA,oBCvFS,CDwFT,YCzES,CD0ET,kBC1ES,CD2ET,wBDxGI,CC0GJ,0JACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,kBCjFO,CDmFP,wMACE,eAAA,CACA,cAAA,CACA,aD9GE,CCkHJ,4JACA,YAAA,CACA,cAAA,CACA,QC7FO,CD8FP,gBCxGO,CDyGP,oBAAA,CAAA,gNACE,YAAA,CACA,qBAAA,CACA,WAAA,CAEA,4NACE,aAAA,CACA,eAAA,CAGF,6NACE,cAAA,CACA,WAAA,CAGF,2NACE,cAAA,CACA,WAAA,CACA,gBAAA,CACA,gBAAA,CAGF,sNACE,iBAAA,CACA,eAAA,CACA,mBClIG,CDmIH,aDjJA,CCkJA,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,0mCAKE,qBAAA,CACA,yBAAA,CACA,sBAAA,CAGF,ogBAEE,iBAAA,CACA,iBAAA,CACA,eAAA,CACA,aDtKA,CCuKA,eAAA,CACA,qBAAA,CAMR,4GACE,gBAAA,CACA,YCxJS,CDyJT,4BAAA,CACA,eC1JS,CD2JT,wBDxLI,CCyLJ,kBAAA,CACA,eAAA,CACA,aDtLM,CC0LV,0BAKU,6NACE,aAAA,CACA,UAAA,CAAA,CAQZ,yBAEI,0GACE,cCzLO,CD2LP,4JACE,qBAAA,CACA,SClMK,CDqMH,opBAGE,aAAA,CACA,UAAA,CACA,cAAA,CAAA",sourcesContent:["@use '@carbon/layout';\n\n$ui-01: #f4f4f4;\n$ui-02: #ffffff;\n$ui-03: #e0e0e0;\n$ui-04: #8d8d8d;\n$ui-05: #161616;\n$text-02: #525252;\n$text-03: #a8a8a8;\n$ui-background: #ffffff;\n$color-gray-30: #c6c6c6;\n$color-gray-70: #525252;\n$color-gray-100: #161616;\n$color-blue-60-2: #0f62fe;\n$color-blue-10: #edf5ff;\n$color-yellow-50: #feecae;\n$carbon--red-50: #fa4d56;\n$inverse-link: #78a9ff;\n$support-02: #24a148;\n$inverse-support-03: #f1c21b;\n$warning-background: #fff8e1;\n$openmrs-background-grey: #f4f4f4;\n$danger: #da1e28;\n$interactive-01: #0f62fe;\n$field-01: #f4f4f4;\n$grey-2: #e0e0e0;\n$labeldropdown: #c6c6c6;\n\n$brand-primary-10: #d9fbfb;\n$brand-primary-20: #9ef0f0;\n$brand-primary-30: #3ddbd9;\n$brand-primary-40: #08bdba;\n$brand-primary-50: #009d9a;\n\n/* 60,70 and 80 are already declared as brand-01, 02 and 03 respectively */\n\n$brand-primary-90: #022b30;\n$brand-primary-100: #081a1c;\n\n@mixin brand-01($property) {\n #{$property}: #005d5d;\n #{$property}: var(--brand-01);\n}\n\n@mixin brand-02($property) {\n #{$property}: #004144;\n #{$property}: var(--brand-02);\n}\n\n@mixin brand-03($property) {\n #{$property}: #007d79;\n #{$property}: var(--brand-03);\n}\n\n:root {\n --brand-01: #005d5d;\n --brand-02: #004144;\n --brand-03: #007d79;\n --bottom-nav-height: #{layout.$spacing-10};\n --workspace-header-height: #{layout.$spacing-09};\n --tablet-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--bottom-nav-height));\n --desktop-workspace-window-height: calc(100vh - var(--omrs-navbar-height) - var(--workspace-header-height));\n}\n\n$breakpoint-phone-min: 0px;\n$breakpoint-phone-max: 600px;\n$breakpoint-tablet-min: 601px;\n$breakpoint-tablet-max: 1023px;\n$breakpoint-small-desktop-min: 1024px;\n$breakpoint-small-desktop-max: 1439px;\n$breakpoint-large-desktop-min: 1440px;\n$breakpoint-large-desktop-max: 99999999px;\n\n/* These color variables will be removed in a future release */\n$brand-teal-01: #007d79;\n$brand-01: #005d5d;\n$brand-02: #004144;\n","@use '@carbon/layout';\n@use '@openmrs/esm-styleguide/src/vars' as *;\n\n.tablet {\n padding: layout.$spacing-06 layout.$spacing-05;\n background-color: $ui-02;\n}\n\n.desktop {\n padding: 0rem;\n}\n\n.button {\n height: layout.$spacing-10;\n display: flex;\n align-content: flex-start;\n align-items: baseline;\n min-width: 50%;\n\n :global(.cds--inline-loading) {\n min-height: layout.$spacing-05 !important;\n }\n\n :global(.cds--inline-loading__text) {\n font-size: unset !important;\n }\n}\n\n.mt2 {\n margin-top: layout.$spacing-07;\n}\n\n.searchContent {\n position: absolute;\n background-color: #fff;\n min-width: 230px;\n overflow: auto;\n border: 1px solid #ddd;\n z-index: 1;\n width: 92%;\n}\n\n.searchItem {\n border-bottom: 0.1rem solid;\n border-bottom-color: silver;\n cursor: pointer;\n}\n\n.invalidInput {\n border: 2px solid red;\n}\n\n.removeButton {\n color: #ee0909;\n right: 20px;\n cursor: pointer;\n}\n\n.form {\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n height: calc(100vh - 6rem);\n}\n\n:global(.omrs-breakpoint-lt-desktop) .form {\n background-color: #ededed;\n}\n\n:global(.omrs-breakpoint-gt-tablet) .form {\n background-color: $ui-02;\n}\n\n.grid {\n margin: layout.$spacing-05;\n display: flex;\n flex-direction: column;\n gap: layout.$spacing-05;\n}\n\n.row {\n margin: layout.$spacing-03 0rem 0rem;\n display: flex;\n flex-flow: row wrap;\n gap: layout.$spacing-05;\n}\n\n.spacer {\n margin-top: layout.$spacing-05;\n}\n\n.selectedItemsContainer {\n margin-top: layout.$spacing-05;\n \n h4 {\n margin-bottom: layout.$spacing-05;\n color: $text-02;\n font-size: 1rem;\n font-weight: 600;\n }\n \n .itemCard {\n border: 1px solid $ui-03;\n border-radius: layout.$spacing-02;\n padding: layout.$spacing-05;\n margin-bottom: layout.$spacing-05;\n background-color: $ui-01;\n \n .itemHeader {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: layout.$spacing-05;\n \n .itemName {\n font-weight: 600;\n font-size: 1rem;\n color: $text-02;\n }\n }\n \n .itemControls {\n display: flex;\n flex-wrap: wrap;\n gap: layout.$spacing-05;\n margin-top: layout.$spacing-03;\n align-items: flex-end; .controlSection {\n display: flex;\n flex-direction: column;\n min-width: 0;\n \n &:first-child {\n flex: 1 1 auto;\n min-width: 250px;\n }\n \n &:nth-child(2) {\n flex: 0 0 140px;\n width: 140px;\n }\n \n &:last-child {\n flex: 0 0 180px;\n width: 180px;\n margin-left: auto;\n text-align: right;\n }\n \n label {\n font-size: 0.875rem;\n font-weight: 500;\n margin-bottom: layout.$spacing-03;\n color: $text-02;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n \n :global(.cds--list-box),\n :global(.cds--number),\n :global(.cds--combo-box),\n :global(.cds--list-box__wrapper),\n :global(.cds--list-box__field) {\n width: 100% !important;\n max-width: 100% !important;\n min-width: 0 !important;\n }\n \n .priceDisplay,\n .totalDisplay {\n font-size: 0.875rem;\n font-size: 0.875rem;\n font-weight: 600;\n color: $text-02;\n padding: layout.$spacing-03 0;\n word-break: break-word;\n }\n }\n }\n }\n \n .grandTotal {\n text-align: right;\n padding: layout.$spacing-05;\n border-top: 2px solid $interactive-01;\n margin-top: layout.$spacing-05;\n background-color: $ui-01;\n font-size: 1.125rem;\n font-weight: 600;\n color: $text-02;\n }\n}\n\n@media (max-width: 1056px) {\n .selectedItemsContainer {\n .itemCard {\n .itemControls {\n .controlSection {\n &:nth-child(2) {\n flex: 1 1 100%;\n width: 100%;\n }\n }\n }\n }\n }\n}\n\n@media (max-width: 768px) {\n .selectedItemsContainer {\n .itemCard {\n padding: layout.$spacing-04;\n \n .itemControls {\n flex-direction: column;\n gap: layout.$spacing-03;\n \n .controlSection {\n &:first-child,\n &:nth-child(2),\n &:last-child {\n flex: 1 1 100%;\n width: 100%;\n max-width: 100%;\n }\n }\n }\n }\n }\n}\n","// Code generated by @carbon/layout. DO NOT EDIT.\n//\n// Copyright IBM Corp. 2018, 2023\n//\n// This source code is licensed under the Apache-2.0 license found in the\n// LICENSE file in the root directory of this source tree.\n//\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-01: 0.125rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-02: 0.25rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-03: 0.5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-04: 0.75rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-05: 1rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-06: 1.5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-07: 2rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-08: 2.5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-09: 3rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-10: 4rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-11: 5rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-12: 6rem !default;\n\n/// @type Number\n/// @access public\n/// @group @carbon/layout\n$spacing-13: 10rem !default;\n\n/// @type Map\n/// @access public\n/// @group @carbon/layout\n$spacing: (\n spacing-01: $spacing-01,\n spacing-02: $spacing-02,\n spacing-03: $spacing-03,\n spacing-04: $spacing-04,\n spacing-05: $spacing-05,\n spacing-06: $spacing-06,\n spacing-07: $spacing-07,\n spacing-08: $spacing-08,\n spacing-09: $spacing-09,\n spacing-10: $spacing-10,\n spacing-11: $spacing-11,\n spacing-12: $spacing-12,\n spacing-13: $spacing-13,\n);\n"],sourceRoot:""}]),o.locals={tablet:"-esm-billing__billing-form__tablet___depIv",desktop:"-esm-billing__billing-form__desktop___XrIGU",button:"-esm-billing__billing-form__button___+KaHL",mt2:"-esm-billing__billing-form__mt2___XSCej",searchContent:"-esm-billing__billing-form__searchContent___rwtx-",searchItem:"-esm-billing__billing-form__searchItem___gJRX7",invalidInput:"-esm-billing__billing-form__invalidInput___-CFhJ",removeButton:"-esm-billing__billing-form__removeButton___JOb+t",form:"-esm-billing__billing-form__form___dOD1L",grid:"-esm-billing__billing-form__grid___bVIsN",row:"-esm-billing__billing-form__row___kfkPE",spacer:"-esm-billing__billing-form__spacer___5WyoB",selectedItemsContainer:"-esm-billing__billing-form__selectedItemsContainer___EgCXw",itemCard:"-esm-billing__billing-form__itemCard___-qABa",itemHeader:"-esm-billing__billing-form__itemHeader___IPVIh",itemName:"-esm-billing__billing-form__itemName___0pvcY",itemControls:"-esm-billing__billing-form__itemControls___T4bKO",controlSection:"-esm-billing__billing-form__controlSection___OAlFb",priceDisplay:"-esm-billing__billing-form__priceDisplay___MN5Zc",totalDisplay:"-esm-billing__billing-form__totalDisplay___mNY6D",grandTotal:"-esm-billing__billing-form__grandTotal___a5c-8"};const a=o},64739:(n,e,i)=>{i.r(e),i.d(e,{default:()=>F});var l=i(16072),t=i.n(l),r=i(53941),o=i(27804),a=i(7790),_=i(55576),s=i(15847),m=i(54392),c=i(14720),b=i(50930),g=i(85072),A=i.n(g),d=i(97825),p=i.n(d),C=i(77659),f=i.n(C),u=i(55056),y=i.n(u),h=i(10540),w=i.n(h),v=i(41113),E=i.n(v),x=i(12149),$={};$.styleTagTransform=E(),$.setAttributes=y(),$.insert=f().bind(null,"head"),$.domAPI=p(),$.insertStyleElement=w(),A()(x.A,$);const B=x.A&&x.A.locals?x.A.locals:void 0;function k(n,e){(null==e||e>n.length)&&(e=n.length);for(var i=0,l=new Array(e);i<e;i++)l[i]=n[i];return l}function I(n,e,i){return e in n?Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[e]=i,n}function O(n){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{},l=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(i).filter((function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})))),l.forEach((function(e){I(n,e,i[e])}))}return n}function S(n,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):function(n){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e.push.apply(e,i)}return e}(Object(e)).forEach((function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})),n}function D(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var i=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=i){var l,t,r=[],o=!0,a=!1;try{for(i=i.call(n);!(o=(l=i.next()).done)&&(r.push(l.value),!e||r.length!==e);o=!0);}catch(n){a=!0,t=n}finally{try{o||null==i.return||i.return()}finally{if(a)throw t}}return r}}(n,e)||T(n,e)||function(){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(n){return function(n){if(Array.isArray(n))return k(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||T(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.")}()}function T(n,e){if(n){if("string"==typeof n)return k(n,e);var i=Object.prototype.toString.call(n).slice(8,-1);return"Object"===i&&n.constructor&&(i=n.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?k(n,e):void 0}}const F=function(n){var e=n.patientUuid,i=n.closeWorkspace,g="tablet"===(0,s.useLayoutType)(),A=(0,r.useTranslation)().t,d=(0,s.useConfig)(),p=d.defaultCurrency,C=d.postBilledItems,f=D((0,l.useState)(!1),2),u=f[0],y=f[1],h=D((0,l.useState)([]),2),w=h[0],v=h[1],E=(0,m.ly)(),x=E.data,$=E.error,k=E.isLoading;return t().createElement(a.lVW,{className:B.form},t().createElement("div",{className:B.grid},k?t().createElement(a.OuH,{description:(0,s.getCoreTranslation)("loading")+"..."}):$?t().createElement(a.jeF,{kind:"error",lowContrast:!0,title:A("billErrorService","Bill service error"),subtitle:A("errorLoadingBillServices","Error loading bill services")}):t().createElement(a.a32,{id:"searchItems",onChange:function(n){return function(n){if(n){var e=w.find((function(e){return e.uuid===n.uuid}));if(e){var i=S(O({},e),{quantity:e.quantity+1});v(N(w).map((function(e){return e.uuid===n.uuid?i:e})))}else{var l=n.servicePrices||[],t=0,r=null;1===l.length&&(t=parseFloat(l[0].price),r=l[0]);var o={uuid:n.uuid,display:n.name,quantity:1,price:t,billableService:n.uuid,paymentStatus:"PENDING",lineItemOrder:0,selectedPaymentMethod:r,availablePaymentMethods:l};v(N(w).concat([o]))}}}(n.selectedItem)},itemToString:function(n){return(null==n?void 0:n.name)||""},items:null!=x?x:[],titleText:A("searchItems","Search items and services")}),w&&w.length>0&&t().createElement("div",{className:B.selectedItemsContainer},t().createElement("h4",null,A("selectedItems","Selected Items")),w.map((function(n){return t().createElement("div",{key:n.uuid,className:B.itemCard},t().createElement("div",{className:B.itemHeader},t().createElement("span",{className:B.itemName},n.display),t().createElement(a.$nd,{kind:"ghost",size:"sm",renderIcon:_.zH,iconDescription:A("remove","Remove"),onClick:function(){return e=n.uuid,i=N(w).filter((function(n){return n.uuid!==e})),void v(i);var e,i}})),t().createElement("div",{className:B.itemControls},n.availablePaymentMethods&&n.availablePaymentMethods.length>1?t().createElement("div",{className:B.controlSection},t().createElement("label",null,A("selectPaymentMethod","Select payment method")),t().createElement(a.a32,{id:"payment-method-".concat(n.uuid),items:n.availablePaymentMethods,size:"md",itemToString:function(n){return n?"".concat(n.name," - ").concat((0,c.aL)(parseFloat(n.price),p)):""},selectedItem:n.selectedPaymentMethod,onChange:function(e){var i,l,t,r=e.selectedItem;r&&(i=n.uuid,l=r,t=N(w).map((function(n){return n.uuid===i?S(O({},n),{selectedPaymentMethod:l,price:parseFloat(l.price),priceName:l.name,priceUuid:l.uuid}):n})),v(t))},placeholder:A("selectPaymentMethod","Select payment method"),titleText:""})):t().createElement("div",{className:B.controlSection},t().createElement("label",null,A("unitPrice","Unit Price")),t().createElement("span",{className:B.priceDisplay},(0,c.aL)(n.price,p))),t().createElement("div",{className:B.controlSection},t().createElement("label",null,A("quantity","Quantity")),t().createElement(a.Q7x,{id:"quantity-".concat(n.uuid),min:1,value:n.quantity,size:"md",onChange:function(e,i){var l,t,r,o=i.value,a=parseFloat(String(o));l=n.uuid,t=isNaN(a)?1:a,r=N(w).map((function(n){return n.uuid===l?S(O({},n),{quantity:t}):n})),v(r)}})),t().createElement("div",{className:B.controlSection},t().createElement("label",null,A("total","Total")),t().createElement("span",{className:B.totalDisplay},(0,c.aL)(n.price*n.quantity,p)))))})),t().createElement("div",{className:B.grandTotal},t().createElement("strong",null,A("grandTotal","Grand total"),":"," ",(0,c.aL)((0,c.Zz)(w),p))))),t().createElement(a.Te$,{className:g?B.tablet:B.desktop},t().createElement(a.$nd,{className:B.button,kind:"secondary",disabled:u,onClick:i},A("discard","Discard")),t().createElement(a.$nd,{className:B.button,kind:"primary",onClick:function(){if(function(){var n=!0,e=!1,i=void 0;try{for(var l,t=w[Symbol.iterator]();!(n=(l=t.next()).done);n=!0){var r=l.value;if(r.availablePaymentMethods&&r.availablePaymentMethods.length>1&&!r.selectedPaymentMethod)return(0,s.showSnackbar)({title:A("validationError","Validation Error"),subtitle:A("selectPaymentMethodRequired","Please select a payment method for all items"),kind:"error"}),!1}}catch(n){e=!0,i=n}finally{try{n||null==t.return||t.return()}finally{if(e)throw i}}return!0}()){y(!0);var n={cashPoint:C.cashPoint,cashier:C.cashier,lineItems:[],payments:[],patient:e,status:"PENDING"};w.forEach((function(e){var i={quantity:e.quantity,price:e.price,lineItemOrder:0,paymentStatus:"PENDING",billableService:e.uuid};n.lineItems.push(i)}));var l="".concat(b.B,"bill");(0,m.Xn)(n).then((function(){y(!1),i(),(0,o.j)((function(n){return"string"==typeof n&&n.startsWith(l)}),void 0,{revalidate:!0}),(0,s.showSnackbar)({title:A("saveBill","Save Bill"),subtitle:A("billProcessingSuccess","Bill processing has been successful"),kind:"success",timeoutInMs:3e3})}),(function(n){y(!1),(0,s.showSnackbar)({title:A("billProcessingError","Bill processing error"),kind:"error",subtitle:null==n?void 0:n.message})}))}},disabled:u||0===w.length,type:"submit"},u?t().createElement(a.OuH,{description:A("saving","Saving")+"..."}):A("saveAndClose","Save and close"))))}}}]);
|
package/dist/4739.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4739.js","mappings":"qMAGIA,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACC,EAAOC,GAAI,
|
|
1
|
+
{"version":3,"file":"4739.js","mappings":"qMAGIA,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACC,EAAOC,GAAI,wlPAAylP,GAAG,CAAC,QAAU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G,GACCL,GAAgB,IAChB0F,EAAAA,EAAAA,cAAa,CACXvE,MAAOzB,EAAE,sBAAuB,yBAChCuB,KAAM,QACNG,SAAUf,aAAAA,EAAAA,EAAOwG,SAErB,GA7CF,CA+CF,EA+GQpB,SAAU1F,GAAyC,IAAzBE,EAAckC,OACxC2E,KAAK,UACJ/G,EACC,kBAACc,EAAAA,IAAaA,CAACC,YAAapB,EAAE,SAAU,UAAY,QAEpDA,EAAE,eAAgB,oBAM9B,C","sources":["webpack://@openmrs/esm-billing-app/./src/billing-form/billing-form.scss","webpack://@openmrs/esm-billing-app/./src/billing-form/billing-form.scss?df6c","webpack://@openmrs/esm-billing-app/./src/billing-form/billing-form.component.tsx"],"names":["___CSS_LOADER_EXPORT___","push","module","id","locals","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","undefined","patientUuid","closeWorkspace","isTablet","useLayoutType","useTranslation","t","useConfig","defaultCurrency","postBilledItems","useState","isSubmitting","setIsSubmitting","selectedItems","setSelectedItems","useBillableServices","data","error","isLoading","Form","className","styles","form","div","grid","InlineLoading","description","getCoreTranslation","InlineNotification","kind","lowContrast","title","subtitle","ComboBox","onChange","item","existingItem","find","selectedItem","uuid","updatedItem","quantity","map","availablePaymentMethods","servicePrices","defaultPrice","selectedPaymentMethod","length","parseFloat","price","mappedItem","display","name","billableService","paymentStatus","lineItemOrder","selectBillableItem","itemToString","items","titleText","selectedItemsContainer","h4","key","itemCard","itemHeader","span","itemName","Button","size","renderIcon","TrashCan","iconDescription","onClick","updatedItems","filter","itemControls","controlSection","label","method","convertToCurrency","itemUuid","paymentMethod","priceName","priceUuid","placeholder","priceDisplay","NumberInput","min","value","_","number","String","isNaN","totalDisplay","grandTotal","strong","calculateTotalAmount","ButtonSet","tablet","desktop","button","disabled","showSnackbar","validateSelectedItems","bill","cashPoint","cashier","lineItems","payments","patient","status","forEach","lineItem","url","apiBasePath","processBillItems","then","mutate","startsWith","revalidate","timeoutInMs","message","type"],"sourceRoot":""}
|
|
@@ -659,9 +659,9 @@
|
|
|
659
659
|
"initial": false,
|
|
660
660
|
"entry": false,
|
|
661
661
|
"recorded": false,
|
|
662
|
-
"size":
|
|
662
|
+
"size": 37846,
|
|
663
663
|
"sizes": {
|
|
664
|
-
"javascript":
|
|
664
|
+
"javascript": 37846
|
|
665
665
|
},
|
|
666
666
|
"names": [],
|
|
667
667
|
"idHints": [],
|
|
@@ -675,7 +675,7 @@
|
|
|
675
675
|
"auxiliaryFiles": [
|
|
676
676
|
"4739.js.map"
|
|
677
677
|
],
|
|
678
|
-
"hash": "
|
|
678
|
+
"hash": "9effec24bd4f34f8",
|
|
679
679
|
"childrenByOrder": {}
|
|
680
680
|
},
|
|
681
681
|
{
|
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.24.0","fhir2":">=1.2"},"pages":[{"component":"billableServicesHome","route":"billable-services"}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"},"featureFlag":"billing"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing history"},"featureFlag":"billing"},{"name":"billable-services-app-menu-item","component":"billableServicesAppMenuItem","slot":"app-menu-item-slot","meta":{"name":"Billable Services"}},{"name":"billing-checkin-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm","featureFlag":"billing"},{"slot":"system-admin-page-card-link-slot","component":"billableServicesCardLink","name":"billable-services-admin-card-link"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"billing-home-tiles-ext","slot":"billing-home-tiles-slot","component":"serviceMetrics"},{"name":"edit-bill-line-item-dialog","component":"editBillLineItemModal","online":true,"offline":true}],"modals":[{"name":"add-cash-point-modal","component":"addCashPointModal"},{"name":"add-payment-mode-modal","component":"addPaymentModeModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"edit-bill-item-modal","component":"editBillLineItemModal"},{"name":"edit-billable-service-modal","component":"editBillableServiceModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"workspaces":[{"name":"billing-form-workspace","title":"billingForm","component":"billingFormWorkspace","type":"form"}],"featureFlags":[{"flagName":"billing","label":"Billing module","description":"This feature introduces navigation links on the patient chart and home page to allow accessing the billing module features"}],"version":"1.0.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.24.0","fhir2":">=1.2"},"pages":[{"component":"billableServicesHome","route":"billable-services"}],"extensions":[{"component":"billingDashboardLink","name":"billing-dashboard-link","slot":"homepage-dashboard-slot","meta":{"name":"billing","title":"billing","slot":"billing-dashboard-slot"},"featureFlag":"billing"},{"component":"root","name":"billing-dashboard-root","slot":"billing-dashboard-slot"},{"name":"billing-patient-summary","component":"billingPatientSummary","slot":"patient-chart-billing-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"billing-summary-dashboard-link","component":"billingSummaryDashboardLink","slot":"patient-chart-dashboard-slot","order":11,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-billing-dashboard-slot","path":"Billing history"},"featureFlag":"billing"},{"name":"billable-services-app-menu-item","component":"billableServicesAppMenuItem","slot":"app-menu-item-slot","meta":{"name":"Billable Services"}},{"name":"billing-checkin-form","slot":"extra-visit-attribute-slot","component":"billingCheckInForm","featureFlag":"billing"},{"slot":"system-admin-page-card-link-slot","component":"billableServicesCardLink","name":"billable-services-admin-card-link"},{"name":"patient-banner-billing-tags","component":"visitAttributeTags","slot":"patient-banner-tags-slot","order":2},{"name":"billing-home-tiles-ext","slot":"billing-home-tiles-slot","component":"serviceMetrics"},{"name":"edit-bill-line-item-dialog","component":"editBillLineItemModal","online":true,"offline":true}],"modals":[{"name":"add-cash-point-modal","component":"addCashPointModal"},{"name":"add-payment-mode-modal","component":"addPaymentModeModal"},{"name":"delete-payment-mode-modal","component":"deletePaymentModeModal"},{"name":"edit-bill-item-modal","component":"editBillLineItemModal"},{"name":"edit-billable-service-modal","component":"editBillableServiceModal"},{"name":"require-billing-modal","component":"requirePaymentModal"}],"workspaces":[{"name":"billing-form-workspace","title":"billingForm","component":"billingFormWorkspace","type":"form"}],"featureFlags":[{"flagName":"billing","label":"Billing module","description":"This feature introduces navigation links on the patient chart and home page to allow accessing the billing module features"}],"version":"1.0.2-pre.737"}
|
package/package.json
CHANGED
|
@@ -21,10 +21,15 @@ import { useConfig, useLayoutType, showSnackbar, getCoreTranslation } from '@ope
|
|
|
21
21
|
import { processBillItems, useBillableServices } from '../billing.resource';
|
|
22
22
|
import { calculateTotalAmount, convertToCurrency } from '../helpers/functions';
|
|
23
23
|
import type { BillingConfig } from '../config-schema';
|
|
24
|
-
import type { BillableItem, LineItem } from '../types';
|
|
24
|
+
import type { BillableItem, LineItem, ServicePrice } from '../types';
|
|
25
25
|
import { apiBasePath } from '../constants';
|
|
26
26
|
import styles from './billing-form.scss';
|
|
27
27
|
|
|
28
|
+
interface ExtendedLineItem extends LineItem {
|
|
29
|
+
selectedPaymentMethod?: ServicePrice;
|
|
30
|
+
availablePaymentMethods?: ServicePrice[];
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
type BillingFormProps = {
|
|
29
34
|
patientUuid: string;
|
|
30
35
|
closeWorkspace: () => void;
|
|
@@ -35,13 +40,13 @@ const BillingForm: React.FC<BillingFormProps> = ({ patientUuid, closeWorkspace }
|
|
|
35
40
|
const { t } = useTranslation();
|
|
36
41
|
const { defaultCurrency, postBilledItems } = useConfig<BillingConfig>();
|
|
37
42
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
38
|
-
const [selectedItems, setSelectedItems] = useState<
|
|
43
|
+
const [selectedItems, setSelectedItems] = useState<ExtendedLineItem[]>([]);
|
|
39
44
|
const { data, error, isLoading } = useBillableServices();
|
|
40
45
|
|
|
41
46
|
const selectBillableItem = (item: BillableItem) => {
|
|
42
47
|
if (!item) return;
|
|
43
|
-
const existingItem = selectedItems.find((selectedItem) => selectedItem.uuid === item.uuid);
|
|
44
48
|
|
|
49
|
+
const existingItem = selectedItems.find((selectedItem) => selectedItem.uuid === item.uuid);
|
|
45
50
|
if (existingItem) {
|
|
46
51
|
const updatedItem = { ...existingItem, quantity: existingItem.quantity + 1 };
|
|
47
52
|
setSelectedItems(
|
|
@@ -50,15 +55,27 @@ const BillingForm: React.FC<BillingFormProps> = ({ patientUuid, closeWorkspace }
|
|
|
50
55
|
return;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
const
|
|
58
|
+
const availablePaymentMethods = item.servicePrices || [];
|
|
59
|
+
let defaultPrice = 0;
|
|
60
|
+
let selectedPaymentMethod = null;
|
|
61
|
+
|
|
62
|
+
if (availablePaymentMethods.length === 1) {
|
|
63
|
+
defaultPrice = parseFloat(availablePaymentMethods[0].price);
|
|
64
|
+
selectedPaymentMethod = availablePaymentMethods[0];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const mappedItem: ExtendedLineItem = {
|
|
54
68
|
uuid: item.uuid,
|
|
55
69
|
display: item.name,
|
|
56
70
|
quantity: 1,
|
|
57
|
-
price:
|
|
71
|
+
price: defaultPrice,
|
|
58
72
|
billableService: item.uuid,
|
|
59
73
|
paymentStatus: 'PENDING',
|
|
60
74
|
lineItemOrder: 0,
|
|
75
|
+
selectedPaymentMethod: selectedPaymentMethod,
|
|
76
|
+
availablePaymentMethods: availablePaymentMethods,
|
|
61
77
|
};
|
|
78
|
+
|
|
62
79
|
setSelectedItems([...selectedItems, mappedItem]);
|
|
63
80
|
};
|
|
64
81
|
|
|
@@ -72,7 +89,40 @@ const BillingForm: React.FC<BillingFormProps> = ({ patientUuid, closeWorkspace }
|
|
|
72
89
|
setSelectedItems(updatedItems);
|
|
73
90
|
};
|
|
74
91
|
|
|
92
|
+
const updatePaymentMethod = (itemUuid: string, paymentMethod: ServicePrice) => {
|
|
93
|
+
const updatedItems = [...selectedItems].map((item) =>
|
|
94
|
+
item.uuid === itemUuid
|
|
95
|
+
? {
|
|
96
|
+
...item,
|
|
97
|
+
selectedPaymentMethod: paymentMethod,
|
|
98
|
+
price: parseFloat(paymentMethod.price),
|
|
99
|
+
priceName: paymentMethod.name,
|
|
100
|
+
priceUuid: paymentMethod.uuid,
|
|
101
|
+
}
|
|
102
|
+
: item,
|
|
103
|
+
);
|
|
104
|
+
setSelectedItems(updatedItems);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const validateSelectedItems = (): boolean => {
|
|
108
|
+
for (const item of selectedItems) {
|
|
109
|
+
if (item.availablePaymentMethods && item.availablePaymentMethods.length > 1 && !item.selectedPaymentMethod) {
|
|
110
|
+
showSnackbar({
|
|
111
|
+
title: t('validationError', 'Validation Error'),
|
|
112
|
+
subtitle: t('selectPaymentMethodRequired', 'Please select a payment method for all items'),
|
|
113
|
+
kind: 'error',
|
|
114
|
+
});
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
};
|
|
120
|
+
|
|
75
121
|
const postBillItems = () => {
|
|
122
|
+
if (!validateSelectedItems()) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
76
126
|
setIsSubmitting(true);
|
|
77
127
|
const bill = {
|
|
78
128
|
cashPoint: postBilledItems.cashPoint,
|
|
@@ -142,49 +192,82 @@ const BillingForm: React.FC<BillingFormProps> = ({ patientUuid, closeWorkspace }
|
|
|
142
192
|
/>
|
|
143
193
|
)}
|
|
144
194
|
{selectedItems && selectedItems.length > 0 && (
|
|
145
|
-
<
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
195
|
+
<div className={styles.selectedItemsContainer}>
|
|
196
|
+
<h4>{t('selectedItems', 'Selected Items')}</h4>
|
|
197
|
+
{selectedItems.map((item) => (
|
|
198
|
+
<div key={item.uuid} className={styles.itemCard}>
|
|
199
|
+
<div className={styles.itemHeader}>
|
|
200
|
+
<span className={styles.itemName}>{item.display}</span>
|
|
201
|
+
<Button
|
|
202
|
+
kind="ghost"
|
|
203
|
+
size="sm"
|
|
204
|
+
renderIcon={TrashCan}
|
|
205
|
+
iconDescription={t('remove', 'Remove')}
|
|
206
|
+
onClick={() => removeSelectedBillableItem(item.uuid)}
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div className={styles.itemControls}>
|
|
211
|
+
{item.availablePaymentMethods && item.availablePaymentMethods.length > 1 ? (
|
|
212
|
+
<div className={styles.controlSection}>
|
|
213
|
+
<label>{t('selectPaymentMethod', 'Select payment method')}</label>
|
|
214
|
+
<ComboBox
|
|
215
|
+
id={`payment-method-${item.uuid}`}
|
|
216
|
+
items={item.availablePaymentMethods}
|
|
217
|
+
size="md"
|
|
218
|
+
itemToString={(method: ServicePrice) =>
|
|
219
|
+
method
|
|
220
|
+
? `${method.name} - ${convertToCurrency(parseFloat(method.price), defaultCurrency)}`
|
|
221
|
+
: ''
|
|
222
|
+
}
|
|
223
|
+
selectedItem={item.selectedPaymentMethod}
|
|
224
|
+
onChange={({ selectedItem }) => {
|
|
225
|
+
if (selectedItem) {
|
|
226
|
+
updatePaymentMethod(item.uuid, selectedItem);
|
|
227
|
+
}
|
|
228
|
+
}}
|
|
229
|
+
placeholder={t('selectPaymentMethod', 'Select payment method')}
|
|
230
|
+
titleText=""
|
|
231
|
+
/>
|
|
232
|
+
</div>
|
|
233
|
+
) : (
|
|
234
|
+
<div className={styles.controlSection}>
|
|
235
|
+
<label>{t('unitPrice', 'Unit Price')}</label>
|
|
236
|
+
<span className={styles.priceDisplay}>{convertToCurrency(item.price, defaultCurrency)}</span>
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
|
|
240
|
+
<div className={styles.controlSection}>
|
|
241
|
+
<label>{t('quantity', 'Quantity')}</label>
|
|
160
242
|
<NumberInput
|
|
161
|
-
id={
|
|
243
|
+
id={`quantity-${item.uuid}`}
|
|
162
244
|
min={1}
|
|
163
|
-
value={
|
|
245
|
+
value={item.quantity}
|
|
246
|
+
size="md"
|
|
164
247
|
onChange={(_, { value }) => {
|
|
165
248
|
const number = parseFloat(String(value));
|
|
166
|
-
updateQuantity(
|
|
249
|
+
updateQuantity(item.uuid, isNaN(number) ? 1 : number);
|
|
167
250
|
}}
|
|
168
251
|
/>
|
|
169
|
-
</
|
|
170
|
-
|
|
171
|
-
<
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
</
|
|
177
|
-
</
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
</
|
|
186
|
-
</
|
|
187
|
-
</
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div className={styles.controlSection}>
|
|
255
|
+
<label>{t('total', 'Total')}</label>
|
|
256
|
+
<span className={styles.totalDisplay}>
|
|
257
|
+
{convertToCurrency(item.price * item.quantity, defaultCurrency)}
|
|
258
|
+
</span>
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
))}
|
|
263
|
+
|
|
264
|
+
<div className={styles.grandTotal}>
|
|
265
|
+
<strong>
|
|
266
|
+
{t('grandTotal', 'Grand total')}:{' '}
|
|
267
|
+
{convertToCurrency(calculateTotalAmount(selectedItems), defaultCurrency)}
|
|
268
|
+
</strong>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
188
271
|
)}
|
|
189
272
|
</div>
|
|
190
273
|
|
|
@@ -88,3 +88,143 @@
|
|
|
88
88
|
.spacer {
|
|
89
89
|
margin-top: layout.$spacing-05;
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
.selectedItemsContainer {
|
|
93
|
+
margin-top: layout.$spacing-05;
|
|
94
|
+
|
|
95
|
+
h4 {
|
|
96
|
+
margin-bottom: layout.$spacing-05;
|
|
97
|
+
color: $text-02;
|
|
98
|
+
font-size: 1rem;
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.itemCard {
|
|
103
|
+
border: 1px solid $ui-03;
|
|
104
|
+
border-radius: layout.$spacing-02;
|
|
105
|
+
padding: layout.$spacing-05;
|
|
106
|
+
margin-bottom: layout.$spacing-05;
|
|
107
|
+
background-color: $ui-01;
|
|
108
|
+
|
|
109
|
+
.itemHeader {
|
|
110
|
+
display: flex;
|
|
111
|
+
justify-content: space-between;
|
|
112
|
+
align-items: center;
|
|
113
|
+
margin-bottom: layout.$spacing-05;
|
|
114
|
+
|
|
115
|
+
.itemName {
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
font-size: 1rem;
|
|
118
|
+
color: $text-02;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.itemControls {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-wrap: wrap;
|
|
125
|
+
gap: layout.$spacing-05;
|
|
126
|
+
margin-top: layout.$spacing-03;
|
|
127
|
+
align-items: flex-end; .controlSection {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
|
|
132
|
+
&:first-child {
|
|
133
|
+
flex: 1 1 auto;
|
|
134
|
+
min-width: 250px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:nth-child(2) {
|
|
138
|
+
flex: 0 0 140px;
|
|
139
|
+
width: 140px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&:last-child {
|
|
143
|
+
flex: 0 0 180px;
|
|
144
|
+
width: 180px;
|
|
145
|
+
margin-left: auto;
|
|
146
|
+
text-align: right;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
label {
|
|
150
|
+
font-size: 0.875rem;
|
|
151
|
+
font-weight: 500;
|
|
152
|
+
margin-bottom: layout.$spacing-03;
|
|
153
|
+
color: $text-02;
|
|
154
|
+
white-space: nowrap;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
text-overflow: ellipsis;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:global(.cds--list-box),
|
|
160
|
+
:global(.cds--number),
|
|
161
|
+
:global(.cds--combo-box),
|
|
162
|
+
:global(.cds--list-box__wrapper),
|
|
163
|
+
:global(.cds--list-box__field) {
|
|
164
|
+
width: 100% !important;
|
|
165
|
+
max-width: 100% !important;
|
|
166
|
+
min-width: 0 !important;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.priceDisplay,
|
|
170
|
+
.totalDisplay {
|
|
171
|
+
font-size: 0.875rem;
|
|
172
|
+
font-size: 0.875rem;
|
|
173
|
+
font-weight: 600;
|
|
174
|
+
color: $text-02;
|
|
175
|
+
padding: layout.$spacing-03 0;
|
|
176
|
+
word-break: break-word;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.grandTotal {
|
|
183
|
+
text-align: right;
|
|
184
|
+
padding: layout.$spacing-05;
|
|
185
|
+
border-top: 2px solid $interactive-01;
|
|
186
|
+
margin-top: layout.$spacing-05;
|
|
187
|
+
background-color: $ui-01;
|
|
188
|
+
font-size: 1.125rem;
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
color: $text-02;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@media (max-width: 1056px) {
|
|
195
|
+
.selectedItemsContainer {
|
|
196
|
+
.itemCard {
|
|
197
|
+
.itemControls {
|
|
198
|
+
.controlSection {
|
|
199
|
+
&:nth-child(2) {
|
|
200
|
+
flex: 1 1 100%;
|
|
201
|
+
width: 100%;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@media (max-width: 768px) {
|
|
210
|
+
.selectedItemsContainer {
|
|
211
|
+
.itemCard {
|
|
212
|
+
padding: layout.$spacing-04;
|
|
213
|
+
|
|
214
|
+
.itemControls {
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
gap: layout.$spacing-03;
|
|
217
|
+
|
|
218
|
+
.controlSection {
|
|
219
|
+
&:first-child,
|
|
220
|
+
&:nth-child(2),
|
|
221
|
+
&:last-child {
|
|
222
|
+
flex: 1 1 100%;
|
|
223
|
+
width: 100%;
|
|
224
|
+
max-width: 100%;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|