fix rendering of register total
This commit is contained in:
1 parent
e60473e7ed
commit
d76c911d4b
1 file changed
+2
-3
@@ -4,6 +4,7 @@ import { useState } from "react";
|
|||||||
import { useToast } from "../../components/ToastProvider";
|
import { useToast } from "../../components/ToastProvider";
|
||||||
import { AllProductsDocument, AllUsersDocument, CreateOrderDocument, OrderLineInput, Product } from "../../types";
|
import { AllProductsDocument, AllUsersDocument, CreateOrderDocument, OrderLineInput, Product } from "../../types";
|
||||||
import { activeUserFilter } from "../../utils/users";
|
import { activeUserFilter } from "../../utils/users";
|
||||||
|
import {formatCurrency} from "../../utils/currency";
|
||||||
|
|
||||||
const USER_EXTERNAL = "external";
|
const USER_EXTERNAL = "external";
|
||||||
|
|
||||||
@@ -53,9 +54,7 @@ export const useRegister = () => {
|
|||||||
setOrder(newOrder);
|
setOrder(newOrder);
|
||||||
};
|
};
|
||||||
|
|
||||||
// This value does not interact with the backend or any financial logic.
|
const total = formatCurrency(sumTotal(products, order, selectedUser === USER_EXTERNAL));
|
||||||
// It is only used for rendering the sum total in the browser. The actual total is handled entirely by the backend.
|
|
||||||
const total = Number(sumTotal(products, order, selectedUser === USER_EXTERNAL).toFixed(2));
|
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
let res;
|
let res;
|
||||||
|
|||||||
Reference in new issue
Block a user