feat: show real actor

This commit is contained in:
Methapon Metanipat 2024-10-16 13:10:58 +07:00
parent 5ee4deda98
commit f01e3d4ca9
2 changed files with 17 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import {
// NOTE: Import stores
import { useQuotationStore } from 'stores/quotations';
import useEmployeeStore from 'stores/employee';
import { getName } from 'src/services/keycloak';
const DEFAULT_DATA: QuotationPayload = {
productServiceList: [],
@ -68,8 +69,10 @@ export const useQuotationForm = defineStore('form-quotation', () => {
);
const currentFormState = ref<{
mode: null | 'info' | 'create' | 'edit';
createdBy: (locale: string) => string;
}>({
mode: null,
createdBy: (_) => getName() || '',
});
function isFormDataDifferent() {
@ -115,6 +118,10 @@ export const useQuotationForm = defineStore('form-quotation', () => {
currentFormData.value = structuredClone(resetFormData);
currentFormState.value.createdBy = (locale) =>
locale === 'eng'
? data.createdBy.firstNameEN + ' ' + data.createdBy.lastNameEN
: data.createdBy.firstName + ' ' + data.createdBy.lastName;
currentFormState.value.mode = mode;
}
@ -149,6 +156,7 @@ export const useQuotationForm = defineStore('form-quotation', () => {
}
currentFormState.value.mode = 'info';
currentFormState.value.createdBy = (_) => getName() || '';
}
function injectNewEmployee(