forked from verdnatura/salix-front
refs #5995 Improved external CMR
This commit is contained in:
parent
6786ac97e4
commit
71c6b865b6
|
@ -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',
|
||||||
|
@ -481,17 +482,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',
|
viewCmr: 'View CMR',
|
||||||
downloadCmr: 'Download CMR',
|
downloadCmrs: 'Download CMRs',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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',
|
||||||
|
@ -481,17 +482,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',
|
viewCmr: 'Ver CMR',
|
||||||
downloadCmr: 'Descargar CMR',
|
downloadCmrs: 'Descargar CMRs',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -78,9 +103,9 @@ const countries = ref();
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="flag" size="sm"></QIcon>
|
<QIcon name="flag" size="sm"></QIcon>
|
||||||
</template>
|
</template>
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -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"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<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';
|
||||||
|
@ -13,6 +14,7 @@ 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(() => [
|
||||||
{
|
{
|
||||||
|
@ -35,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'),
|
||||||
|
@ -62,11 +70,24 @@ const columns = computed(() => [
|
||||||
field: (row) => row.cmrFk,
|
field: (row) => row.cmrFk,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
function getProjectUrl() {
|
function getApiUrl() {
|
||||||
return new URL(window.location).origin;
|
return new URL(window.location).origin;
|
||||||
}
|
}
|
||||||
function getCmrLink(cmrFk) {
|
function getCmrUrl(value) {
|
||||||
return `${getProjectUrl()}/api/Routes/${cmrFk}/cmr?access_token=${token}`;
|
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>
|
||||||
|
@ -86,11 +107,18 @@ function getCmrLink(cmrFk) {
|
||||||
: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">
|
||||||
|
<div style="float: right; color: lightgray">
|
||||||
|
{{ `${rows.length} ${t('route.cmr.list.results')}` }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-hasCmrDms="{ value }">
|
<template #body-cell-hasCmrDms="{ value }">
|
||||||
<QTd align="center">
|
<QTd align="center">
|
||||||
|
@ -118,7 +146,7 @@ function getCmrLink(cmrFk) {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-icons="{ value }">
|
<template #body-cell-icons="{ value }">
|
||||||
<QTd align="center">
|
<QTd align="center">
|
||||||
<a :href="getCmrLink(value)" target="_blank">
|
<a :href="getCmrUrl(value)" target="_blank">
|
||||||
<QIcon
|
<QIcon
|
||||||
name="visibility"
|
name="visibility"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -129,26 +157,21 @@ function getCmrLink(cmrFk) {
|
||||||
{{ t('route.cmr.list.viewCmr') }}
|
{{ t('route.cmr.list.viewCmr') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</a>
|
</a>
|
||||||
<a :href="getCmrLink(value)" download>
|
|
||||||
<QIcon
|
|
||||||
name="cloud_download"
|
|
||||||
color="primary"
|
|
||||||
size="2em"
|
|
||||||
class="q-mr-sm q-ml-sm"
|
|
||||||
/>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('route.cmr.list.downloadCmr') }}
|
|
||||||
</QTooltip>
|
|
||||||
</a>
|
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</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>
|
||||||
|
@ -158,7 +181,7 @@ function getCmrLink(cmrFk) {
|
||||||
.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 {
|
||||||
|
|
Loading…
Reference in New Issue