refactor: quotation type & customer branch fetch by register branch id

This commit is contained in:
puriphatt 2024-10-03 09:43:32 +07:00
parent e581556e78
commit 284028aff0
3 changed files with 19 additions and 33 deletions

View file

@ -10,23 +10,15 @@ export const useQuotationForm = defineStore('form-quotation', () => {
const quotationStore = useQuotationStore(); const quotationStore = useQuotationStore();
const defaultFormData: QuotationPayload = { const defaultFormData: QuotationPayload = {
service: [ productServiceList: [
{
work: [
{
product: [
{ {
vat: 0, vat: 0,
discount: 1, pricePerUnit: 0,
discount: 0,
amount: 0, amount: 0,
id: '', productId: '',
}, workId: '',
], serviceId: '',
excluded: false,
id: '',
},
],
id: '',
}, },
], ],
urgent: false, urgent: false,
@ -45,7 +37,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
actorName: '', actorName: '',
status: 'CREATED', status: 'CREATED',
}; };
let resetFormData = structuredClone(defaultFormData); const resetFormData = structuredClone(defaultFormData);
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData)); const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));

View file

@ -81,6 +81,7 @@ const useCustomerStore = defineStore('api-customer', () => {
zipCode?: string; zipCode?: string;
customerId?: string; customerId?: string;
includeCustomer?: boolean; includeCustomer?: boolean;
registeredBranchId?: string;
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
query?: string; query?: string;
page?: number; page?: number;
@ -118,6 +119,7 @@ const useCustomerStore = defineStore('api-customer', () => {
page?: number; page?: number;
pageSize?: number; pageSize?: number;
query?: string; query?: string;
registeredBranchId?: string;
includeBranch?: boolean; includeBranch?: boolean;
status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; status?: 'CREATED' | 'ACTIVE' | 'INACTIVE';
customerType?: CustomerType; customerType?: CustomerType;

View file

@ -251,23 +251,15 @@ export type QuotationFull = {
}; };
export type QuotationPayload = { export type QuotationPayload = {
service: [ productServiceList: [
{ {
work: [ vat: number;
{ pricePerUnit: number;
product: [ discount: number;
{ amount: number;
vat: number; // 0..1 productId: string;
discount: 1; // 0..1 workId: string;
amount: 0; // int serviceId: string;
id: string;
},
];
excluded: boolean;
id: string;
},
];
id: string;
}, },
]; ];
urgent: boolean; urgent: boolean;