chore: format code

This commit is contained in:
Methapon2001 2024-07-08 11:21:00 +07:00
parent 37d19e8600
commit 4fa1188063
6 changed files with 98 additions and 122 deletions

View file

@ -1,6 +1,6 @@
import { boot } from 'quasar/wrappers'; import { boot } from 'quasar/wrappers';
import VueDatePicker from '@vuepic/vue-datepicker'; import VueDatePicker from '@vuepic/vue-datepicker';
import '@vuepic/vue-datepicker/dist/main.css' import '@vuepic/vue-datepicker/dist/main.css';
import GlobalDialog from 'components/GlobalDialog.vue'; import GlobalDialog from 'components/GlobalDialog.vue';
import GlobalLoading from 'components/GlobalLoading.vue'; import GlobalLoading from 'components/GlobalLoading.vue';

View file

@ -68,7 +68,7 @@ defineEmits<{
/> />
<q-btn <q-btn
:key="data.code" :key="data.code"
flat flat
round round
padding="xs" padding="xs"
@ -154,7 +154,6 @@ defineEmits<{
</q-btn> </q-btn>
</div> </div>
<!-- profile --> <!-- profile -->
<AppCircle <AppCircle
@ -163,8 +162,6 @@ defineEmits<{
style="border: 2px solid var(--border-color); overflow: visible" style="border: 2px solid var(--border-color); overflow: visible"
@click="$emit('editProfile')" @click="$emit('editProfile')"
> >
<q-img <q-img
:src="data.img ?? '/no-profile.png'" :src="data.img ?? '/no-profile.png'"
style=" style="
@ -174,15 +171,14 @@ defineEmits<{
border-radius: 50%; border-radius: 50%;
" "
> >
<template #error> <template #error>
<div <div
style="background: none" style="background: none"
class="full-width full-height items-center justify-center flex" class="full-width full-height items-center justify-center flex"
> >
<q-img src="/no-profile.png" width="5rem" /> <q-img src="/no-profile.png" width="5rem" />
</div> </div>
</template> </template>
</q-img> </q-img>
<div class="avatar__status"></div> <div class="avatar__status"></div>
</AppCircle> </AppCircle>

View file

@ -7,5 +7,5 @@ export default {
companyOwnerName: 'Company Owner Name', companyOwnerName: 'Company Owner Name',
corporation:'Corporation' corporation: 'Corporation',
}; };

View file

@ -7,6 +7,5 @@ export default {
companyOwnerName: 'ชื่อเจ้าของบริษัท', companyOwnerName: 'ชื่อเจ้าของบริษัท',
corporation:'ชื่อ บริษัท/นิติบุคคล' corporation: 'ชื่อ บริษัท/นิติบุคคล',
}; };

View file

@ -913,7 +913,7 @@ watch(locale, () => {
<q-table <q-table
flat flat
bordered bordered
:rows-per-page-options="[0]" :rows-per-page-options="[0]"
:rows=" :rows="
treeData treeData
.flatMap((v) => [v, ...v.branch]) .flatMap((v) => [v, ...v.branch])

View file

@ -68,7 +68,6 @@ const useMyBranch = useMyBranchStore();
const { fetchListOptionBranch } = useMyBranch; const { fetchListOptionBranch } = useMyBranch;
const columns = [ const columns = [
{ {
name: 'customerName', name: 'customerName',
@ -91,7 +90,6 @@ const columns = [
field: 'personName', field: 'personName',
}, },
{ {
name: 'telephoneNo', name: 'telephoneNo',
align: 'left', align: 'left',
@ -99,7 +97,7 @@ const columns = [
field: 'branch[0].telephoneNo', field: 'branch[0].telephoneNo',
}, },
{ {
name: 'branchEmail', name: 'branchEmail',
align: 'left', align: 'left',
label: 'formDialogInputEmail', label: 'formDialogInputEmail',
@ -107,7 +105,6 @@ const columns = [
}, },
] satisfies QTableProps['columns']; ] satisfies QTableProps['columns'];
const { const {
create, create,
getStatsCustomer, getStatsCustomer,
@ -171,57 +168,46 @@ const fieldSelectedCustomer = ref<{ label: string; value: string }>({
value: 'all', value: 'all',
}); });
const fieldDisplay = ref< const fieldDisplay = ref<
{ {
label: string; label: string;
value: string; value: string;
}[] }[]
>([ >([
{
label: t('corporation'),
value: 'customerName',
},
{ {
label: t('corporation'), label: t('type'),
value: 'customerName', value: 'customerType',
}, },
{ {
label: t('type'), label: t('name'),
value: 'customerType', value: 'personName',
}, },
{
label: t('name'),
value: 'personName',
},
{
label: t('telephone'),
value: 'telephoneNo',
},
{
label: t('formDialogInputEmail'),
value: 'branchEmail',
},
{
label: t('telephone'),
value: 'telephoneNo',
},
{
label: t('formDialogInputEmail'),
value: 'branchEmail',
},
]); ]);
const fieldSelected = ref< const fieldSelected = ref<
( (
| 'customerName' | 'customerName'
| 'customerType' | 'customerType'
| 'personName' | 'personName'
| 'telephoneNo' | 'telephoneNo'
| 'branchEmail' | 'branchEmail'
)[] )[]
>([ 'customerName', >(['customerName', 'customerType', 'personName', 'telephoneNo', 'branchEmail']);
'customerType',
'personName',
'telephoneNo',
'branchEmail']);
const splitterModel = ref(15); const splitterModel = ref(15);
const modeView = ref(true); const modeView = ref(true);
@ -865,8 +851,6 @@ async function toggleStatusEmployee(id: string, status: boolean) {
} }
async function toggleStatusCustomer(id: string, status: boolean) { async function toggleStatusCustomer(id: string, status: boolean) {
await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' }); await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
await fetchListCustomer(); await fetchListCustomer();
@ -1551,7 +1535,7 @@ watch([inputSearch, currentStatus], async () => {
></q-select> ></q-select>
<q-select <q-select
v-if="modeView === false" v-if="modeView === false"
id="select-field" id="select-field"
for="select-field" for="select-field"
:options="fieldDisplay" :options="fieldDisplay"
@ -1779,9 +1763,7 @@ watch([inputSearch, currentStatus], async () => {
} }
" "
> >
<q-td <q-td v-if="fieldSelected.includes('customerName')">
v-if="fieldSelected.includes('customerName')"
>
<div class="row items-center"> <div class="row items-center">
<div <div
:class="{ :class="{
@ -1799,17 +1781,18 @@ watch([inputSearch, currentStatus], async () => {
" "
> >
<div class="branch-card__icon"> <div class="branch-card__icon">
<q-avatar size="md"> <q-avatar size="md">
<q-img :src="props.row.imageUrl ?? '/no-profile.png'"> <q-img
:src="
props.row.imageUrl ?? '/no-profile.png'
"
>
<template #error> <template #error>
<q-img src="/no-profile.png"/> <q-img src="/no-profile.png" />
</template> </template>
</q-img>
</q-img>
</q-avatar> </q-avatar>
<!-- <q-icon <!-- <q-icon
size="md" size="md"
style="scale: 0.8" style="scale: 0.8"
@ -1818,38 +1801,37 @@ watch([inputSearch, currentStatus], async () => {
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<div class="col">{{ props.row.customerName || '-' }}</div> <div class="col">
{{ props.row.customerName || '-' }}
</div>
<div class="col app-text-muted"> <div class="col app-text-muted">
{{ props.row.customerNameEN || '-' }} {{ props.row.customerNameEN || '-' }}
</div> </div>
</div> </div>
</div> </div>
</q-td> </q-td>
<q-td <q-td v-if="fieldSelected.includes('customerType')">
v-if="fieldSelected.includes('customerType')"
>
<span <span
class="tags" class="tags"
:class="{
:class="{ [`tags__${props.row.customerType === 'CORP'? 'purple' : 'green'}`]: true }" [`tags__${props.row.customerType === 'CORP' ? 'purple' : 'green'}`]: true,
> }"
{{props.row.customerType === 'CORP' ? $t('customerLegalEntity') : $t('customerNaturalPerson')}} >
</span> {{
props.row.customerType === 'CORP'
? $t('customerLegalEntity')
: $t('customerNaturalPerson')
}}
</span>
</q-td> </q-td>
<q-td v-if="fieldSelected.includes('personName')"> <q-td v-if="fieldSelected.includes('personName')">
{{ props.row.personName }} {{ props.row.personName }}
</q-td> </q-td>
<q-td v-if="fieldSelected.includes('telephoneNo')"> <q-td v-if="fieldSelected.includes('telephoneNo')">
{{ props.row.branch[0].telephoneNo || '-' }} {{ props.row.branch[0].telephoneNo || '-' }}
</q-td> </q-td>
<q-td <q-td v-if="fieldSelected.includes('branchEmail')">
v-if="fieldSelected.includes('branchEmail')" {{ props.row.branch[0].email || '-' }}
>
{{ props.row.branch[0].email || '-' }}
</q-td> </q-td>
<q-td> <q-td>
<q-btn <q-btn
@ -1880,7 +1862,7 @@ watch([inputSearch, currentStatus], async () => {
@click.stop @click.stop
:key="props.row.id" :key="props.row.id"
> >
<q-menu class="bordered" > <q-menu class="bordered">
<q-list v-close-popup> <q-list v-close-popup>
<q-item <q-item
:id="`view-detail-btn-${props.row.name}-view`" :id="`view-detail-btn-${props.row.name}-view`"
@ -2009,7 +1991,6 @@ watch([inputSearch, currentStatus], async () => {
} }
" "
:model-value=" :model-value="
props.row.status !== 'INACTIVE' props.row.status !== 'INACTIVE'
" "
/> />
@ -2026,7 +2007,7 @@ watch([inputSearch, currentStatus], async () => {
<template v-slot:item="props"> <template v-slot:item="props">
<div class="col-3"> <div class="col-3">
<PersonCard <PersonCard
:field-selected="fieldSelected" :field-selected="fieldSelected"
history history
:data="{ :data="{
code: props.row.code, code: props.row.code,
@ -2050,39 +2031,39 @@ watch([inputSearch, currentStatus], async () => {
}" }"
@history="openHistory(props.row.id)" @history="openHistory(props.row.id)"
@update-card=" @update-card="
()=>{ () => {
if (!listCustomer) return; if (!listCustomer) return;
customerType = props.row.customerType customerType = props.row.customerType;
const { branch, ...payload } = props.row const { branch, ...payload } = props.row;
currentCustomer = payload currentCustomer = payload;
currentCustomerId = props.row.id currentCustomerId = props.row.id;
assignFormData(props.row.id) assignFormData(props.row.id);
infoDrawerEdit = true;
infoDrawerEdit = true openDialogInputForm('INFO', props.row.id);
openDialogInputForm('INFO', props.row.id) }
}
" "
@enter-card="()=>{ @enter-card="
currentCustomerName = props.row.customerName; () => {
customerType = props.row.customerType; currentCustomerName = props.row.customerName;
currentCustomerUrlImage = props.row.imageUrl; customerType = props.row.customerType;
currentCustomerId = props.row.id; currentCustomerUrlImage = props.row.imageUrl;
currentCustomerId = props.row.id;
const { branch, ...payload } = props.row; const { branch, ...payload } = props.row;
currentCustomer = payload; currentCustomer = payload;
isMainPage = false; isMainPage = false;
}" }
"
@delete-card="deleteCustomerById(props.row.id)" @delete-card="deleteCustomerById(props.row.id)"
@toggle-status=" @toggle-status="
toggleStatusCustomer( toggleStatusCustomer(
props.row.id, props.row.id,
props.row.status === 'ACTIVE' ? true : false, props.row.status === 'ACTIVE' ? true : false,
); )
" "
/> />
</div> </div>