From acdc55c90ea9647abcf8abffe2a3fff03afb9a9c Mon Sep 17 00:00:00 2001 From: Santiago Palenque Date: Tue, 5 May 2026 12:00:59 -0300 Subject: [PATCH 1/3] chore: adding discount row and change notes row --- src/components/index.js | 2 +- .../mui/table/extra-rows/DiscountRow.jsx | 62 +++++++++++++++++++ .../mui/table/extra-rows/NotesRow.jsx | 13 +++- src/components/mui/table/extra-rows/index.js | 1 + src/i18n/en.json | 3 +- 5 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 src/components/mui/table/extra-rows/DiscountRow.jsx diff --git a/src/components/index.js b/src/components/index.js index 38180cd3..055fc6af 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -80,7 +80,7 @@ export {useSnackbarMessage} from './mui/SnackbarNotification/Context' export {default as MuiInfiniteTable} from './mui/infinite-table' export {default as MuiEditableTable} from './mui/editable-table/mui-table-editable' export {default as MuiTable} from './mui/table/mui-table' -export {TotalRow as MuiTotalRow, NotesRow as MuiNotesRow, FeeRow as MuiFeeRow, PaymentRow as MuiPaymentRow, RefundRow as MuiRefundRow} from './mui/table/extra-rows' +export {TotalRow as MuiTotalRow, NotesRow as MuiNotesRow, FeeRow as MuiFeeRow, PaymentRow as MuiPaymentRow, RefundRow as MuiRefundRow, DiscountRow as MuiDiscountRow} from './mui/table/extra-rows' export {default as MuiFormikAsyncSelect} from './mui/formik-inputs/mui-formik-async-select' export {default as MuiFormikCheckboxGroup} from './mui/formik-inputs/mui-formik-checkbox-group' export {default as MuiFormikCheckbox} from './mui/formik-inputs/mui-formik-checkbox' diff --git a/src/components/mui/table/extra-rows/DiscountRow.jsx b/src/components/mui/table/extra-rows/DiscountRow.jsx new file mode 100644 index 00000000..4e0d84b5 --- /dev/null +++ b/src/components/mui/table/extra-rows/DiscountRow.jsx @@ -0,0 +1,62 @@ +/** + * Copyright 2026 OpenStack Foundation + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +import React from "react"; +import T from "i18n-react/dist/i18n-react"; +import TableRow from "@mui/material/TableRow"; +import TableCell from "@mui/material/TableCell"; +import Typography from "@mui/material/Typography"; +import { currencyAmountFromCents } from "../../../../utils/money"; + + +const DiscountRow = ({ discount, discountTotal, colGap = 2, trailing = 0 }) => { + + if (discountTotal === 0) return null; + + return ( + + {T.translate("mui_table.dis")} + + + {T.translate("mui_table.discount")} + + + {[...Array(colGap)].map((_, i) => ( + // eslint-disable-next-line react/no-array-index-key + + ))} + + + {discount} + + + + + -{currencyAmountFromCents(discountTotal)} + + + {[...Array(trailing)].map((_, i) => ( + // eslint-disable-next-line react/no-array-index-key + + ))} + + ); +}; + +export default DiscountRow; diff --git a/src/components/mui/table/extra-rows/NotesRow.jsx b/src/components/mui/table/extra-rows/NotesRow.jsx index b25cfdf2..a71d4d4e 100644 --- a/src/components/mui/table/extra-rows/NotesRow.jsx +++ b/src/components/mui/table/extra-rows/NotesRow.jsx @@ -15,15 +15,22 @@ import TableCell from "@mui/material/TableCell"; import TableRow from "@mui/material/TableRow"; import * as React from "react"; import { Typography } from "@mui/material"; +import T from "i18n-react"; -const NotesRow = ({ colCount, note }) => ( +const NotesRow = ({ colCount, note, showCode = false }) => { + const colSpan = showCode ? colCount - 1 : colCount; + return ( - - + {showCode && ( + {T.translate("mui_table.note")} + )} + + {note} ); +} export default NotesRow; diff --git a/src/components/mui/table/extra-rows/index.js b/src/components/mui/table/extra-rows/index.js index 18f36ef1..a0f9c1d5 100644 --- a/src/components/mui/table/extra-rows/index.js +++ b/src/components/mui/table/extra-rows/index.js @@ -16,3 +16,4 @@ export { default as NotesRow } from "./NotesRow"; export { default as FeeRow } from "./FeeRow"; export { default as PaymentRow } from "./PaymentRow"; export { default as RefundRow } from "./RefundRow"; +export { default as DiscountRow } from "./DiscountRow"; diff --git a/src/i18n/en.json b/src/i18n/en.json index 262b9138..a0f5aa80 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -65,7 +65,8 @@ "ref": "REF", "refund": "Refund", "payfee": "PAYFEE", - "amount_due": "AMOUNT DUE" + "amount_due": "AMOUNT DUE", + "note": "NOTE" }, "meta_fields": { "delete_value_warning": "Please verify you want to delete the added value", From a8eab95d50d612b6fe6b5469dfd3ccf014c723fe Mon Sep 17 00:00:00 2001 From: Santiago Palenque Date: Tue, 5 May 2026 15:52:39 -0300 Subject: [PATCH 2/3] chore: missing translations --- src/i18n/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/i18n/en.json b/src/i18n/en.json index a0f5aa80..a6ccb508 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -65,6 +65,8 @@ "ref": "REF", "refund": "Refund", "payfee": "PAYFEE", + "dis": "DIS", + "discount": "Discount", "amount_due": "AMOUNT DUE", "note": "NOTE" }, From b3cbd2e036c4007a1804e6850ae60cc329a81fbf Mon Sep 17 00:00:00 2001 From: Santiago Palenque Date: Tue, 5 May 2026 17:50:21 -0300 Subject: [PATCH 3/3] v5.0.19-beta.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d8f87a3..8ea668ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openstack-uicore-foundation", - "version": "5.0.16", + "version": "5.0.19-beta.1", "description": "ui reactjs components for openstack marketing site", "main": "lib/openstack-uicore-foundation.js", "scripts": {