feat: refs #4988 add agency section
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2024-04-22 12:19:22 +02:00
parent c65c09c39c
commit 6b4cb4ed12
11 changed files with 274 additions and 45 deletions

View File

@ -94,6 +94,7 @@ export default {
}, },
created: 'Created', created: 'Created',
worker: 'Worker', worker: 'Worker',
name: 'Name',
}, },
errors: { errors: {
statusUnauthorized: 'Access denied', statusUnauthorized: 'Access denied',
@ -1034,11 +1035,6 @@ export default {
}, },
}, },
}, },
agency: {
pageTitles: {
agency: 'Agency',
},
},
supplier: { supplier: {
pageTitles: { pageTitles: {
suppliers: 'Suppliers', suppliers: 'Suppliers',
@ -1291,4 +1287,12 @@ export default {
}, },
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789', iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789',
}, },
agency: {
pageTitles: {
agency: 'Agency',
modes: 'Modes',
},
isOwn: 'Is own',
isAnyVolumeAllowed: 'Any volume allowed',
},
}; };

View File

@ -94,6 +94,7 @@ export default {
}, },
created: 'Fecha creación', created: 'Fecha creación',
worker: 'Trabajador', worker: 'Trabajador',
name: 'Nombre',
}, },
errors: { errors: {
statusUnauthorized: 'Acceso denegado', statusUnauthorized: 'Acceso denegado',
@ -1284,4 +1285,12 @@ export default {
}, },
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789', iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789',
}, },
agency: {
pageTitles: {
agency: 'Agencia',
modes: 'Modos',
},
isOwn: 'Propia',
isAnyVolumeAllowed: 'Volumen libre',
},
}; };

View File

