feat: request list => PropertiesExpansion display employee name
This commit is contained in:
parent
a19e75e17d
commit
187ca4db0f
2 changed files with 20 additions and 1 deletions
|
|
@ -13,7 +13,7 @@ import {
|
|||
|
||||
import { Attributes, RequestData } from 'src/stores/request-list/types';
|
||||
|
||||
import { getCustomerName } from 'src/stores/utils';
|
||||
import { getCustomerName, getEmployeeName } from 'src/stores/utils';
|
||||
import useOptionStore from 'src/stores/options';
|
||||
import { useRequestList } from 'src/stores/request-list';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
|
@ -84,6 +84,7 @@ function triggerEdit() {
|
|||
|
||||
function assignToForm() {
|
||||
const requestData = props.requestListData;
|
||||
// console.log(requestData);
|
||||
formRemark.value = attributes.value?.remark || '';
|
||||
formData.value = JSON.parse(
|
||||
JSON.stringify(attributes.value?.properties || {}),
|
||||
|
|
@ -91,6 +92,9 @@ function assignToForm() {
|
|||
formData.value['quotationNo'] = requestData.quotation.code;
|
||||
formData.value['contactPerson'] = requestData.quotation.contactName;
|
||||
formData.value['telephone'] = requestData.quotation.contactTel;
|
||||
formData.value['employee'] = getEmployeeName(requestData.employee, {
|
||||
locale: locale.value,
|
||||
});
|
||||
formData.value['employer'] = getCustomerName(
|
||||
requestData.quotation.customerBranch,
|
||||
{ locale: locale.value },
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import DialogDuplicateData from 'components/DialogDuplicateData.vue';
|
|||
import useOptionStore from '../options';
|
||||
import { CustomerBranch } from '../customer/types';
|
||||
import { CustomerBranchRelation } from '../quotations';
|
||||
import { Employee } from '../employee/types';
|
||||
|
||||
export const baseUrl = import.meta.env.VITE_API_BASE_URL;
|
||||
|
||||
|
|
@ -571,3 +572,17 @@ export function getCustomerName(
|
|||
(opts?.noCode ? '' : ' ' + `(${customer.code})`)
|
||||
);
|
||||
}
|
||||
|
||||
export function getEmployeeName(
|
||||
record: Employee,
|
||||
opts?: {
|
||||
locale?: string;
|
||||
},
|
||||
) {
|
||||
const employee = record;
|
||||
|
||||
return {
|
||||
['eng']: `${useOptionStore().mapOption(employee.namePrefix)} ${employee.firstNameEN} ${employee.lastNameEN}`,
|
||||
['tha']: `${useOptionStore().mapOption(employee.namePrefix)} ${employee.firstName} ${employee.lastName}`,
|
||||
}[opts?.locale || 'eng'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue