Skip to content

Commit

Permalink
Add update transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
FPT-NMTung committed May 13, 2024
1 parent ea403d6 commit 0ac82da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/customInput/InputDatetime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const InputDatetime = (props) => {
</div>}
placeholder={props.placeholder}
isDisabled={props.isDisabled}
hideTimeZone={true}
hideTimeZone={false}
/>
)
}
Expand Down
10 changes: 7 additions & 3 deletions src/pages/transactionPage/UpdateTransaction.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import InputText from "../../components/customInput/InputText.jsx";
import InputDatetime from "../../components/customInput/InputDatetime.jsx";
import {getLocalTimeZone, now, parseAbsolute, parseDateTime} from "@internationalized/date";
import callApi from "../../apis/GatewayApi.js";
import {formatZoneTimeToString, removeMilliseconds, revertFormatNumber} from "../../common/common.js";
import {formatNumber, formatZoneTimeToString, removeMilliseconds, revertFormatNumber} from "../../common/common.js";
import toast from "react-hot-toast";
import {useForm} from "react-hook-form";

Expand Down Expand Up @@ -42,7 +42,7 @@ const UpdateTransaction = (props) => {
pk_bud_management: props.id
}, (data) => {
setValue('holder', data[0].FK_BUD_HOLDER)
setValue('amount', data[0].C_CASH_IN ? data[0].C_CASH_IN : data[0].C_CASH_OUT)
setValue('amount', formatNumber(data[0].C_CASH_IN ? data[0].C_CASH_IN : data[0].C_CASH_OUT))
setValue('note', data[0].C_NOTE)
setValue('date', parseAbsolute(data[0].C_DATE))
setValue('stateArrow', data[0].C_CASH_IN ? 'UP' : 'DOWN')
Expand Down Expand Up @@ -98,7 +98,11 @@ const UpdateTransaction = (props) => {
placeholder={'Please enter the amount'}
control={control}
rules={{
required: 'Field is required'
required: 'Field is required',
min: {
value: 1,
message: 'Must larger than 0'
}
}}
/>
</div>
Expand Down

0 comments on commit 0ac82da

Please sign in to comment.