diff --git a/src/components/button/ImportButton.vue b/src/components/button/ImportButton.vue new file mode 100644 index 00000000..363bb0c3 --- /dev/null +++ b/src/components/button/ImportButton.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/components/button/ViewButton.vue b/src/components/button/ViewButton.vue index 070a268f..33d3868e 100644 --- a/src/components/button/ViewButton.vue +++ b/src/components/button/ViewButton.vue @@ -10,7 +10,6 @@ defineProps<{ outlined?: boolean; disabled?: boolean; dark?: boolean; - size?: string; }>(); diff --git a/src/components/button/index.ts b/src/components/button/index.ts index 8d873594..d9b59582 100644 --- a/src/components/button/index.ts +++ b/src/components/button/index.ts @@ -13,3 +13,4 @@ export { default as ViewButton } from './ViewButton.vue'; export { default as PrintButton } from './PrintButton.vue'; export { default as StateButton } from './StateButton.vue'; export { default as NextButton } from './NextButton.vue'; +export { default as ImportButton } from './ImportButton.vue'; diff --git a/src/components/shared/PersonCard.vue b/src/components/shared/PersonCard.vue index f93c61c5..3abc14b0 100644 --- a/src/components/shared/PersonCard.vue +++ b/src/components/shared/PersonCard.vue @@ -99,6 +99,7 @@ defineEmits<{ diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 825b232f..bd4f4d76 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -136,6 +136,7 @@ export default { unavailable: 'Unavailable', selected: 'Selected {number} {msg}', next: 'Next', + import: 'Import', }, menu: { diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 03678769..27836036 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -135,6 +135,7 @@ export default { individual: 'รายบุคคล', unavailable: 'ไม่พร้อมใช้งาน', selected: '{number} {msg}ถูกเลือก', + import: 'นำเข้า', next: 'ถัดไป', }, diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 13784e9f..4dfdc1cb 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -74,6 +74,7 @@ import { import QuotationFormReceipt from './QuotationFormReceipt.vue'; import QuotationFormProductSelect from './QuotationFormProductSelect.vue'; import QuotationFormInfo from './QuotationFormInfo.vue'; +import QuotationFormWorkerAddDialog from './QuotationFormWorkerAddDialog.vue'; import ProfileBanner from 'components/ProfileBanner.vue'; import DialogForm from 'components/DialogForm.vue'; import { @@ -119,6 +120,7 @@ const optionStore = useOptionStore(); const { t, locale } = useI18n(); const ocrStore = useOcrStore(); const $q = useQuasar(); +const openQuotation = ref(false); const { currentFormData: quotationFormData, @@ -174,7 +176,6 @@ const selectedInstallmentNo = ref([]); const installmentAmount = ref(0); const selectedInstallment = ref(); const agentPrice = ref(false); - const attachmentData = ref< { name: string; @@ -415,6 +416,8 @@ async function fetchQuotation() { ); } + assignWorkerToSelectedWorker(); + await assignToProductServiceList(); await fetchStatus(); @@ -1416,10 +1419,28 @@ async function getWorkerFromCriteria( @@ -2733,6 +2754,18 @@ async function getWorkerFromCriteria( + + diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts index 8d9c7f4e..0038e3e0 100644 --- a/src/stores/quotations/index.ts +++ b/src/stores/quotations/index.ts @@ -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'; diff --git a/src/stores/quotations/types.ts b/src/stores/quotations/types.ts index af1ca691..353e3c37 100644 --- a/src/stores/quotations/types.ts +++ b/src/stores/quotations/types.ts @@ -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[]; +}[];