Files
picpeak/frontend/src/services/vatCodes.service.ts
T
Luca 6e1924bae8 feat(accounting): VAT-code dropdown in the quote editor (+ reusable VatRateSelect)
Slice 3a — replaces the free-typed VAT rate in the quote editor with a dropdown
of configured output VAT codes (+ 'Other (custom rate)'), reading the un-gated
/admin/vat-codes endpoint. Selecting a code sends vatCode → the backend snapshots
it (migration 130) and the export emits it. New VatRateSelect component + a
read-only vatCodes.service. Create flow snapshots correctly; loading a saved code
into the editor (serialization return) + the bill editor are the next slices.
Build green.
2026-06-16 00:08:52 +02:00

22 lines
625 B
TypeScript

/**
* Read-only VAT-code registry for the invoice/quote editors. Hits the un-gated
* /admin/vat-codes endpoint (works without the accounting feature). Management
* lives in Settings → Accounting (ledger.service).
*/
import { api } from '../config/api';
export interface VatCodeOption {
id: number;
code: string;
name: string;
rate: number;
direction: 'output' | 'input';
}
export const vatCodesService = {
async listOutput(): Promise<VatCodeOption[]> {
const { data } = await api.get('/admin/vat-codes', { params: { direction: 'output' } });
return (data?.items ?? []) as VatCodeOption[];
},
};