0
0
Fork 0

Merge pull request 'refs #5995 Added module route and external cmrs' (!75) from 5995-externalCmr into master

Reviewed-on: verdnatura/salix-front#75
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Guillermo Bonet 2023-08-10 07:56:12 +00:00
commit d854a3200c
9 changed files with 371 additions and 4 deletions

View File

@ -19,6 +19,7 @@ export default {
save: 'Save',
remove: 'Remove',
reset: 'Reset',
close: 'Close',
cancel: 'Cancel',
confirm: 'Confirm',
back: 'Back',
@ -446,6 +447,25 @@ export default {
uncompleteTrays: 'There are incomplete trays',
}
},
route: {
pageTitles: {
routes: 'Routes',
cmrsList: 'External CMRs list',
},
cmr: {
list: {
total: 'Total {0} records',
cmrFk: 'Cmr id',
hasCmrDms: `Attached in gestdoc`,
true: 'Yes',
false: 'No',
ticketFk: 'Ticketd id',
country: 'Country',
clientFk: 'Client id',
shipped: 'Preparation date',
},
},
},
components: {
topbar: {},
userPanel: {

View File

@ -19,6 +19,7 @@ export default {
save: 'Guardar',
remove: 'Eliminar',
reset: 'Restaurar',
close: 'Cerrar',
cancel: 'Cancelar',
confirm: 'Confirmar',
back: 'Volver',
@ -444,7 +445,26 @@ export default {
minHeightBetweenTrays: 'La distancia mínima entre bandejas es ',
maxWagonHeight: 'La altura máxima del vagón es ',
uncompleteTrays: 'Hay bandejas sin completar',
}
},
},
route: {
pageTitles: {
routes: 'Rutas',
cmrsList: 'Listado de CMRs externos',
},
cmr: {
list: {
total: 'Total {0} registros',
cmrFk: 'Id cmr',
hasCmrDms: 'Adjuntado en gestdoc',
true: 'Sí',
false: 'No',
ticketFk: 'Id ticket',
country: 'País',
clientFk: 'Id cliente',
shipped: 'Fecha preparación',
},
},
},
components: {
topbar: {},

View File

@ -0,0 +1,141 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const countries = ref();
</script>
<template>
<FetchData url="Countries" @on-fetch="(data) => (countries = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params }">
<QList dense>
<QItem>
<QItemSection>
<QInput :label="t('route.cmr.list.cmrFk')" v-model="params.cmrFk" lazy-rules>
<template #prepend>
<QIcon name="article" size="sm"></QIcon>
</template>
</QInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('route.cmr.list.hasCmrDms')"
v-model="params.hasCmrDms"
lazy-rules
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QInput :label="t('route.cmr.list.ticketFk')" v-model="params.ticketFk" lazy-rules>
<template #prepend>
<QIcon name="vn:ticket" size="sm"></QIcon>
</template>
</QInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QInput :label="t('route.cmr.list.clientFk')" v-model="params.clientFk" lazy-rules>
<template #prepend>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
</QInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="!countries">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="countries">
<QSelect
:label="t('route.cmr.list.country')"
v-model="params.country"
:options="countries"
option-value="country"
option-label="country"
transition-show="jump-down"
transition-hide="jump-up"
emit-value
map-options
>
<template #prepend>
<QIcon name="flag" size="sm"></QIcon>
</template>
</QSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QInput
:label="t('route.cmr.list.shipped')"
v-model="params.shipped"
mask="date"
>
<template #append>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
cover
transition-show="rotate"
transition-hide="rotate"
>
<QDate v-model="params.shipped" minimal>
<div class="row items-center justify-end q-gutter-sm">
<QBtn
:label="t('globals.close')"
color="primary"
flat
@click="save"
v-close-popup
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</QItemSection>
</QItem>
</QList>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
cmrFk: Cmr id,
hasCmrDms: Attached in gestdoc,
ticketFk: Ticketd id,
country: Country,
clientFk: Client id,
shipped: Preparation date,
es:
params:
cmrFk: Id cmr,
hasCmrDms: Adjuntado en gestdoc,
ticketFk: Id ticket,
country: País,
clientFk: Id cliente,
shipped: Fecha preparación,
</i18n>

View File

@ -0,0 +1,130 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'components/ui/VnPaginate.vue';
import { useSession } from 'src/composables/useSession';
import { toDate } from 'filters/index';
import CmrFilter from './CmrFilter.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const session = useSession();
const token = session.getToken();
const columns = computed(() => [
{
name: 'cmrFk',
label: t('route.cmr.list.cmrFk'),
field: (row) => row.cmrFk,
sortable: true,
},
{
name: 'hasCmrDms',
label: t('route.cmr.list.hasCmrDms'),
field: (row) => row.hasCmrDms,
align: 'center',
sortable: true,
headerStyle: 'padding-left: 35px',
},
{
name: 'ticketFk',
label: t('route.cmr.list.ticketFk'),
field: (row) => row.ticketFk,
sortable: true,
},
{
name: 'clientFk',
label: t('route.cmr.list.clientFk'),
field: (row) => row.clientFk,
sortable: true,
},
{
name: 'country',
label: t('route.cmr.list.country'),
field: (row) => row.country,
align: 'left',
sortable: true,
},
{
name: 'shipped',
label: t('route.cmr.list.shipped'),
field: (row) => toDate(row.shipped),
align: 'center',
sortable: true,
headerStyle: 'padding-left: 33px',
},
]);
function getProjectUrl() {
return ((new URL(window.location)).origin);
};
</script>
<template>
<div class="column items-center">
<div class="list">
<VnPaginate
data-key="CmrList"
:url="`Routes/getExternalCmrs`"
order="cmrFk DESC"
limit="null"
auto-load
>
<template #body="{ rows }">
<QTable
:columns="columns"
:rows="rows"
:dense="$q.screen.lt.md"
:pagination="{ rowsPerPage: null }"
hide-pagination
:grid="$q.screen.lt.md"
auto-load
>
<template #top>
{{ t('route.cmr.list.total', [rows.length]) }}
</template>
<template #body-cell-cmrFk="{ value }">
<QTd align="right" class="text-primary">
<a :href="`${getProjectUrl()}/api/Routes/${value}/cmr?access_token=${token}`" target="_blank">
<span class="text-primary">{{ value }}</span>
</a>
</QTd>
</template>
<template #body-cell-hasCmrDms="{ value }">
<QTd align="center">
<QBadge
:id="(value) ? 'true' : 'false'"
:label="(value)
? t('route.cmr.list.true')
: t('route.cmr.list.false')"
/>
</QTd>
</template>
</QTable>
</template>
</VnPaginate>
</div>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<CmrFilter data-key="CmrList" />
</QScrollArea>
</QDrawer>
</div>
</template>
<style lang="scss" scoped>
.list {
padding-top: 15px;
padding-bottom: 15px;
max-width: 900px;
width: 100%;
}
.grid-style-transition {
transition: transform 0.28s, background-color 0.28s;
}
#true {
background-color: $positive;
}
#false {
background-color: $negative;
}
</style>