@ -5,10 +5,8 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const router = useRouter(); const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
function navigate(id) { function navigate(id) {
@ -68,12 +66,6 @@ function exprBuilder(param, value) {
@click.stop="navigate(row.id)" @click.stop="navigate(row.id)"
outline outline
/> />
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, CustomerSummary)"
color="primary"
style="margin-top: 15px"
/>
</template> </template>
</CardList> </CardList>
</template> </template>

View File

@ -2,23 +2,18 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnRow from 'components/ui/VnRow.vue';
import FormModel from 'components/FormModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FormModel from 'components/FormModel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const id = route.params?.id || null; const routeId = route.params?.id || null;
const warehouses = ref([]); const warehouses = ref([]);
const sectorFilter = { fields: ['id', 'description'] };
const filter = {
fields: ['sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: sectorFilter }],
};
</script> </script>
<template> <template>
<FetchData <FetchData
@ -28,7 +23,7 @@ const filter = {
auto-load auto-load
/> />
<VnSubToolbar /> <VnSubToolbar />
<FormModel :url="`Agencies/${id}`" model="agency" auto-load> <FormModel :url="`Agencies/${routeId}`" model="agency" auto-load>
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnInput v-model="data.name" :label="t('globals.name')" /> <VnInput v-model="data.name" :label="t('globals.name')" />
@ -38,7 +33,7 @@ const filter = {
v-model="data.sectorFk" v-model="data.sectorFk"
option-value="id" option-value="id"
option-label="name" option-label="name"
:label="t('parking.sector')" :label="t('globals.warehouse')"
:options="warehouses" :options="warehouses"
use-input use-input
input-debounce="0" input-debounce="0"
@ -46,11 +41,11 @@ const filter = {
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox :label="t('isOwn')" v-model="data.isOwn" /> <QCheckbox :label="t('agency.isOwn')" v-model="data.isOwn" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox <QCheckbox
:label="t('isAnyVolumeAllowed')" :label="t('agency.isAnyVolumeAllowed')"
v-model="data.isAnyVolumeAllowed" v-model="data.isAnyVolumeAllowed"
/> />
</VnRow> </VnRow>

View File

@ -12,11 +12,6 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const stateStore = useStateStore(); const stateStore = useStateStore();
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
const arrayData = useArrayData('Agency', { const arrayData = useArrayData('Agency', {
url: `Agencies/${route.params.id}`, url: `Agencies/${route.params.id}`,
}); });

View File

@ -19,10 +19,7 @@ const { params } = useRoute();
const entityId = computed(() => props.id || params.id); const entityId = computed(() => props.id || params.id);
const { store } = useArrayData('Parking'); const { store } = useArrayData('Parking');
const card = computed(() => store.data); const card = computed(() => store.data);
const filter = { console.log('card: ', card);
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
</script> </script>
<template> <template>
<CardDescriptor <CardDescriptor
@ -30,7 +27,7 @@ const filter = {
data-key="Agency" data-key="Agency"
:url="`Agencies/${entityId}`" :url="`Agencies/${entityId}`"
:title="card?.name" :title="card?.name"
:subtitle="card?.id" :subtitle="props.id"
> >
<template #body="{ entity: agency }"> <template #body="{ entity: agency }">
<VnLv :label="t('globals.name')" :value="agency.name" /> <VnLv :label="t('globals.name')" :value="agency.name" />

View File

@ -0,0 +1,84 @@
<script setup>
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
const { t } = useI18n();
const router = useRouter();
const route = useRoute();
console.log('route: ', route.path);
const routeId = route.params.id;
const toAgencyModeCreate = (consigneeId) => {
router.push({
name: 'AgencyMode',
params: {
id: route.params.id,
consigneeId,
},
});
};
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="AgencyModes"
:url="`AgencyModes`"
:filter="{ where: { agencyFk: routeId } }"
order="name"
auto-load
>
<template #body="{ rows }">
<CardList
:id="row.id"
:key="row.id"
:title="row.name"
v-for="row of rows"
>
<template #list-items>
<VnLv
:label="t('globals.description')"
:value="row?.description"
/>
<VnLv
:label="t('deliveryMethod')"
:value="row?.deliveryMethodFk"
/>
<VnLv label="m3" :value="row?.m3" />
<VnLv :label="t('inflation')" :value="row?.inflation" />
<VnLv :label="t('globals.code')" :value="row?.code" />
</template>
<template #actions>
<QBtn
:label="t('globals.edit')"
@click.stop="toAgencyModeCreate(row.id)"
color="primary"
icon="edit"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toAgencyModeCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New mode') }}
</QTooltip>
</QPageSticky>
</QPage>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -2,8 +2,12 @@
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -28,15 +32,17 @@ const filter = {
<template #body="{ entity: agency }"> <template #body="{ entity: agency }">
<QCard class="vn-one"> <QCard class="vn-one">
<QCardSection class="q-pa-none"> <QCardSection class="q-pa-none">
<a <VnTitle
class="header header-link" :url="`#/agency/${entityId}/basic-data`"
:href="`#/agency/${entityId}/basic-data`" :text="t('globals.pageTitles.basicData')"
> />
{{ t('globals.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</a>
</QCardSection> </QCardSection>
<VnLv :label="t('globals.name')" :value="agency.name" /> <VnLv :label="t('globals.name')" :value="agency.name" />
<QCheckbox :label="t('agency.isOwn')" v-model="agency.isOwn" />
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="agency.isAnyVolumeAllowed"
/>
</QCard> </QCard>
</template> </template>
</CardSummary> </CardSummary>

View File

@ -0,0 +1,113 @@
<script setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const { t } = useI18n();
const route = useRoute();
const paginate = ref();
const dialog = ref();
const routeId = computed(() => route.params.id);
const initialData = computed(() => {
return {
agencyFk: routeId.value,
workCenterFk: null,
};
});
</script>
<template>
<div class="centerCard">
<FetchData
url="workCenters"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<VnPaginate
ref="paginate"
data-key="AgencyWorkCenters"
url="AgencyWorkCenters"
:filter="{ where: { agencyFk: routeId } }"
order="id"
auto-load
>
<template #body="{ rows }">
<QCard
flat
bordered
:key="row.id"
v-for="row of rows"
class="card q-pa-md q-mb-sm"
>
<QItem>
<QItemSection side-left>
<VnLv :value="row?.workCenter?.name" icon="delete" />
</QItemSection>
<QItemSection side>
<QBtn icon="delete" color="primary" round flat />
</QItemSection>
</QItem>
</QCard>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add">
<QDialog ref="dialog">
<FormModelPopup
:title="t('Add work center')"
url-create="AgencyWorkCenters"
model="AgencyWorkCenter"
:form-initial-data="initialData"
@on-data-saved="paginate.fetch()"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter
v-model="data.workCenterFk"
option-value="id"
option-label="name"
:label="t('workCenter')"
:options="warehouses"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
</template>
</FormModelPopup>
</QDialog>
</QBtn>
<QTooltip>
{{ t('globals.new') }}
</QTooltip>
</QPageSticky>
</template>
<style lang="scss" scoped>
.centerCard {
padding: 5%;
width: 100%;
max-width: 50%;
margin: 0 auto;
}
</style>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -12,7 +12,7 @@ export default {
redirect: { name: 'AgencyCard' }, redirect: { name: 'AgencyCard' },
menus: { menus: {
main: [], main: [],
card: ['AgencyBasicData', 'AgencyLog'], card: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'],
}, },
children: [ children: [
{ {
@ -39,6 +39,40 @@ export default {
}, },
component: () => import('pages/Agency/Card/AgencyBasicData.vue'), component: () => import('pages/Agency/Card/AgencyBasicData.vue'),
}, },
{
path: 'workCenter',
name: 'AgencyWorkCenterCard',
redirect: { name: 'AgencyWorkCenters' },
children: [
{
path: '',
name: 'AgencyWorkCenters',
meta: {
icon: 'apartment',
title: 'workCenters',
},
component: () =>
import('src/pages/Agency/Card/AgencyWorkcenter.vue'),
},
],
},
{
path: 'modes',
name: 'AgencyModesCard',
redirect: { name: 'AgencyModes' },
children: [
{
path: '',
name: 'AgencyModes',
meta: {
icon: 'format_list_bulleted',
title: 'modes',
},
component: () =>
import('src/pages/Agency/Card/AgencyModes.vue'),
},
],
},
{ {
name: 'AgencyLog', name: 'AgencyLog',
path: 'log', path: 'log',

View File

@ -76,7 +76,7 @@ export default {
}, },
{ {
path: '/agency', path: '/agency',
redirect: { name: 'agencyList' }, redirect: { name: 'AgencyList' },
children: [ children: [
{ {
path: 'list', path: 'list',