Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6917-inputDate_inpuTime

This commit is contained in:
Alex Moreno 2024-06-28 16:32:22 +02:00
commit 7bc9042c02
7 changed files with 89 additions and 29 deletions

View File

@ -262,7 +262,7 @@ defineExpose({
<template> <template>
<div class="column items-center full-width"> <div class="column items-center full-width">
<QForm <QForm
v-if="formData"
@submit="save" @submit="save"
@reset="reset" @reset="reset"
class="q-pa-md" class="q-pa-md"
@ -270,11 +270,13 @@ defineExpose({
> >
<QCard> <QCard>
<slot <slot
v-if="formData"
name="form" name="form"
:data="formData" :data="formData"
:validate="validate" :validate="validate"
:filter="filter" :filter="filter"
/> />
<SkeletonForm v-else/>
</QCard> </QCard>
</QForm> </QForm>
</div> </div>
@ -337,7 +339,7 @@ defineExpose({
</QBtnGroup> </QBtnGroup>
</div> </div>
</Teleport> </Teleport>
<SkeletonForm v-if="!formData" />
<QInnerLoading <QInnerLoading
:showing="isLoading" :showing="isLoading"
:label="t('globals.pleaseWait')" :label="t('globals.pleaseWait')"

View File

@ -1,20 +1,14 @@
<template> <template>
<div class="q-pa-md"> <div class="row q-gutter-md q-mb-md">
<div class="row q-gutter-md q-mb-md"> <QSkeleton type="QInput" class="col" square />
<QSkeleton type="QInput" square /> <QSkeleton type="QInput" class="col" square />
<QSkeleton type="QInput" square />
</div>
<div class="row q-gutter-md q-mb-md">
<QSkeleton type="QInput" square />
<QSkeleton type="QInput" square />
</div>
<div class="row q-gutter-md q-mb-md">
<QSkeleton type="QInput" square />
<QSkeleton type="QInput" square />
</div>
<div class="row q-gutter-md">
<QSkeleton type="QBtn" />
<QSkeleton type="QBtn" />
</div>
</div> </div>
</template> <div class="row q-gutter-md q-mb-md">
<QSkeleton type="QInput" class="col" square />
<QSkeleton type="QInput" class="col" square />
</div>
<div class="row q-gutter-md q-mb-md">
<QSkeleton type="QInput" class="col" square />
<QSkeleton type="QInput" class="col" square />
</div>
</template>

View File

@ -15,6 +15,10 @@ const $props = defineProps({
required: false, required: false,
default: null, default: null,
}, },
summary: {
type: Object,
default: null,
},
}); });
const route = useRoute(); const route = useRoute();
@ -60,14 +64,14 @@ const removeRole = () => {
<template> <template>
<CardDescriptor <CardDescriptor
ref="descriptor" :url="`VnRoles/${entityId}`"
:url="`VnRoles`"
:filter="filter" :filter="filter"
module="Role" module="Role"
@on-fetch="setData" @on-fetch="setData"
data-key="accountData" data-key="accountData"
:title="data.title" :title="data.title"
:subtitle="data.subtitle" :subtitle="data.subtitle"
:summary="$props.summary"
> >
<template #menu> <template #menu>
<QItem v-ripple clickable @click="removeRole()"> <QItem v-ripple clickable @click="removeRole()">

View File

@ -0,0 +1,17 @@
<script setup>
import RoleDescriptor from './RoleDescriptor.vue';
import RoleSummary from './RoleSummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
});
</script>
<template>
<QPopupProxy>
<RoleDescriptor v-if="$props.id" :id="$props.id" :summary="RoleSummary" />
</QPopupProxy>
</template>

View File

@ -30,6 +30,7 @@ const filter = {
:url="`VnRoles`" :url="`VnRoles`"
:filter="filter" :filter="filter"
@on-fetch="(data) => (role = data)" @on-fetch="(data) => (role = data)"
data-key="RoleSummary"
> >
<template #header> {{ role.id }} - {{ role.name }} </template> <template #header> {{ role.id }} - {{ role.name }} </template>
<template #body> <template #body>

View File

@ -7,6 +7,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -20,6 +21,7 @@ const warehousesOptions = ref([]);
const continentsOptions = ref([]); const continentsOptions = ref([]);
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
const suppliersOptions = ref([]); const suppliersOptions = ref([]);
const warehousesByContinent = ref({});
const add = (paramsObj, key) => { const add = (paramsObj, key) => {
if (paramsObj[key] === undefined) { if (paramsObj[key] === undefined) {
@ -34,6 +36,28 @@ const decrement = (paramsObj, key) => {
paramsObj[key]--; paramsObj[key]--;
}; };
const warehouses = async () => {
const warehousesResponse = await axios.get('Warehouses');
const countriesResponse = await axios.get('Countries');
const continentsResponse = await axios.get('Continents');
const countryContinentMap = countriesResponse.data.reduce((acc, country) => {
acc[country.id] = country.continentFk;
return acc;
}, {});
continentsResponse.data.forEach((continent) => {
const countriesInContinent = Object.keys(countryContinentMap).filter(
(countryId) => countryContinentMap[countryId] === continent.id.toString()
);
warehousesByContinent.value[continent.code] = warehousesResponse.data.filter(
(warehouse) => countriesInContinent.includes(warehouse.countryFk.toString())
);
});
};
warehouses();
</script> </script>
<template> <template>
@ -116,7 +140,6 @@ const decrement = (paramsObj, key) => {
<VnSelect <VnSelect
:label="t('params.agencyModeFk')" :label="t('params.agencyModeFk')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
@update:model-value="searchFn()"
:options="agenciesOptions" :options="agenciesOptions"
option-value="agencyFk" option-value="agencyFk"
option-label="name" option-label="name"
@ -147,12 +170,26 @@ const decrement = (paramsObj, key) => {
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem v-if="warehousesByContinent[params.continent]">
<QItemSection>
<VnSelect
:label="t('params.warehouseOutFk')"
v-model="params.warehouseOutFk"
:options="warehousesByContinent[params.continent]"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem v-else>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('params.warehouseOutFk')" :label="t('params.warehouseOutFk')"
v-model="params.warehouseOutFk" v-model="params.warehouseOutFk"
@update:model-value="searchFn()"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -168,7 +205,6 @@ const decrement = (paramsObj, key) => {
<VnSelect <VnSelect
:label="t('params.warehouseInFk')" :label="t('params.warehouseInFk')"
v-model="params.warehouseInFk" v-model="params.warehouseInFk"
@update:model-value="searchFn()"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -184,7 +220,6 @@ const decrement = (paramsObj, key) => {
<VnSelect <VnSelect
:label="t('supplier.pageTitles.supplier')" :label="t('supplier.pageTitles.supplier')"
v-model="params.cargoSupplierFk" v-model="params.cargoSupplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions" :options="suppliersOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -200,7 +235,6 @@ const decrement = (paramsObj, key) => {
<VnSelect <VnSelect
:label="t('params.continent')" :label="t('params.continent')"
v-model="params.continent" v-model="params.continent"
@update:model-value="searchFn()"
:options="continentsOptions" :options="continentsOptions"
option-value="code" option-value="code"
option-label="name" option-label="name"

View File

@ -9,6 +9,7 @@ import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -161,7 +162,14 @@ const filter = {
<VnTitle :text="t('worker.summary.userData')" /> <VnTitle :text="t('worker.summary.userData')" />
<VnLv :label="t('worker.summary.userId')" :value="worker.user.id" /> <VnLv :label="t('worker.summary.userId')" :value="worker.user.id" />
<VnLv :label="t('worker.card.name')" :value="worker.user.nickname" /> <VnLv :label="t('worker.card.name')" :value="worker.user.nickname" />
<VnLv :label="t('worker.summary.role')" :value="worker.user.role.name" /> <VnLv :label="t('worker.summary.role')">
<template #value>
<span class="link">
{{ worker.user.role.name }}
<RoleDescriptorProxy :id="worker.user.role.id" />
</span>
</template>
</VnLv>
<VnLv :value="worker?.sip?.extension"> <VnLv :value="worker?.sip?.extension">
<template #label> <template #label>
{{ t('worker.summary.sipExtension') }} {{ t('worker.summary.sipExtension') }}