feat: quotation view

This commit is contained in:
Methapon Metanipat 2024-09-30 15:03:36 +07:00
parent 02b2f6aa5c
commit 5d1d1f36e0
3 changed files with 155 additions and 19 deletions

View file

@ -10,6 +10,7 @@ export const useQuotationStore = defineStore('quotation-store', () => {
const data = ref<Quotation[]>([]);
const page = ref<number>(1);
const pageMax = ref<number>(1);
const pageSize = ref<number>(30);
async function getQuotation(id: string) {
const res = await api.get<QuotationFull>(`/quotation/${id}`);
@ -19,8 +20,20 @@ export const useQuotationStore = defineStore('quotation-store', () => {
return null;
}
async function getQuotationList() {
const res = await api.get<PaginationResult<Quotation>>('/quotation');
async function getQuotationList(opts?: {
page?: number;
pageSize?: number;
payCondition?: 'Full' | 'Split' | 'BillFull' | 'BillSplit';
}) {
const params = new URLSearchParams();
for (const [k, v] of Object.entries(opts || {})) {
if (v !== undefined) params.append(k, v.toString());
}
const query = params.toString();
const res = await api.get<PaginationResult<Quotation>>(
`/quotation?${query}`,
);
if (res.status < 400) {
return res.data;
}
@ -57,6 +70,7 @@ export const useQuotationStore = defineStore('quotation-store', () => {
return {
data,
page,
pageSize,
pageMax,
getQuotation,
getQuotationList,

View file

@ -1,6 +1,66 @@
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;
status: Status;
createdBy: string | null;
createdAt: string;
updatedBy: string | null;
updatedAt: string;
};
worker: {
id: string;
quotationId: string;