fix(libra): drop payment-method field from income submission
Income now lands on the submitting user as a receivable rather than on an entity asset account — see the matching libra backend change. Removes the "Received into" select and its supporting state from the form, and drops payment_method_account from IncomeEntryRequest / IncomeEntry. The form is now description + amount + currency + revenue account + optional reference.
This commit is contained in:
parent
0e03a424cb
commit
84456a849e
2 changed files with 2 additions and 36 deletions
|
|
@ -143,30 +143,6 @@
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField v-slot="{ componentField }" name="paymentMethodAccount">
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Received into *</FormLabel>
|
|
||||||
<Select v-bind="componentField">
|
|
||||||
<FormControl>
|
|
||||||
<SelectTrigger>
|
|
||||||
<SelectValue placeholder="Select asset account" />
|
|
||||||
</SelectTrigger>
|
|
||||||
</FormControl>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem
|
|
||||||
v-for="acc in assetAccounts"
|
|
||||||
:key="acc.id"
|
|
||||||
:value="acc.name"
|
|
||||||
>
|
|
||||||
{{ acc.name }}
|
|
||||||
</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<FormDescription>Where the funds were received (Cash, Bank, Lightning, etc.)</FormDescription>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField v-slot="{ componentField }" name="reference">
|
<FormField v-slot="{ componentField }" name="reference">
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Reference</FormLabel>
|
<FormLabel>Reference</FormLabel>
|
||||||
|
|
@ -269,7 +245,6 @@ const currentStep = ref(1)
|
||||||
const selectedRevenueAccount = ref<Account | null>(null)
|
const selectedRevenueAccount = ref<Account | null>(null)
|
||||||
const isSubmitting = ref(false)
|
const isSubmitting = ref(false)
|
||||||
const availableCurrencies = ref<string[]>([])
|
const availableCurrencies = ref<string[]>([])
|
||||||
const assetAccounts = ref<Account[]>([])
|
|
||||||
const showSuccessDialog = ref(false)
|
const showSuccessDialog = ref(false)
|
||||||
|
|
||||||
const formSchema = toTypedSchema(
|
const formSchema = toTypedSchema(
|
||||||
|
|
@ -277,7 +252,6 @@ const formSchema = toTypedSchema(
|
||||||
description: z.string().min(1, 'Description is required').max(500, 'Description too long'),
|
description: z.string().min(1, 'Description is required').max(500, 'Description too long'),
|
||||||
amount: z.coerce.number().min(0.01, 'Amount must be at least 0.01'),
|
amount: z.coerce.number().min(0.01, 'Amount must be at least 0.01'),
|
||||||
currency: z.string().min(1, 'Currency is required'),
|
currency: z.string().min(1, 'Currency is required'),
|
||||||
paymentMethodAccount: z.string().min(1, 'Payment method is required'),
|
|
||||||
reference: z.string().max(100, 'Reference too long').optional(),
|
reference: z.string().max(100, 'Reference too long').optional(),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
@ -288,7 +262,6 @@ const form = useForm({
|
||||||
description: '',
|
description: '',
|
||||||
amount: 0,
|
amount: 0,
|
||||||
currency: '',
|
currency: '',
|
||||||
paymentMethodAccount: '',
|
|
||||||
reference: '',
|
reference: '',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -310,11 +283,6 @@ onMounted(async () => {
|
||||||
const defaultCurrency = await expensesAPI.getDefaultCurrency()
|
const defaultCurrency = await expensesAPI.getDefaultCurrency()
|
||||||
const initialCurrency = defaultCurrency || currencies[0] || 'EUR'
|
const initialCurrency = defaultCurrency || currencies[0] || 'EUR'
|
||||||
form.setFieldValue('currency', initialCurrency)
|
form.setFieldValue('currency', initialCurrency)
|
||||||
|
|
||||||
const allAccounts = await expensesAPI.getAccounts(wallet.inkey, false, true)
|
|
||||||
assetAccounts.value = allAccounts.filter(
|
|
||||||
(a) => a.name === 'Assets' || a.name.startsWith('Assets:')
|
|
||||||
)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[AddIncome] Failed to load data:', error)
|
console.error('[AddIncome] Failed to load data:', error)
|
||||||
toast.error('Failed to load form data', { description: 'Please check your connection and try again' })
|
toast.error('Failed to load form data', { description: 'Please check your connection and try again' })
|
||||||
|
|
@ -345,7 +313,6 @@ const onSubmit = form.handleSubmit(async (values) => {
|
||||||
description: values.description,
|
description: values.description,
|
||||||
amount: values.amount,
|
amount: values.amount,
|
||||||
revenue_account: selectedRevenueAccount.value.name,
|
revenue_account: selectedRevenueAccount.value.name,
|
||||||
payment_method_account: values.paymentMethodAccount,
|
|
||||||
currency: values.currency,
|
currency: values.currency,
|
||||||
reference: values.reference,
|
reference: values.reference,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,13 @@ export interface ExpenseEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Income entry request payload
|
* Income entry request payload. Income lands on the submitting user as
|
||||||
|
* a receivable (Assets:Receivable:User-{id}) — no payment-method account.
|
||||||
*/
|
*/
|
||||||
export interface IncomeEntryRequest {
|
export interface IncomeEntryRequest {
|
||||||
description: string
|
description: string
|
||||||
amount: number
|
amount: number
|
||||||
revenue_account: string
|
revenue_account: string
|
||||||
payment_method_account: string
|
|
||||||
currency: string
|
currency: string
|
||||||
reference?: string
|
reference?: string
|
||||||
entry_date?: string
|
entry_date?: string
|
||||||
|
|
@ -101,7 +101,6 @@ export interface IncomeEntry {
|
||||||
description: string
|
description: string
|
||||||
amount: number
|
amount: number
|
||||||
revenue_account: string
|
revenue_account: string
|
||||||
payment_method_account: string
|
|
||||||
currency: string
|
currency: string
|
||||||
reference?: string
|
reference?: string
|
||||||
entry_date: string
|
entry_date: string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue