feat: quotation add worker after accepted (#140)

* feat: add dialog structure

* feat: add select functionality

* chore: clear unused

* feat: pass selectable product into dialog

* feat: add table

* feat: implement select worker and product

* feat: send disabled worker into component

* feat: add event emitted after submit

* chore: cleanup

* feat: add store

* feat: dialogquotationbtn

* feat: import worker from file and select them all

* feat: add title

* feat: add import button

* feat: i18n

* feat: lazy load person card image

* refactor: change import button color

* feat: add import worker button

* chore: cleanup

* chore: clean

* chore: clean

* feat: post quotation add worker appear on expired

* fix: type

* fix: only proceed when import has at least one

* feat: check more condition

* feat: fetch data from api

* fix: worker not update

---------

Co-authored-by: Methapon2001 <61303214+Methapon2001@users.noreply.github.com>
Co-authored-by: nwpptrs <jay02499@gmail.com>
This commit is contained in:
Methapon Metanipat 2024-12-17 14:22:22 +07:00 committed by GitHub
parent 79d132f49e
commit 4528836f17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 702 additions and 12 deletions

View file

@ -11,6 +11,7 @@ import {
QuotationStats,
PaymentPayload,
QuotationStatus,
QuotationAddWorkerPayload,
} from './types';
import { PaginationResult } from 'src/types';
@ -151,6 +152,18 @@ export const useQuotationStore = defineStore('quotation-store', () => {
return null;
}
/** This is meant to be use after quotation was accepted */
async function addQuotationWorker(
id: string,
payload: QuotationAddWorkerPayload,
) {
const res = await api.post(`/quotation/${id}/add-worker`, payload);
if (res.status < 400) {
return res.data;
}
return null;
}
const fileManager = manageAttachment(api, 'quotation');
return {
@ -166,6 +179,7 @@ export const useQuotationStore = defineStore('quotation-store', () => {
editQuotation,
deleteQuotation,
changeStatus,
addQuotationWorker,
...fileManager,
};
@ -209,3 +223,5 @@ export const useQuotationPayment = defineStore('quotation-payment', () => {
...fileManager,
};
});
export * from './types.ts';

View file

@ -273,6 +273,7 @@ export type QuotationFull = {
}[];
productServiceList: {
id: string;
vat: number;
pricePerUnit: number;
discount: number;
@ -318,15 +319,7 @@ export type QuotationFull = {
code: string;
statusOrder: number;
status: Status;
quotationStatus:
| 'Issued'
| 'Accepted'
| 'Invoice'
| 'PaymentPending'
| 'PaymentInProcess'
| 'PaymentSuccess'
| 'ProcessComplete'
| 'Canceled';
quotationStatus: QuotationStatus;
customerBranchId: string;
customerBranch: CustomerBranchRelation;
@ -429,6 +422,7 @@ export type PaymentPayload = {
};
export type ProductServiceList = {
id?: string;
workerIndex: number[];
vat?: number;
pricePerUnit?: number;
@ -447,3 +441,8 @@ export type PaySplit = {
invoice?: boolean;
invoiceId?: string;
};
export type QuotationAddWorkerPayload = {
workerId: string;
productServiceId: string[];
}[];