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,65 +1,160 @@
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; payDateEN: string;
payDateEN: string; payDate: string;
payDate: string; jobDescription: string;
jobDescription: string; jobPosition: string;
jobPosition: string; businessType: string;
businessType: string; agent: string;
agent: string; contactName: string;
contactName: string; officeTel: string;
officeTel: string; contactTel: string;
contactTel: string; email: string;
email: string; subDistrictId: string;
subDistrictId: string; districtId: string;
districtId: string; provinceId: string;
provinceId: string; streetEN: string;
streetEN: string; street: string;
street: string; mooEN: string;
mooEN: string; moo: string;
moo: string; soiEN: string;
soiEN: string; soi: string;
soi: string; addressEN: string;
addressEN: string; address: string;
address: string; employmentOfficeEN: string;
employmentOfficeEN: string; employmentOffice: string;
employmentOffice: string; homeCode: string;
homeCode: string; authorizedNameEN: string;
authorizedNameEN: string; authorizedName: string;
authorizedName: string; authorizedCapital: string;
authorizedCapital: string; registerDate: string | Date | null;
registerDate: string | Date | null; registerNameEN: string;
registerNameEN: string; registerName: string;
registerName: string; legalPersonNo: string;
legalPersonNo: string; citizenId: string;
citizenId: string; birthDate: string;
birthDate: string; gender: string;
gender: string; lastNameEN: string;
lastNameEN: string; lastName: string;
lastName: string; firstNameEN: string;
firstNameEN: string; firstName: string;
firstName: string; namePrefix: string;
namePrefix: string; telephoneNo: string;
telephoneNo: string; codeCustomer: string;
codeCustomer: string; customerName: string;
customerName: string; updatedByUserId: string;
updatedByUserId: string; createdByUserId: string;
createdByUserId: string; code: string;
code: string; statusOrder: 0;
statusOrder: 0; customerId: string;
customerId: string; id: string;
id: string;
status: Status; status: Status;
createdBy: string | null; createdBy: string | null;
createdAt: string; createdAt: string;
updatedBy: string | null; updatedBy: string | null;
updatedAt: string; updatedAt: string;
}; };
type EmployeeRelation = {
workerStatus: string;
workerType: string;
nationality: string;
dateOfBirth: string;
nrcNo: string;
selectedImage?: string;
middleNameEN: string;
middleName: string;
subDistrictId: string;
districtId: string;
provinceId: string;
streetEN: string;
street: string;
mooEN: string;
moo: string;
soiEN: string;
soi: string;
addressEN: string;
address: string;
gender: string;
lastNameEN: string;
lastName: string;
firstNameEN: string;
firstName: string;
namePrefix: string;
updatedByUserId: string;
updatedAt: string;
createdByUserId: string;
createdAt: string;
code: string;
statusOrder: 0;
status: Status;
customerBranchId: 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: { worker: {
id: string; id: string;
@ -69,31 +164,18 @@ export type Quotation = {
no: number; no: number;
}[]; }[];
service: { productServiceList: {
_count: { work: number }; vat: number;
pricePerUnit: number;
discount: number;
amount: number;
productId: string;
workId: string;
serviceId: string;
}[];
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; id: string;
finalPrice: number; finalPrice: number;
vatExcluded: number;
vat: number; vat: number;
totalDiscount: number; totalDiscount: number;
totalPrice: number; totalPrice: number;
@ -101,6 +183,10 @@ export type Quotation = {
workerCount: number; workerCount: number;
payBillDate: string | Date; payBillDate: string | Date;
paySplitCount: number; paySplitCount: number;
paySplit: {
date: string | Date;
amount: number;
}[];
payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit';
date: string | Date; date: string | Date;
dueDate: string | Date; dueDate: string | Date;
@ -126,103 +212,26 @@ export type QuotationFull = {
id: string; id: string;
quotationId: string; quotationId: string;
employeeId: string; employeeId: string;
employee: EmployeeRelation;
code: string; code: string;
no: number; no: number;
employee: {
workerStatus: string;
workerType: string;
nationality: string;
dateOfBirth: string;
nrcNo: string;
selectedImage: string;
middleNameEN: string;
middleName: string;
subDistrictId: string;
districtId: string;
provinceId: string;
streetEN: string;
street: string;
mooEN: string;
moo: string;
soiEN: string;
soi: string;
addressEN: string;
address: string;
gender: string;
lastNameEN: string;
lastName: string;
firstNameEN: string;
firstName: string;
namePrefix: string;
updatedByUserId: string;
updatedAt: string;
createdByUserId: string;
createdAt: string;
code: string;
statusOrder: 0;
status: Status;
customerBranchId: string;
id: string;
};
}[]; }[];
service: { productServiceList: {
_count: { work: number }; vat: number;
pricePerUnit: number;
discount: number;
amount: number;
productId: string;
product: ProductRelation;
workId: string;
work: WorkRelation;
serviceId: string;
service: ServiceRelation;
}[];
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;
discount: number;
amount: number;
productId: string;
workId: string;
order: number;
vat: number;
}[];
_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;