mirror of
https://github.com/linuxserver/budge.git
synced 2026-03-09 00:08:38 +08:00
fixed (hacky fix) bug to find payee by name due to onInputChange 'bug'
This commit is contained in:
parent
a1a4dc0900
commit
37817d5679
@ -114,7 +114,7 @@ export default function Account(props) {
|
||||
memo: newRow.memo,
|
||||
payeeId: newRow.payeeId,
|
||||
categoryId: newRow.categoryId,
|
||||
status: 0, // @TODO: fix
|
||||
status: 0, // @TODO: implement transaction status
|
||||
}
|
||||
}))
|
||||
|
||||
@ -126,13 +126,15 @@ export default function Account(props) {
|
||||
|
||||
const onTransactionEdit = async (newData, oldData) => {
|
||||
if (!payeesMap[newData.payeeId]) {
|
||||
// Because of the 'onInputChange' autocomplete, the edited value gets subbed out for the 'text' value. Make sure this doesn't truly already exist.
|
||||
const payee = Object.values(payeesMap).filter(payee => payee.name === newData.payeeId)
|
||||
if (payee.length === 0) {
|
||||
console.log(payeesMap)
|
||||
console.log(newData.payeeId)
|
||||
// @TODO: Fix : Because of the 'onInputChange' autocomplete, the edited value gets subbed out for the 'text' value. Make sure this doesn't truly already exist.
|
||||
const payee = Object.keys(payeesMap).find(key => payeesMap[key] === newData.payeeId)
|
||||
if (!payee) {
|
||||
console.log('creating new payee')
|
||||
newData.payeeId = (await createNewPayee(newData.payeeId)).id
|
||||
} else {
|
||||
newData.payeeId = payee[0].id
|
||||
newData.payeeId = payee
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user