fix: 01 layout & responsive tool bar

This commit is contained in:
puriphatt 2024-07-16 02:52:38 +00:00
parent 503e8ed0a3
commit 2997c7ff59

View file

@ -26,6 +26,7 @@ import { BranchWithChildren, BranchCreate } from 'stores/branch/types';
import { watch } from 'vue';
import { useI18n } from 'vue-i18n';
import useFlowStore from 'src/stores/flow';
import { Status } from 'src/stores/types';
const { t } = useI18n();
const utilsStore = useUtilsStore();
@ -63,6 +64,7 @@ const columns = [
const modal = ref<boolean>(false);
const hideStat = ref(false);
const currentStatus = ref<Status | 'All'>('All');
const profileFileImg = ref<File | undefined>(undefined);
const imageUrl = ref<string | null>('');
@ -524,7 +526,7 @@ watch(locale, () => {
/>
</transition>
<div class="column col surface-1 rounded" :no-padding="!!branchData.total">
<div class="col surface-2 rounded" :no-padding="!!branchData.total">
<template v-if="!branchData.total">
<TooltipComponent
class="self-end"
@ -540,18 +542,20 @@ watch(locale, () => {
/>
</div>
</template>
<template v-else>
<div class="row" style="flex-grow: 1; flex-wrap: nowrap">
<div class="full-height column" style="flex-grow: 1; flex-wrap: nowrap">
<q-splitter
v-model="splitterModel"
:limits="[0, 100]"
style="width: 100%"
class="col"
>
<template v-slot:before>
<div class="rounded surface-1 column" style="height: 100%">
<div class="surface-1 column full-height">
<div
class="row bordered-b q-pl-sm text-weight-bold surface-2 items-center"
style="height: 50px"
class="row bordered-b text-weight-bold surface-3 items-center q-px-md q-py-sm"
:style="`min-height: ${$q.screen.gt.sm ? '57px' : '100.8px'}`"
>
<div class="col">จัดการสาขาทั้งหมด</div>
@ -584,8 +588,8 @@ watch(locale, () => {
</q-btn>
</div>
<div class="col" style="position: relative">
<div class="scroll" style="position: absolute; inset: 0">
<div class="col">
<div class="scroll">
<q-tree
:nodes="treeData"
node-key="id"
@ -775,82 +779,47 @@ watch(locale, () => {
</template>
<template v-slot:after>
<div class="column" style="height: 100%">
<div class="column full-height">
<div
class="row justify-between q-pl-md items-center surface-2 bordered-b q-pr-md"
style="height: 50px"
class="row q-py-sm q-px-md justify-between full-width surface-3 bordered-b"
>
<div class="col-6">
<q-input
for="input-Search"
style="width: 250px"
:label-color="$q.dark.isActive ? 'white' : 'grey-10'"
for="input-search"
outlined
dense
label="ค้นหา"
:label="$t('search')"
class="q-mr-md col-12 col-md-4"
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
v-model="inputSearch"
debounce="500"
></q-input>
</div>
debounce="200"
>
<template v-slot:prepend>
<q-icon name="mdi-magnify" />
</template>
</q-input>
<div class="col-6 row q-gutter-x-sm justify-end text-right">
<q-btn-dropdown
class="bordered rounded surface-1"
<div
class="row col-12 col-md-6"
:class="{ 'q-pt-xs': $q.screen.lt.md }"
>
<q-select
v-model="statusFilter"
outlined
dense
unelevated
:label="labelBtnStatus"
>
<q-list>
<q-item
clickable
v-close-popup
@click="
async () => {
labelBtnStatus = $t('all');
statusFilter = 'all';
}
"
>
<q-item-section>
<q-item-label>{{ $t('all') }}</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="
async () => {
labelBtnStatus = $t('statusACTIVE');
statusFilter = 'statusACTIVE';
}
"
>
<q-item-section>
<q-item-label>
{{ $t('statusACTIVE') }}
</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="
async () => {
labelBtnStatus = $t('statusINACTIVE');
statusFilter = 'statusINACTIVE';
}
"
>
<q-item-section>
<q-item-label>
{{ $t('statusINACTIVE') }}
</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
option-value="value"
option-label="label"
class="col"
map-options
emit-value
:options="[
{ label: $t('all'), value: 'all' },
{ label: $t('statusACTIVE'), value: 'statusACTIVE' },
{
label: $t('statusINACTIVE'),
value: 'statusINACTIVE',
},
]"
></q-select>
<q-select
id="select-field"
@ -859,6 +828,7 @@ watch(locale, () => {
fieldDisplay.map((v) => ({ label: $t(v), value: v }))
"
:display-value="$t('displayField')"
class="col q-mx-sm"
v-model="fieldSelected"
option-label="label"
option-value="value"
@ -870,8 +840,8 @@ watch(locale, () => {
/>
<q-btn-toggle
v-model="modeView"
id="btn-mode"
v-model="modeView"
dense
class="no-shadow bordered rounded surface-1"
:toggle-color="$q.dark.isActive ? 'grey-9' : 'grey-2'"
@ -916,10 +886,10 @@ watch(locale, () => {
</q-btn-toggle>
</div>
</div>
<div style="position: relative; flex: 1">
<div
style="position: absolute; inset: 0"
class="scroll q-pa-md"
class="q-pa-md col scroll"
style="background-color: transparent; overflow-x: auto"
>
<q-table
flat
@ -953,8 +923,7 @@ watch(locale, () => {
) {
return true;
}
if (fieldSelectedBranch.value === 'all')
return true;
if (fieldSelectedBranch.value === 'all') return true;
if (fieldSelectedBranch.value === 'branchHQLabel')
return v.isHeadOffice;
if (fieldSelectedBranch.value === 'branchLabel')
@ -971,7 +940,7 @@ watch(locale, () => {
:visible-columns="fieldSelected"
>
<template v-slot:header="props">
<q-tr class="surface-2" :props="props">
<q-tr class="surface-3" :props="props">
<q-th
v-for="col in props.cols"
:key="col.name"
@ -992,7 +961,10 @@ watch(locale, () => {
:props="props"
@click="
() => {
if (props.row.isHeadOffice && props.row._count.branch !==0) {
if (
props.row.isHeadOffice &&
props.row._count.branch !== 0
) {
fieldSelectedBranch.value = '';
inputSearch = '';
currentHq = {
@ -1007,9 +979,7 @@ watch(locale, () => {
}
"
>
<q-td
v-if="fieldSelected.includes('branchLabelName')"
>
<q-td v-if="fieldSelected.includes('branchLabelName')">
<div class="row items-center">
<div
:class="{
@ -1050,9 +1020,7 @@ watch(locale, () => {
<q-td v-if="fieldSelected.includes('branchLabelTel')">
{{ props.row.contact[0]?.telephoneNo || '-' }}
</q-td>
<q-td
v-if="fieldSelected.includes('branchLabelType')"
>
<q-td v-if="fieldSelected.includes('branchLabelType')">
{{
props.row.isHeadOffice
? $t('branchHQLabel')
@ -1060,8 +1028,6 @@ watch(locale, () => {
}}
</q-td>
<q-td>
<q-btn
icon="mdi-dots-vertical"
size="sm"
@ -1101,9 +1067,7 @@ watch(locale, () => {
size="xs"
style="color: hsl(var(--green-6-hsl))"
/>
<span
class="col-9 q-px-md flex items-center"
>
<span class="col-9 q-px-md flex items-center">
{{ $t('viewDetail') }}
</span>
</q-item>
@ -1139,9 +1103,7 @@ watch(locale, () => {
size="xs"
style="color: hsl(var(--cyan-6-hsl))"
/>
<span
class="col-9 q-px-md flex items-center"
>
<span class="col-9 q-px-md flex items-center">
{{ $t('edit') }}
</span>
</q-item>
@ -1151,8 +1113,7 @@ watch(locale, () => {
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3':
props.row.status !== 'CREATED',
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
@ -1168,9 +1129,7 @@ watch(locale, () => {
props.row.status === 'CREATED',
}"
/>
<span
class="col-9 q-px-md flex items-center"
>
<span class="col-9 q-px-md flex items-center">
{{ $t('delete') }}
</span>
</q-item>
@ -1228,7 +1187,10 @@ watch(locale, () => {
}"
@click="
() => {
if (props.row.isHeadOffice && props.row._count.branch !==0) {
if (
props.row.isHeadOffice &&
props.row._count.branch !== 0
) {
fieldSelectedBranch.value = '';
inputSearch = '';
currentHq = {
@ -1279,7 +1241,7 @@ watch(locale, () => {
"
>
<template v-slot:action>
<q-menu class="bordered" >
<q-menu class="bordered">
<q-list>
<q-item
:id="`view-detail-btn-${props.row.name}-view`"
@ -1311,9 +1273,7 @@ watch(locale, () => {
size="xs"
style="color: hsl(var(--green-6-hsl))"
/>
<span
class="col-9 q-px-md flex items-center"
>
<span class="col-9 q-px-md flex items-center">
{{ $t('viewDetail') }}
</span>
</q-item>
@ -1350,9 +1310,7 @@ watch(locale, () => {
size="xs"
style="color: hsl(var(--cyan-6-hsl))"
/>
<span
class="col-9 q-px-md flex items-center"
>
<span class="col-9 q-px-md flex items-center">
{{ $t('edit') }}
</span>
</q-item>
@ -1363,8 +1321,7 @@ watch(locale, () => {
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3':
props.row.status !== 'CREATED',
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
@ -1380,9 +1337,7 @@ watch(locale, () => {
props.row.status === 'CREATED',
}"
/>
<span
class="col-9 q-px-md flex items-center"
>
<span class="col-9 q-px-md flex items-center">
{{ $t('delete') }}
</span>
</q-item>
@ -1433,7 +1388,6 @@ watch(locale, () => {
</q-table>
</div>
</div>
</div>
</template>
</q-splitter>
</div>