refs #6905 add rows #235

Merged
carlossa merged 13 commits from 6905-userPanelConfig into dev 2024-03-25 08:54:05 +00:00
1 changed files with 90 additions and 24 deletions
Showing only changes of commit d8419a146a - Show all commits

View File

@ -9,12 +9,14 @@ import { useSession } from 'src/composables/useSession';
import { localeEquivalence } from 'src/i18n/index'; import { localeEquivalence } from 'src/i18n/index';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
const state = useState(); const state = useState();
const session = useSession(); const session = useSession();
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t, locale } = useI18n();
import { useClipboard } from 'src/composables/useClipboard'; import { useClipboard } from 'src/composables/useClipboard';
import { ref } from 'vue';
const { copyText } = useClipboard(); const { copyText } = useClipboard();
const userLocale = computed({ const userLocale = computed({
get() { get() {
@ -47,6 +49,9 @@ const darkMode = computed({
const user = state.getUser(); const user = state.getUser();
const token = session.getToken(); const token = session.getToken();
const warehousesData = ref();
const companiesData = ref();
const accountBankData = ref();
onMounted(async () => { onMounted(async () => {
updatePreferences(); updatePreferences();
@ -86,12 +91,35 @@ function logout() {
function copyUserToken() { function copyUserToken() {
copyText(session.getToken(), { label: 'components.userPanel.copyToken' }); copyText(session.getToken(), { label: 'components.userPanel.copyToken' });
} }
console.log('userWarehouse1', user);
console.log('userWarehouse', user.value);
console.log('userWarehouse', user.value.warehouseFk);
console.log('userWarehouse', user.value.warehouseFk.name);
</script> </script>
<template> <template>
<QMenu anchor="bottom left"> <FetchData
url="Warehouses"
order="name"
@on-fetch="(data) => (warehousesData = data)"
auto-load
/>
<FetchData
url="Companies"
order="name"
@on-fetch="(data) => (companiesData = data)"
auto-load
/>
<FetchData
url="Accountings"
order="name"
@on-fetch="(data) => (accountBankData = data)"
auto-load
/>
<QMenu>
<div class="row no-wrap q-pa-md"> <div class="row no-wrap q-pa-md">
<div class="column panel"> <div class="column panel center">
<div class="text-h6 q-mb-md"> <div class="text-h6 q-mb-md">
{{ t('components.userPanel.settings') }} {{ t('components.userPanel.settings') }}
</div> </div>
@ -116,7 +144,7 @@ function copyUserToken() {
<QSeparator vertical inset class="q-mx-lg" /> <QSeparator vertical inset class="q-mx-lg" />
<div class="column items-center panel q-mb-sm q-pa-md"> <div class="icon column q-mb-sm q-pa-md">
<QAvatar size="80px"> <QAvatar size="80px">
<QImg <QImg
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`" :src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
@ -143,31 +171,59 @@ function copyUserToken() {
icon="logout" icon="logout"
@click="logout()" @click="logout()"
v-close-popup v-close-popup
dense
/> />
</div> </div>
</div> </div>
<QSeparator inset class="q-mx-lg" /> <QSeparator inset class="q-mx-lg" />
<VnRow class="row q-gutter-sm q-mb-sm q-pa-md"> <div class="col q-gutter-xs q-pa-md">
<div class="col"> <VnRow>
<VnSelectFilter :label="t('localWarehouse')" hide-selected /> <VnSelectFilter
</div> :label="t('localWarehouse')"
<div class="col"> v-model="user.localWarehouseFk"
<VnSelectFilter :label="t('localBank')" hide-selected /> :options="warehousesData"
</div> option-label="name"
</VnRow> option-value="id"
<VnRow class="row q-gutter-sm q-mb-sm q-pa-md"> />
<div class="col"> <VnSelectFilter
<VnSelectFilter :label="t('localCompany')" hide-selected /> :label="t('localBank')"
</div> hide-selected
<div class="col"> v-model="user.localBankFk"
<VnSelectFilter :label="t('userWarehouse')" hide-selected /> :options="accountBankData"
</div> option-label="name"
</VnRow> option-value="id"
<VnRow class="col q-gutter-sm q-pa-md"> ></VnSelectFilter>
<div class="col" style="flex: 0"> </VnRow>
<VnSelectFilter :label="t('userCompany')" hide-selected /> <VnRow>
</div> <VnSelectFilter
</VnRow> :label="t('localCompany')"
hide-selected
v-model="user.companyFk"
:options="companiesData"
option-label="code"
option-value="id"
/>
<VnSelectFilter
:label="t('userWarehouse')"
hide-selected
v-model="user.warehouseFk"
:options="warehousesData"
option-label="name"
option-value="id"
/>
</VnRow>
<VnRow>
<VnSelectFilter
:label="t('userCompany')"
hide-selected
v-model="user.companyFk"
:options="companiesData"
option-label="code"
option-value="id"
style="flex: 0"
/>
</VnRow>
</div>
</QMenu> </QMenu>
</template> </template>
@ -181,6 +237,16 @@ function copyUserToken() {
cursor: alias; cursor: alias;
} }
} }
.icon {
align-items: center;
padding-left: 7.5%;
}
.center {
display: flex;
flex: 0.96;
}
</style> </style>
<i18n> <i18n>