fix(taxes): correct compound tax document flows (#754)

This commit is contained in:
Darko Gjorgjijoski
2026-08-14 00:42:01 +02:00
committed by GitHub
parent 13aa087faf
commit 93dd7df48a
22 changed files with 701 additions and 57 deletions
@@ -103,6 +103,7 @@ interface Props {
interface Emits {
(e: 'remove', index: number): void
(e: 'update', payload: { index: number; item: DocumentTax }): void
(e: 'taxTypeCreated', taxType: TaxType): void
}
const props = withDefaults(defineProps<Props>(), {
@@ -246,9 +247,28 @@ function openTaxModal(): void {
transaction_type: 'sales',
},
size: 'sm',
refreshData: (...args: unknown[]) => {
const taxType = args[0]
if (isTaxType(taxType)) {
selectedTax.value = taxType
onSelectTax(taxType)
emit('taxTypeCreated', taxType)
}
},
})
}
function isTaxType(value: unknown): value is TaxType {
return (
typeof value === 'object' &&
value !== null &&
'id' in value &&
typeof value.id === 'number' &&
'name' in value &&
typeof value.name === 'string'
)
}
function removeTax(index: number): void {
const store = props.store as Record<string, Record<string, unknown>>
const formData = store[props.storeProp] as DocumentFormData