diff --git a/ui/src/config.js b/ui/src/config.js index cb604a92e..adab6558f 100644 --- a/ui/src/config.js +++ b/ui/src/config.js @@ -1,10 +1,6 @@ export const config = { APP: { LOGO_SRC: null, - i18n: { - priceLocale: "fr-CH", - }, - DEFAULT_CURRENCY: "CHF", STATIC_PAGES: [ { name: "about", route: "/about", apiURL: "1" }, { name: "terms", route: "/terms", apiURL: "2" }, diff --git a/ui/src/overridden/backoffice/PaymentInformation/PaymentInformation.js b/ui/src/overridden/backoffice/PaymentInformation/PaymentInformation.js index 372da643d..d93d31a69 100644 --- a/ui/src/overridden/backoffice/PaymentInformation/PaymentInformation.js +++ b/ui/src/overridden/backoffice/PaymentInformation/PaymentInformation.js @@ -1,6 +1,7 @@ -import { PaymentInformation } from "@inveniosoftware/react-invenio-app-ils"; -import { formatPrice } from "../utils"; -import { config } from "../../../config"; +import { + PaymentInformation, + formatPrice, +} from "@inveniosoftware/react-invenio-app-ils"; import React from "react"; import { Icon, Popup } from "semantic-ui-react"; import { parametrize } from "react-overridable"; @@ -13,7 +14,7 @@ function leftPaymentInfoTable(order, type = "acquisition-order") { } return [ { - name: `Total (${config.APP.DEFAULT_CURRENCY})`, + name: `Total (${order.grand_total_main_currency.currency})`, value: formatPrice(order.grand_total_main_currency) || "-", }, { diff --git a/ui/src/overridden/backoffice/utils.js b/ui/src/overridden/backoffice/utils.js deleted file mode 100644 index b86bf1383..000000000 --- a/ui/src/overridden/backoffice/utils.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from "react"; -import { config } from "../../config"; - -export const formatPrice = (price, includeCurrency = true) => { - if (!price) return null; - - const options = - price.currency && includeCurrency - ? { - style: "currency", - currency: price.currency, - } - : { - maximumFractionDigits: 2, - }; - - return new Intl.NumberFormat(config.APP.i18n.priceLocale, options).format( - price.value - ); -};