refs #5995 Added module route and external cmrs
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2023-08-08 14:24:51 +02:00
parent 3431abae5d
commit fa120ffa17
9 changed files with 353 additions and 4 deletions

View File

@ -446,6 +446,24 @@ export default {
uncompleteTrays: 'There are incomplete trays',
}
},
route: {
pageTitles: {
routes: 'Routes',
cmrsList: 'External CMRs list',
},
cmr: {
list: {
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

@ -444,7 +444,25 @@ 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: {
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,127 @@
<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>
<template #prepend>
<QIcon name="picture_as_pdf" size="sm"></QIcon>
</template>
</QCheckbox>
</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"
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="scale"
transition-hide="scale"
>
<QDate v-model="params.shipped" landscape>
<div
class="row items-center justify-end q-gutter-sm"
>
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
v-close-popup
/>
<QBtn
:label="t('globals.confirm')"
color="primary"
flat
@click="save"
v-close-popup
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</QItemSection>
</QItem>
</QList>
</template>
</VnFilterPanel>
</template>

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 { getUrl } from 'composables/getUrl';
import CmrFilter from './CmrFilter.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const session = useSession();
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,
sortable: true,
},
{
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,
sortable: true,
},
{
name: 'shipped',
label: t('route.cmr.list.shipped'),
field: (row) => toDate(row.shipped),
sortable: true,
},
]);
async function openCmr(cmrFk) {
const salixUrl = (await getUrl(`Routes/${cmrFk}/cmr`)).replace('#!/', 'api/')
window.open(`${salixUrl.replace('#!/', 'api/')}?access_token=${session.getToken()}`);
};
</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 #body-cell-cmrFk="{ value }">
<QTd align="right" class="text-primary">
<span id="cmr" @click="openCmr(value)">{{ value }}</span>
</QTd>
</template>
<template #body-cell-hasCmrDms="{ value }">
<QTd align="right">
<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;
}
#cmr {
cursor: pointer;
}
#cmr:hover {
text-decoration: underline;
}
.header-cell {
background-color: #ff9800;
}
#true {
background-color: #c8e484;
color: black;
}
#false {
background-color: #fb5252;
color: black;
}
.text-center {
margin: 0 auto;
}
</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();