0
0
Fork 0

Merge branch 'master' into test

This commit is contained in:
Guillermo Bonet 2023-09-20 08:12:28 +02:00
commit 9fad8bf78d
4 changed files with 121 additions and 25 deletions

View File

@ -32,10 +32,11 @@ export default {
rowAdded: 'Row added', rowAdded: 'Row added',
rowRemoved: 'Row removed', rowRemoved: 'Row removed',
pleaseWait: 'Please wait...', pleaseWait: 'Please wait...',
noPinnedModules: 'You have dont have any pinned modules', noPinnedModules: `You don't have any pinned modules`,
summary: { summary: {
basicData: 'Basic data', basicData: 'Basic data',
}, },
noSelectedRows: `You don't have any line selected`,
}, },
errors: { errors: {
statusUnauthorized: 'Access denied', statusUnauthorized: 'Access denied',
@ -482,15 +483,18 @@ export default {
}, },
cmr: { cmr: {
list: { list: {
total: 'Total records', results: 'results',
cmrFk: 'Cmr id', cmrFk: 'CMR id',
hasCmrDms: `Attached in gestdoc`, hasCmrDms: `Attached in gestdoc`,
true: 'Yes', true: 'Yes',
false: 'No', false: 'No',
ticketFk: 'Ticketd id', ticketFk: 'Ticketd id',
routeFk: 'Route id',
country: 'Country', country: 'Country',
clientFk: 'Client id', clientFk: 'Client id',
shipped: 'Preparation date', shipped: 'Preparation date',
viewCmr: 'View CMR',
downloadCmrs: 'Download CMRs',
}, },
}, },
}, },

View File

@ -36,6 +36,7 @@ export default {
summary: { summary: {
basicData: 'Datos básicos', basicData: 'Datos básicos',
}, },
noSelectedRows: `No tienes ninguna línea seleccionada`,
}, },
errors: { errors: {
statusUnauthorized: 'Acceso denegado', statusUnauthorized: 'Acceso denegado',
@ -482,15 +483,18 @@ export default {
}, },
cmr: { cmr: {
list: { list: {
total: 'Total registros', results: 'resultados',
cmrFk: 'Id cmr', cmrFk: 'Id CMR',
hasCmrDms: 'Adjuntado en gestdoc', hasCmrDms: 'Adjuntado en gestdoc',
true: 'Sí', true: 'Sí',
false: 'No', false: 'No',
ticketFk: 'Id ticket', ticketFk: 'Id ticket',
routeFk: 'Id ruta',
country: 'País', country: 'País',
clientFk: 'Id cliente', clientFk: 'Id cliente',
shipped: 'Fecha preparación', shipped: 'Fecha preparación',
viewCmr: 'Ver CMR',
downloadCmrs: 'Descargar CMRs',
}, },
}, },
}, },

View File

@ -28,7 +28,11 @@ const countries = ref();
<QList dense> <QList dense>
<QItem> <QItem>
<QItemSection> <QItemSection>
<QInput :label="t('route.cmr.list.cmrFk')" v-model="params.cmrFk" lazy-rules> <QInput
:label="t('route.cmr.list.cmrFk')"
v-model="params.cmrFk"
lazy-rules
>
<template #prepend> <template #prepend>
<QIcon name="article" size="sm"></QIcon> <QIcon name="article" size="sm"></QIcon>
</template> </template>
@ -46,7 +50,11 @@ const countries = ref();
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<QInput :label="t('route.cmr.list.ticketFk')" v-model="params.ticketFk" lazy-rules> <QInput
:label="t('route.cmr.list.ticketFk')"
v-model="params.ticketFk"
lazy-rules
>
<template #prepend> <template #prepend>
<QIcon name="vn:ticket" size="sm"></QIcon> <QIcon name="vn:ticket" size="sm"></QIcon>
</template> </template>
@ -55,7 +63,24 @@ const countries = ref();
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<QInput :label="t('route.cmr.list.clientFk')" v-model="params.clientFk" lazy-rules> <QInput
:label="t('route.cmr.list.routeFk')"
v-model="params.routeFk"
lazy-rules
>
<template #prepend>
<QIcon name="vn:delivery" size="sm"></QIcon>
</template>
</QInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QInput
:label="t('route.cmr.list.clientFk')"
v-model="params.clientFk"
lazy-rules
>
<template #prepend> <template #prepend>
<QIcon name="vn:client" size="sm"></QIcon> <QIcon name="vn:client" size="sm"></QIcon>
</template> </template>
@ -99,7 +124,9 @@ const countries = ref();
transition-hide="rotate" transition-hide="rotate"
> >
<QDate v-model="params.shipped" minimal> <QDate v-model="params.shipped" minimal>
<div class="row items-center justify-end q-gutter-sm"> <div
class="row items-center justify-end q-gutter-sm"
>
<QBtn <QBtn
:label="t('globals.close')" :label="t('globals.close')"
color="primary" color="primary"

