feat: add function submit
This commit is contained in:
parent
9c34172422
commit
84f5a06874
2 changed files with 36 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
|
|||
// NOTE: Import stores
|
||||
import { useQuotationStore } from 'stores/quotations';
|
||||
|
||||
const DEFAULT_DATA: QuotationPayload & { id?: string } = {
|
||||
const DEFAULT_DATA: QuotationPayload = {
|
||||
productServiceList: [],
|
||||
urgent: false,
|
||||
customerBranchId: '',
|
||||
|
|
@ -32,7 +32,9 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
let resetFormData = structuredClone(DEFAULT_DATA);
|
||||
|
||||
const currentTreeData = ref();
|
||||
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
||||
const currentFormData = ref<QuotationPayload & { id?: string }>(
|
||||
structuredClone(resetFormData),
|
||||
);
|
||||
const currentFormState = ref<{
|
||||
mode: null | 'info' | 'create' | 'edit';
|
||||
}>({
|
||||
|
|
@ -77,7 +79,17 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
currentFormState.value.mode = mode;
|
||||
}
|
||||
|
||||
function submitQuotation() {
|
||||
async function submitQuotation() {
|
||||
if (currentFormState.value.mode === 'create') {
|
||||
// await quotationStore.createQuotation();
|
||||
}
|
||||
if (currentFormState.value.mode === 'edit' && currentFormData.value.id) {
|
||||
// await quotationStore.editQuotation({
|
||||
// id: currentFormData.value.id,
|
||||
// ...currentFormData.value,
|
||||
// });
|
||||
}
|
||||
|
||||
currentFormState.value.mode = 'info';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue