diff --git a/package.json b/package.json index 90e38915..e4560d1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openstack-uicore-foundation", - "version": "5.0.53", + "version": "5.0.55-beta.0", "description": "ui reactjs components for openstack marketing site", "main": "lib/openstack-uicore-foundation.js", "scripts": { diff --git a/src/components/mui/FormItemTable/helpers.js b/src/components/mui/FormItemTable/helpers.js index a2f7873c..ecfc7dde 100644 --- a/src/components/mui/FormItemTable/helpers.js +++ b/src/components/mui/FormItemTable/helpers.js @@ -39,8 +39,8 @@ export const getCurrentApplicableRate = (timeZone, rateDates) => { return "expired"; }; -export const isItemAvailable = (item, currentApplicableRate) => - item.rates?.[currentApplicableRate] != null; +export const isItemAvailable = (item, currentApplicableRate, customRate = 0) => + customRate || item.rates?.[currentApplicableRate] != null; // The global quantity for a row is driven (and therefore read-only/computed) // when a Form-class metafield of type Quantity exists for it (extraColumns, diff --git a/src/components/mui/FormItemTable/index.js b/src/components/mui/FormItemTable/index.js index 3e8aba60..ffa1cedf 100644 --- a/src/components/mui/FormItemTable/index.js +++ b/src/components/mui/FormItemTable/index.js @@ -164,13 +164,12 @@ const FormItemTable = ({ ); const calculateRowTotal = (row) => { + const customRate = values[`i-${row.form_item_id}-c-global-f-custom_rate`]; const qty = values[`i-${row.form_item_id}-c-global-f-quantity`] || calculateQuantity(row); - if (currentApplicableRate === "expired") return 0; - - const customRate = values[`i-${row.form_item_id}-c-global-f-custom_rate`]; + // if currentRate is expired or not set then we return, unless customRate is set const rate = customRate || row.rates[currentApplicableRate]; if (rate == null || qty == null) return 0; @@ -230,7 +229,8 @@ const FormItemTable = ({ {data.map((row) => { - const disabled = !isItemAvailable(row, currentApplicableRate); + const customRate = values[`i-${row.form_item_id}-c-global-f-custom_rate`]; + const disabled = !isItemAvailable(row, currentApplicableRate, customRate); const isOpen = !!openRows[row.form_item_id]; return (