fix/feat: i18n/Show quotation contact on request list
This commit is contained in:
parent
26c9345699
commit
d446dba565
3 changed files with 52 additions and 49 deletions
|
|
@ -746,7 +746,7 @@ export default {
|
|||
title: 'ใบเสนอราคา',
|
||||
caption: 'ใบเสนอราคาทั้งหมด',
|
||||
customerName: 'ชื่อลูกค้า',
|
||||
actor: 'ผู้ที่ทำรายงาน',
|
||||
actor: 'ผู้ที่ทำรายการ',
|
||||
totalPrice: 'ยอดรวมสุทธิ',
|
||||
totalPriceBaht: 'ยอดรวมสุทธิ (บาท)',
|
||||
receipt: 'ใบเสร็จ/กำกับภาษี',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@ import DutyExpansion from './DutyExpansion.vue';
|
|||
import MessengerExpansion from './MessengerExpansion.vue';
|
||||
|
||||
// NOTE: Store
|
||||
import { baseUrl, dialog } from 'src/stores/utils';
|
||||
import {
|
||||
baseUrl,
|
||||
dialog,
|
||||
getEmployeeName,
|
||||
getCustomerName,
|
||||
} from 'src/stores/utils';
|
||||
import { dateFormatJS } from 'src/utils/datetime';
|
||||
import { useRequestList } from 'src/stores/request-list';
|
||||
import {
|
||||
|
|
@ -79,47 +84,6 @@ async function fetchRequestWorkList(opts: { requestDataId: string }) {
|
|||
}
|
||||
}
|
||||
|
||||
function getCustomerName(
|
||||
record: RequestData,
|
||||
opts?: {
|
||||
locale?: string;
|
||||
noCode?: boolean;
|
||||
},
|
||||
) {
|
||||
const customer = record.quotation.customerBranch;
|
||||
|
||||
return (
|
||||
{
|
||||
['CORP']: {
|
||||
[Lang.English]: customer.registerNameEN,
|
||||
[Lang.Thai]: customer.registerName,
|
||||
}[opts?.locale || 'eng'],
|
||||
['PERS']:
|
||||
{
|
||||
[Lang.English]: `${optionStore.mapOption(customer.namePrefix)} ${customer.firstNameEN} ${customer.lastNameEN}`,
|
||||
[Lang.Thai]: `${optionStore.mapOption(customer.namePrefix)} ${customer.firstName} ${customer.lastName}`,
|
||||
}[opts?.locale || Lang.English] || '-',
|
||||
}[customer.customer.customerType] +
|
||||
(opts?.noCode ? '' : ' ' + `(${customer.code})`)
|
||||
);
|
||||
}
|
||||
|
||||
function getEmployeeName(
|
||||
record: RequestData,
|
||||
opts?: {
|
||||
locale?: string;
|
||||
},
|
||||
) {
|
||||
const employee = record.employee;
|
||||
|
||||
return (
|
||||
{
|
||||
[Lang.English]: `${optionStore.mapOption(employee.namePrefix)} ${employee.firstNameEN} ${employee.lastNameEN}`,
|
||||
[Lang.Thai]: `${optionStore.mapOption(employee.namePrefix)} ${employee.firstName} ${employee.lastName}`,
|
||||
}[opts?.locale || Lang.English] || '-'
|
||||
);
|
||||
}
|
||||
|
||||
async function getData() {
|
||||
const current = route.params['requestListId'];
|
||||
|
||||
|
|
@ -611,8 +575,10 @@ function goToQuotation(
|
|||
icon="mdi-account-settings-outline"
|
||||
:label="$t('customer.employer')"
|
||||
:value="
|
||||
getCustomerName(data, { locale: locale, noCode: true }) ||
|
||||
'-'
|
||||
getCustomerName(data.quotation.customerBranch, {
|
||||
locale: locale,
|
||||
noCode: true,
|
||||
}) || '-'
|
||||
"
|
||||
/>
|
||||
<DataDisplay
|
||||
|
|
@ -620,7 +586,9 @@ function goToQuotation(
|
|||
icon="mdi-account-settings-outline"
|
||||
:label="$t('customer.employee')"
|
||||
:value="
|
||||
getEmployeeName(data, { locale: $i18n.locale }) || '-'
|
||||
getEmployeeName(data.employee, {
|
||||
locale: $i18n.locale,
|
||||
}) || '-'
|
||||
"
|
||||
/>
|
||||
<DataDisplay
|
||||
|
|
@ -631,6 +599,40 @@ function goToQuotation(
|
|||
/>
|
||||
<div v-if="$q.screen.gt.sm" class="col"></div>
|
||||
</div>
|
||||
<FormGroupHead class="col-12">
|
||||
{{ $t('general.contactName') }}
|
||||
</FormGroupHead>
|
||||
<div
|
||||
class="col-12 q-pa-sm"
|
||||
:class="{
|
||||
row: $q.screen.gt.sm,
|
||||
'column q-gutter-y-sm': $q.screen.lt.md,
|
||||
}"
|
||||
>
|
||||
<DataDisplay
|
||||
class="col"
|
||||
icon="mdi-account-settings-outline"
|
||||
:label="$t('quotation.actor')"
|
||||
:value="
|
||||
getEmployeeName(data.quotation?.createdBy, {
|
||||
locale: $i18n.locale,
|
||||
}) || '-'
|
||||
"
|
||||
/>
|
||||
<DataDisplay
|
||||
class="col"
|
||||
icon="mdi-account-settings-outline"
|
||||
:label="$t('quotation.contactName')"
|
||||
:value="data.quotation?.contactName || '-'"
|
||||
/>
|
||||
<DataDisplay
|
||||
class="col"
|
||||
icon="mdi-telephone-outline"
|
||||
:label="$t('general.telephone')"
|
||||
:value="data.quotation.contactTel || '-'"
|
||||
/>
|
||||
<div v-if="$q.screen.gt.sm" class="col"></div>
|
||||
</div>
|
||||
</section>
|
||||
</transition>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import useOptionStore from '../options';
|
|||
import { CustomerBranch } from '../customer/types';
|
||||
import { CustomerBranchRelation } from '../quotations';
|
||||
import { Employee } from '../employee/types';
|
||||
import { CreatedBy } from '../types';
|
||||
|
||||
export const baseUrl = import.meta.env.VITE_API_BASE_URL;
|
||||
|
||||
|
|
@ -596,7 +597,7 @@ export function getCustomerName(
|
|||
}
|
||||
|
||||
export function getEmployeeName(
|
||||
record: Employee,
|
||||
record: Employee | CreatedBy,
|
||||
opts?: {
|
||||
locale?: string;
|
||||
},
|
||||
|
|
@ -604,7 +605,7 @@ export function getEmployeeName(
|
|||
const employee = record;
|
||||
|
||||
return {
|
||||
['eng']: `${useOptionStore().mapOption(employee.namePrefix)} ${employee.firstNameEN} ${employee.lastNameEN}`,
|
||||
['tha']: `${useOptionStore().mapOption(employee.namePrefix)} ${employee.firstName} ${employee.lastName}`,
|
||||
['eng']: `${typeof employee.namePrefix === 'string' ? useOptionStore().mapOption(employee.namePrefix) : ''} ${employee.firstNameEN} ${employee.lastNameEN}`,
|
||||
['tha']: `${typeof employee.namePrefix === 'string' ? useOptionStore().mapOption(employee.namePrefix) : ''} ${employee.firstName} ${employee.lastName}`,
|
||||
}[opts?.locale || 'eng'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue