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);
|
||||
|
||||
const currentFormData = ref<QuotationPayload>(structuredClone(resetFormData));
|
||||
const currentFormState = ref<{
|
||||
mode: null | 'info' | 'create' | 'edit';
|
||||
}>({
|
||||
mode: null,
|
||||
});
|
||||
|
||||
function isFormDataDifferent() {
|
||||
const { ...resetData } = resetFormData;
|
||||
|
|
@ -54,9 +59,13 @@ export const useQuotationForm = defineStore('form-quotation', () => {
|
|||
const data = await quotationStore.getQuotation(id);
|
||||
|
||||
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) {
|
||||
currentFormData.value.worker.push({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue