IO-2327 posting bills test cases

This commit is contained in:
swtmply
2023-08-08 12:44:36 +08:00
parent 6db0947454
commit 2cf4853960
4 changed files with 48 additions and 30 deletions

View File

@@ -153,6 +153,7 @@ export function BillDetailEditReturn({
// label={t("joblines.fields.actual_price")}
key={`${index}actual_price`}
name={[field.name, "actual_price"]}
data-cy="billline-actual-price"
>
<ReadOnlyFormItemComponent type="currency" />
</Form.Item>

View File

@@ -5,13 +5,11 @@ const ReadOnlyFormItem = ({ value, type = "text", onChange }, ref) => {
if (!value) return null;
switch (type) {
case "text":
return <div>{value}</div>;
return <>{value}</>;
case "currency":
return (
<div>{Dinero({ amount: Math.round(value * 100) }).toFormat()}</div>
);
return <>{Dinero({ amount: Math.round(value * 100) }).toFormat()}</>;
default:
return <div>{value}</div>;
return <>{value}</>;
}
};
export default forwardRef(ReadOnlyFormItem);

View File

@@ -84,6 +84,8 @@ export default function JobBillsTotalComponent({
})
);
console.log(totals.parts.parts.total);
const totalPartsSublet = Dinero(totals.parts.parts.total)
.add(Dinero(totals.parts.sublets.total))
.add(Dinero(totals.additional.shipping))