View File

@ -0,0 +1,17 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -4,6 +4,7 @@ import Claim from './claim';
import InvoiceOut from './invoiceOut';
import Worker from './worker';
import Wagon from './wagon';
import Route from './route';
export default [
Customer,
@ -11,5 +12,6 @@ export default [
Claim,
InvoiceOut,
Worker,
Wagon
Wagon,
Route
]

View File

@ -0,0 +1,35 @@
import { RouterView } from 'vue-router';
export default {
path: '/route',
name: 'Route',
meta: {
title: 'routes',
icon: 'vn:delivery',
},
component: RouterView,
redirect: { name: 'RouteMain' },
menus: {
main: ['CmrList'],
card: [],
},
children: [
{
path: '/route',
name: 'RouteMain',
component: () => import('src/pages/Route/RouteMain.vue'),
redirect: { name: 'CmrList' },
children: [
{
path: 'cmr/list',
name: 'CmrList',
meta: {
title: 'cmrsList',
icon: 'fact_check',
},
component: () => import('src/pages/Route/Cmr/CmrList.vue')
},
],
},
],
};

View File

@ -4,6 +4,7 @@ import claim from './modules/claim';
import worker from './modules/worker';
import invoiceOut from './modules/invoiceOut';
import wagon from './modules/wagon';
import route from './modules/route';
const routes = [
{
@ -35,7 +36,8 @@ const routes = [
name: 'NotFound',
component: () => import('../pages/NotFound.vue'),
},
wagon
wagon,
route
],
},
];

View File

@ -6,7 +6,7 @@ import { useRole } from 'src/composables/useRole';
import routes from 'src/router/modules';
export const useNavigationStore = defineStore('navigationStore', () => {
const modules = ['customer', 'claim', 'ticket', 'invoiceOut', 'worker', 'wagon'];
const modules = ['customer', 'claim', 'ticket', 'invoiceOut', 'worker', 'wagon', 'route'];
const pinnedModules = ref([]);
const role = useRole();