refactor: add function
This commit is contained in:
parent
4428dad765
commit
5c8d783fe1
1 changed files with 24 additions and 0 deletions
|
|
@ -4,6 +4,10 @@ import { ref } from 'vue';
|
||||||
// NOTE at type
|
// NOTE at type
|
||||||
import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
|
import { QuotationPayload, EmployeeWorker } from 'src/stores/quotations/types';
|
||||||
|
|
||||||
|
import { useQuotationStore } from 'stores/quotations';
|
||||||
|
|
||||||
|
const quotationStore = useQuotationStore();
|
||||||
|
|
||||||
export const useQuotationForm = defineStore('form-quotation', () => {
|
export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
const defaultFormData: QuotationPayload = {
|
const defaultFormData: QuotationPayload = {
|
||||||
service: [
|
service: [
|
||||||
|
|
@ -52,6 +56,21 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
return JSON.stringify(resetData) !== JSON.stringify(currData);
|
return JSON.stringify(resetData) !== JSON.stringify(currData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetForm(clean = false) {
|
||||||
|
if (clean) {
|
||||||
|
currentFormData.value = structuredClone(defaultFormData);
|
||||||
|
resetFormData = structuredClone(defaultFormData);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentFormData.value = structuredClone(resetFormData);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function assignFormData(id: string) {}
|
||||||
|
|
||||||
|
function submiQuotationt() {}
|
||||||
|
|
||||||
function injectNewEmployee(data: EmployeeWorker) {
|
function injectNewEmployee(data: EmployeeWorker) {
|
||||||
currentFormData.value.worker.push({
|
currentFormData.value.worker.push({
|
||||||
alienReferencNumber: data.alienReferencNumber,
|
alienReferencNumber: data.alienReferencNumber,
|
||||||
|
|
@ -73,5 +92,10 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
currentFormData,
|
currentFormData,
|
||||||
|
|
||||||
injectNewEmployee,
|
injectNewEmployee,
|
||||||
|
isFormDataDifferent,
|
||||||
|
resetForm,
|
||||||
|
assignFormData,
|
||||||
|
|
||||||
|
submiQuotationt,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue