feat: add quotation form state
This commit is contained in:
parent
31fd37a503
commit
19825019bf
1 changed files with 10 additions and 1 deletions
|
|
@ -31,6 +31,11 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
let resetFormData = structuredClone(defaultFormData);
|
let resetFormData = structuredClone(defaultFormData);
|
||||||
|
|
||||||
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
||||||
|
const currentFormState = ref<{
|
||||||
|
mode: null | 'info' | 'create' | 'edit';
|
||||||
|
}>({
|
||||||
|
mode: null,
|
||||||
|
});
|
||||||
|
|
||||||
function isFormDataDifferent() {
|
function isFormDataDifferent() {
|
||||||
const { ...resetData } = resetFormData;
|
const { ...resetData } = resetFormData;
|
||||||
|
|
@ -54,9 +59,13 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
||||||
const data = await quotationStore.getQuotation(id);
|
const data = await quotationStore.getQuotation(id);
|
||||||
|
|
||||||
if (!data) return; // NOTE: Error should be handled globally by axios instance
|
if (!data) return; // NOTE: Error should be handled globally by axios instance
|
||||||
|
|
||||||
|
currentFormState.value.mode = 'edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
function submiQuotationt() {}
|
function submiQuotationt() {
|
||||||
|
currentFormState.value.mode = 'info';
|
||||||
|
}
|
||||||
|
|
||||||
function injectNewEmployee(data: EmployeeWorker) {
|
function injectNewEmployee(data: EmployeeWorker) {
|
||||||
currentFormData.value.worker.push({
|
currentFormData.value.worker.push({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue