6e1924bae8
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.
22 lines
625 B
TypeScript
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[];
|
|
},
|
|
};
|