From 010bd09d47cb214275fa577c9b0edf6855ec3017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Tue, 13 Feb 2024 11:16:07 +0100 Subject: [PATCH 1/2] BillEditForm: payed amount in same line with checkbox --- app/ui/BillEditForm.tsx | 56 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/app/ui/BillEditForm.tsx b/app/ui/BillEditForm.tsx index 41076e2..9565fd3 100644 --- a/app/ui/BillEditForm.tsx +++ b/app/ui/BillEditForm.tsx @@ -35,13 +35,17 @@ export const BillEditForm:FC = ({ location, bill }) => { const [ state, dispatch ] = useFormState(handleAction, initialState); const [ isPaid, setIsPaid ] = React.useState(paid); - const [ payedAmount, setPayedAmount ] = React.useState(initialPayedAmount ?? 0); + const [ payedAmount, setPayedAmount ] = React.useState(initialPayedAmount ? `${initialPayedAmount/100}` : "" ); const [ barcodeImage, setBarcodeImage ] = React.useState(initialBarcodeImage); const billPaid_handleChange = (event: React.ChangeEvent) => { setIsPaid(event.target.checked); } + const payedAmount_handleChange = (event: React.ChangeEvent) => { + setPayedAmount(event.target.value); + } + const billAttachment_handleChange = (event: React.ChangeEvent) => { findDecodePdf417(event) .then(result => { @@ -51,7 +55,7 @@ export const BillEditForm:FC = ({ location, bill }) => { billInfo } = result; - setPayedAmount(billInfo.amount); + setPayedAmount(`${billInfo.amount/100}`); setBarcodeImage(barcodeImage); } }); @@ -98,34 +102,28 @@ export const BillEditForm:FC = ({ location, bill }) => {

))} - -
-