View File

@ -1,16 +1,20 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { toDate } from 'filters/index'; import { toDate } from 'filters/index';
import CmrFilter from './CmrFilter.vue'; import CmrFilter from './CmrFilter.vue';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const session = useSession(); const session = useSession();
const token = session.getToken(); const token = session.getToken();
const selected = ref([]);
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -33,6 +37,12 @@ const columns = computed(() => [
field: (row) => row.ticketFk, field: (row) => row.ticketFk,
sortable: true, sortable: true,
}, },
{
name: 'routeFkFk',
label: t('route.cmr.list.routeFk'),
field: (row) => row.routeFk,
sortable: true,
},
{ {
name: 'clientFk', name: 'clientFk',
label: t('route.cmr.list.clientFk'), label: t('route.cmr.list.clientFk'),
@ -54,10 +64,31 @@ const columns = computed(() => [
sortable: true, sortable: true,
headerStyle: 'padding-left: 33px', headerStyle: 'padding-left: 33px',
}, },
{
name: 'icons',
align: 'center',
field: (row) => row.cmrFk,
},
]); ]);
function getProjectUrl() { function getApiUrl() {
return new URL(window.location).origin; return new URL(window.location).origin;
} }
function getCmrUrl(value) {
return `${getApiUrl()}/api/Routes/${value}/cmr?access_token=${token}`;
}
function downloadPdfs() {
if (!selected.value.length) {
Notify.create({
message: t('globals.noSelectedRows'),
type: 'warning',
});
return;
}
let cmrs = [];
for (let value of selected.value) cmrs.push(value.cmrFk);
// prettier-ignore
return window.open(`${getApiUrl()}/api/Routes/downloadCmrsZip?ids=${cmrs.join(',')}&access_token=${token}`);
}
</script> </script>
<template> <template>
<div class="column items-center"> <div class="column items-center">
@ -76,21 +107,18 @@ function getProjectUrl() {
:dense="$q.screen.lt.md" :dense="$q.screen.lt.md"
:pagination="{ rowsPerPage: null }" :pagination="{ rowsPerPage: null }"
hide-pagination hide-pagination
row-key="cmrFk"
selection="multiple"
v-model:selected="selected"
:grid="$q.screen.lt.md" :grid="$q.screen.lt.md"
auto-load auto-load
> >
<template #top> <template #top>
{{ `${t('route.cmr.list.total')}: ${rows.length}` }} <div style="width: 100%; display: table">
</template> <div style="float: right; color: lightgray">
<template #body-cell-cmrFk="{ value }"> {{ `${rows.length} ${t('route.cmr.list.results')}` }}
<QTd align="right" class="text-primary"> </div>
<a </div>
:href="`${getProjectUrl()}/api/Routes/${value}/cmr?access_token=${token}`"
target="_blank"
>
<span class="text-primary">{{ value }}</span>
</a>
</QTd>
</template> </template>
<template #body-cell-hasCmrDms="{ value }"> <template #body-cell-hasCmrDms="{ value }">
<QTd align="center"> <QTd align="center">
@ -104,13 +132,46 @@ function getProjectUrl() {
/> />
</QTd> </QTd>
</template> </template>
<template #body-cell-ticketFk="{ value }">
<QTd align="right" class="text-primary">
<span class="text-primary link">{{ value }}</span>
<TicketDescriptorProxy :id="value" />
</QTd>
</template>
<template #body-cell-clientFk="{ value }">
<QTd align="right" class="text-primary">
<span class="text-primary link">{{ value }}</span>
<CustomerDescriptorProxy :id="value" />
</QTd>
</template>
<template #body-cell-icons="{ value }">
<QTd align="center">
<a :href="getCmrUrl(value)" target="_blank">
<QIcon
name="visibility"
color="primary"
size="2em"
class="q-mr-sm q-ml-sm"
/>
<QTooltip>
{{ t('route.cmr.list.viewCmr') }}
</QTooltip>
</a>
</QTd>
</template>
</QTable> </QTable>
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>
<QPageSticky :offset="[20, 20]">
<QBtn @click="downloadPdfs" fab icon="cloud_download" color="primary" />
</QPageSticky>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<CmrFilter data-key="CmrList" /> <CmrFilter data-key="CmrList" />
<QTooltip>
{{ t('route.cmr.list.downloadCmrs') }}
</QTooltip>
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
</div> </div>
@ -120,7 +181,7 @@ function getProjectUrl() {
.list { .list {
padding-top: 15px; padding-top: 15px;
padding-bottom: 15px; padding-bottom: 15px;
max-width: 900px; max-width: 1000px;
width: 100%; width: 100%;
} }
.grid-style-transition { .grid-style-transition {