fix: history updatedBy i18n

This commit is contained in:
puriphatt 2024-07-02 06:08:10 +00:00
parent 45aadfd7e6
commit 51f230bf93
2 changed files with 83 additions and 76 deletions

View file

@ -23,10 +23,10 @@ const columns: QTableColumn[] = [
headerStyle: 'font-weight: bold', headerStyle: 'font-weight: bold',
}, },
{ {
name: 'editBy', name: 'updatedBy',
align: 'center', align: 'center',
label: t('editBy'), label: t('editBy'),
field: 'editBy', field: 'updatedBy',
headerStyle: 'font-weight: bold', headerStyle: 'font-weight: bold',
}, },
@ -258,7 +258,6 @@ async function groupEmployeeHistory(
masterId: curr.masterId, masterId: curr.masterId,
updatedBy: curr.updatedBy, updatedBy: curr.updatedBy,
updatedByUserId: curr.updatedByUserId, updatedByUserId: curr.updatedByUserId,
timestamp: curr.timestamp,
updatedAt: updatedAt, updatedAt: updatedAt,
id: curr.id, id: curr.id,
history: [ history: [
@ -278,7 +277,6 @@ async function groupEmployeeHistory(
masterId: curr.masterId, masterId: curr.masterId,
updatedBy: curr.updatedBy, updatedBy: curr.updatedBy,
updatedByUserId: curr.updatedByUserId, updatedByUserId: curr.updatedByUserId,
timestamp: curr.timestamp,
updatedAt: updatedAt, updatedAt: updatedAt,
id: curr.id, id: curr.id,
history: [ history: [
@ -319,7 +317,7 @@ watch(
</script> </script>
<template> <template>
<div class="full-width"> <div class="col-12">
<div <div
class="row full-width justify-center q-py-sm header-border" class="row full-width justify-center q-py-sm header-border"
style="background: hsla(var(--info-bg) / 0.1)" style="background: hsla(var(--info-bg) / 0.1)"
@ -366,8 +364,8 @@ watch(
</div> </div>
</div> </div>
<div v-if="isHistoryData && currentData?.length > 0">
<q-table <q-table
v-if="isHistoryData && currentData?.length > 0"
flat flat
class="table-border" class="table-border"
table-header-class="surface-2" table-header-class="surface-2"
@ -384,15 +382,23 @@ watch(
{{ dateFormat(props.row.updatedAt, false, true, true) }} {{ dateFormat(props.row.updatedAt, false, true, true) }}
</q-td> </q-td>
<q-td key="editBy" :props="props"> <q-td key="updatedBy" :props="props">
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
<q-avatar class="surface-tab"> <q-avatar class="surface-tab">
<img v-if="false" src="https://cdn.quasar.dev/img/avatar.png" /> <img
v-if="false"
src="https://cdn.quasar.dev/img/avatar.png"
/>
<q-icon v-else name="mdi-account"></q-icon> <q-icon v-else name="mdi-account"></q-icon>
</q-avatar> </q-avatar>
<div class="column q-pl-md items-start"> <div class="column q-pl-md items-start">
<span class="text-weight-bold"> <span class="text-weight-bold">
{{ props.row.editBy ?? '-' }} {{
$i18n.locale === 'en-US'
? `${props.row.updatedBy.firstNameEN} ${props.row.updatedBy.lastNameEN}`
: `${props.row.updatedBy.firstName} ${props.row.updatedBy.lastName}` ??
'-'
}}
</span> </span>
<!-- <span class="text-caption">กบรหาร</span> --> <!-- <span class="text-caption">กบรหาร</span> -->
</div> </div>
@ -408,9 +414,7 @@ watch(
:title="$t(mapName(item.field).title)" :title="$t(mapName(item.field).title)"
:caption="$t(mapName(item.field).i18n)" :caption="$t(mapName(item.field).i18n)"
:icon="`mdi-numeric-${props.row.history.length - index}`" :icon="`mdi-numeric-${props.row.history.length - index}`"
> ></q-step>
asd
</q-step>
</q-stepper> </q-stepper>
</q-td> </q-td>
@ -444,6 +448,8 @@ watch(
</q-tr> </q-tr>
</template> </template>
</q-table> </q-table>
</div>
<div v-else class="table-border flex items-center justify-center q-py-lg"> <div v-else class="table-border flex items-center justify-center q-py-lg">
<NoData /> <NoData />
</div> </div>

View file

@ -179,5 +179,6 @@ export default {
formDialogEmployerRanchCode: 'Branch Code', formDialogEmployerRanchCode: 'Branch Code',
formTitleCustomer: 'Company {msg}', formTitleCustomer: 'Company {msg}',
formTitleCustomerNaturalPerson: 'Name {msg}',
formTitleBranch: 'Branch {msg}', formTitleBranch: 'Branch {msg}',
}; };