feat: type quotation

This commit is contained in:
Methapon Metanipat 2024-10-03 13:58:11 +07:00
parent ce9768bb0c
commit df6ff31450

View file

@ -1,7 +1,6 @@
import { Status } from '../types'; import { Status } from '../types';
export type Quotation = { type CustomerBranchRelation = {
customerBranch: {
customerCode?: string; customerCode?: string;
wageRateText: string; wageRateText: string;
wageRate: number; wageRate: number;
@ -59,82 +58,15 @@ export type Quotation = {
createdAt: string; createdAt: string;
updatedBy: string | null; updatedBy: string | null;
updatedAt: string; updatedAt: string;
};
worker: {
id: string;
quotationId: string;
employeeId: string;
code: string;
no: number;
}[];
service: {
_count: { work: number };
work: {
id: string;
serviceId: string;
name: string;
order: number;
attributes: any;
_count: { productOnWork: number };
}[];
id: string;
refServiceId: string; // Can be used to get image if still exists
quotationId: string;
code: string;
name: string;
detail: string;
attributes: any;
};
id: string;
finalPrice: number;
vatExcluded: number;
vat: number;
totalDiscount: number;
totalPrice: number;
urgent: boolean;
workerCount: number;
payBillDate: string | Date;
paySplitCount: number;
payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit';
date: string | Date;
dueDate: string | Date;
documentReceivePoint: string;
contactTel: string;
contactName: string;
workName: string;
actorName: string;
code: string;
statusOrder: number;
status: Status;
customerBranchId: string;
createdByUserId: string;
createdAt: string | Date;
updatedByUserId: string;
updatedAt: string | Date;
}; };
export type QuotationFull = { type EmployeeRelation = {
worker: {
id: string;
quotationId: string;
employeeId: string;
code: string;
no: number;
employee: {
workerStatus: string; workerStatus: string;
workerType: string; workerType: string;
nationality: string; nationality: string;
dateOfBirth: string; dateOfBirth: string;
nrcNo: string; nrcNo: string;
selectedImage: string; selectedImage?: string;
middleNameEN: string; middleNameEN: string;
middleName: string; middleName: string;
subDistrictId: string; subDistrictId: string;
@ -163,66 +95,143 @@ export type QuotationFull = {
status: Status; status: Status;
customerBranchId: string; customerBranchId: string;
id: string; id: string;
}; };
type ProductRelation = {
id: string;
code: string;
name: string;
detail: string;
process: number;
price: number;
agentPrice: number;
serviceCharge: number;
vatIncluded: boolean;
expenseType: string;
status: Status;
statusOrder: number;
shared: boolean;
remark: string;
selectedImage?: string;
productGroupId: string;
createdAt: string;
createdByUserId: string;
updatedAt: string;
updatedByUserId: string;
};
type WorkRelation = {
id: string;
order: number;
name: string;
attributes: any;
status: Status;
statusOrder: number;
serviceId: string;
createdAt: string;
createdByUserId?: string;
updatedAt: string;
updatedByUserId?: string;
};
type ServiceRelation = {
id: string;
code: string;
name: string;
detail: string;
attributes: any;
status: Status;
statusOrder: 0;
shared: string;
selectedImage?: string;
productGroupId: string;
createdAt: string;
createdByUserId: string;
updatedAt: string;
updatedByUserId: string;
};
export type Quotation = {
_count: { worker: number };
customerBranch: CustomerBranchRelation;
worker: {
id: string;
quotationId: string;
employeeId: string;
code: string;
no: number;
}[]; }[];
service: { productServiceList: {
_count: { work: number }; vat: number;
work: {
id: string;
serviceId: string;
name: string;
order: number;
attributes: any;
productOnWork: {
product: {
productGroupId: string;
shared: boolean;
expenseType: string;
vatIncluded: boolean;
serviceCharge: number;
agentPrice: number;
price: number;
process: number;
detail: string;
remark: string;
selectedImage: string;
name: string;
updatedByUserId: string;
updatedAt: string;
createdByUserId: string;
createdAt: string;
code: string;
statusOrder: 0;
status: Status;
id: string;
};
pricePerUnit: number; pricePerUnit: number;
discount: number; discount: number;
amount: number; amount: number;
productId: string; productId: string;
workId: string; workId: string;
order: number; serviceId: string;
vat: number; }[];
id: string;
finalPrice: number;
vat: number;
totalDiscount: number;
totalPrice: number;
urgent: boolean;
workerCount: number;
payBillDate: string | Date;
paySplitCount: number;
paySplit: {
date: string | Date;
amount: number;
}[];
payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit';
date: string | Date;
dueDate: string | Date;
documentReceivePoint: string;
contactTel: string;
contactName: string;
workName: string;
actorName: string;
code: string;
statusOrder: number;
status: Status;
customerBranchId: string;
createdByUserId: string;
createdAt: string | Date;
updatedByUserId: string;
updatedAt: string | Date;
};
export type QuotationFull = {
worker: {
id: string;
quotationId: string;
employeeId: string;
employee: EmployeeRelation;
code: string;
no: number;
}[];
productServiceList: {
vat: number;
pricePerUnit: number;
discount: number;
amount: number;
productId: string;
product: ProductRelation;
workId: string;
work: WorkRelation;
serviceId: string;
service: ServiceRelation;
}[]; }[];
_count: { productOnWork: number };
}[];
id: string;
refServiceId: string; // Can be used to get image if still exists
quotationId: string;
code: string;
name: string;
detail: string;
attributes: any;
};
id: string; id: string;
finalPrice: number; finalPrice: number;
vatExcluded: number;
vat: number; vat: number;
totalDiscount: number; totalDiscount: number;
totalPrice: number; totalPrice: number;
@ -262,7 +271,7 @@ export type QuotationPayload = {
}[]; }[];
urgent: boolean; urgent: boolean;
customerBranchId: string; customerBranchId: string;
worker: (string | EmployeeWorker)[]; worker: EmployeeWorker[];
workerCount: 0; workerCount: 0;
payBillDate: Date; payBillDate: Date;
paySplit: Date[]; paySplit: Date[];
@ -278,6 +287,7 @@ export type QuotationPayload = {
}; };
export type EmployeeWorker = { export type EmployeeWorker = {
id?: string;
alienReferencNumber: string; alienReferencNumber: string;
documentExpireDate: Date | undefined; documentExpireDate: Date | undefined;
lastNameEN: string; lastNameEN: string;