refactor: wrong code
This commit is contained in:
parent
284028aff0
commit
362cb7c15a
1 changed files with 9 additions and 14 deletions
|
|
@ -1,26 +1,17 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
// NOTE at type
|
// NOTE: Import types
|
||||||
import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
|
import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
|
||||||
|
|
||||||
|
// NOTE: Import stores
|
||||||
import { useQuotationStore } from 'stores/quotations';
|
import { useQuotationStore } from 'stores/quotations';
|
||||||
|
|
||||||
export const useQuotationForm = defineStore('form-quotation', () => {
|
export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
const quotationStore = useQuotationStore();
|
const quotationStore = useQuotationStore();
|
||||||
|
|
||||||
const defaultFormData: QuotationPayload = {
|
const defaultFormData: QuotationPayload = {
|
||||||
productServiceList: [
|
productServiceList: [],
|
||||||
{
|
|
||||||
vat: 0,
|
|
||||||
pricePerUnit: 0,
|
|
||||||
discount: 0,
|
|
||||||
amount: 0,
|
|
||||||
productId: '',
|
|
||||||
workId: '',
|
|
||||||
serviceId: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
urgent: false,
|
urgent: false,
|
||||||
customerBranchId: '',
|
customerBranchId: '',
|
||||||
worker: [],
|
worker: [],
|
||||||
|
|
@ -37,7 +28,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
actorName: '',
|
actorName: '',
|
||||||
status: 'CREATED',
|
status: 'CREATED',
|
||||||
};
|
};
|
||||||
const resetFormData = structuredClone(defaultFormData);
|
let resetFormData = structuredClone(defaultFormData);
|
||||||
|
|
||||||
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
||||||
|
|
||||||
|
|
@ -59,7 +50,11 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
currentFormData.value = structuredClone(resetFormData);
|
currentFormData.value = structuredClone(resetFormData);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function assignFormData(id: string) {}
|
async function assignFormData(id: string) {
|
||||||
|
const data = await quotationStore.getQuotation(id);
|
||||||
|
|
||||||
|
if (!data) return; // NOTE: Error should be handled globally by axios instance
|
||||||
|
}
|
||||||
|
|
||||||
function submiQuotationt() {}
|
function submiQuotationt() {}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue