feat: [quotes] 부가세 타입(vatType) options 저장 + QuoteApiData 타입 보강
This commit is contained in:
@@ -213,6 +213,8 @@ export interface QuoteApiData {
|
||||
updated_by: number | null;
|
||||
finalized_at: string | null;
|
||||
finalized_by: number | null;
|
||||
// options JSON (부가세 타입 등)
|
||||
options?: Record<string, unknown> | null;
|
||||
// 연결된 수주 ID (수주전환 시 설정)
|
||||
order_id?: number | null;
|
||||
// 관계 데이터 (with 로드 시)
|
||||
@@ -734,6 +736,8 @@ export interface QuoteFormDataV2 {
|
||||
dueDate: string;
|
||||
remarks: string;
|
||||
status: 'draft' | 'temporary' | 'final' | 'converted'; // 작성중, 임시저장, 최종저장, 수주전환
|
||||
|
||||
vatType: 'included' | 'excluded'; // 부가세 포함/별도
|
||||
discountRate: number; // 할인율 (%)
|
||||
discountAmount: number; // 할인 금액
|
||||
locations: LocationItem[];
|
||||
@@ -919,6 +923,9 @@ export function transformV2ToApi(
|
||||
status: data.status === 'final' ? 'finalized' : 'draft',
|
||||
is_final: data.status === 'final',
|
||||
calculation_inputs: calculationInputs,
|
||||
options: {
|
||||
vat_type: data.vatType || 'included',
|
||||
},
|
||||
items: items,
|
||||
};
|
||||
}
|
||||
@@ -1042,6 +1049,9 @@ export function transformApiToV2(apiData: QuoteApiData): QuoteFormDataV2 {
|
||||
remarks: apiData.remarks || apiData.description || transformed.description || '',
|
||||
status: mapStatus(apiData.status),
|
||||
// raw API: discount_rate, transformed: discountRate
|
||||
vatType: apiData.options?.vat_type as 'included' | 'excluded'
|
||||
|| (transformed as unknown as { vatType?: string })?.vatType as 'included' | 'excluded'
|
||||
|| 'included',
|
||||
discountRate: Number(apiData.discount_rate) || transformed.discountRate || 0,
|
||||
discountAmount: Number(apiData.discount_amount) || transformed.discountAmount || 0,
|
||||
locations: locations,
|
||||
|
||||
Reference in New Issue
Block a user