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';
export type Quotation = {
customerBranch: {
customerCode?: string;
wageRateText: string;
wageRate: number;
payDateEN: string;
payDate: string;
jobDescription: string;
jobPosition: string;
businessType: string;
agent: string;
contactName: string;
officeTel: string;
contactTel: string;
email: string;
subDistrictId: string;
districtId: string;
provinceId: string;
streetEN: string;
street: string;
mooEN: string;
moo: string;
soiEN: string;
soi: string;
addressEN: string;
address: string;
employmentOfficeEN: string;
employmentOffice: string;
homeCode: string;
authorizedNameEN: string;
authorizedName: string;
authorizedCapital: string;
registerDate: string | Date | null;
registerNameEN: string;
registerName: string;
legalPersonNo: string;
citizenId: string;
birthDate: string;
gender: string;
lastNameEN: string;
lastName: string;
firstNameEN: string;
firstName: string;
namePrefix: string;
telephoneNo: string;
codeCustomer: string;
customerName: string;
updatedByUserId: string;
createdByUserId: string;
code: string;
statusOrder: 0;
customerId: string;
id: string;
type CustomerBranchRelation = {
customerCode?: string;
wageRateText: string;
wageRate: number;
payDateEN: string;
payDate: string;
jobDescription: string;
jobPosition: string;
businessType: string;
agent: string;
contactName: string;
officeTel: string;
contactTel: string;
email: string;
subDistrictId: string;
districtId: string;
provinceId: string;
streetEN: string;
street: string;
mooEN: string;
moo: string;
soiEN: string;
soi: string;
addressEN: string;
address: string;
employmentOfficeEN: string;
employmentOffice: string;
homeCode: string;
authorizedNameEN: string;
authorizedName: string;
authorizedCapital: string;
registerDate: string | Date | null;
registerNameEN: string;
registerName: string;
legalPersonNo: string;
citizenId: string;
birthDate: string;
gender: string;
lastNameEN: string;
lastName: string;
firstNameEN: string;
firstName: string;
namePrefix: string;
telephoneNo: string;
codeCustomer: string;
customerName: string;
updatedByUserId: string;
createdByUserId: string;
code: string;
statusOrder: 0;
customerId: string;
id: string;
status: Status;
createdBy: string | null;
createdAt: string;
updatedBy: string | null;
updatedAt: string;
};
status: Status;
createdBy: string | null;
createdAt: string;
updatedBy: string | null;
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: {
id: string;
@ -69,31 +164,18 @@ export type Quotation = {
no: number;
}[];
service: {
_count: { work: number };
productServiceList: {
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;
finalPrice: number;
vatExcluded: number;
vat: number;
totalDiscount: number;
totalPrice: number;
@ -101,6 +183,10 @@ export type Quotation = {
workerCount: number;
payBillDate: string | Date;
paySplitCount: number;
paySplit: {
date: string | Date;
amount: number;
}[];
payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit';
date: string | Date;
dueDate: string | Date;
@ -126,103 +212,26 @@ export type QuotationFull = {
id: string;
quotationId: string;
employeeId: string;
employee: EmployeeRelation;
code: string;
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: {
_count: { work: number };
productServiceList: {
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;
finalPrice: number;
vatExcluded: number;
vat: number;
totalDiscount: number;
totalPrice: number;
@ -262,7 +271,7 @@ export type QuotationPayload = {
}[];
urgent: boolean;
customerBranchId: string;
worker: (string | EmployeeWorker)[];
worker: EmployeeWorker[];
workerCount: 0;
payBillDate: Date;
paySplit: Date[];
@ -278,6 +287,7 @@ export type QuotationPayload = {
};
export type EmployeeWorker = {
id?: string;
alienReferencNumber: string;
documentExpireDate: Date | undefined;
lastNameEN: string;