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

View File

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

View File

@ -28,7 +28,11 @@ const countries = ref();
<QList dense>
<QItem>
<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>
<QIcon name="article" size="sm"></QIcon>
</template>
@ -46,7 +50,11 @@ const countries = ref();
</QItem>
<QItem>
<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>
<QIcon name="vn:ticket" size="sm"></QIcon>
</template>
@ -55,7 +63,24 @@ const countries = ref();
</QItem>
<QItem>
<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>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
@ -99,7 +124,9 @@ const countries = ref();
transition-hide="rotate"
>
<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
:label="t('globals.close')"
color="primary"

View File

@ -1,16 +1,20 @@
<script setup>
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar';
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';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const session = useSession();
const token = session.getToken();
const selected = ref([]);
const columns = computed(() => [
{
@ -33,6 +37,12 @@ const columns = computed(() => [
field: (row) => row.ticketFk,
sortable: true,
},
{
name: 'routeFkFk',
label: t('route.cmr.list.routeFk'),
field: (row) => row.routeFk,
sortable: true,
},
{
name: 'clientFk',
label: t('route.cmr.list.clientFk'),
@ -54,10 +64,31 @@ const columns = computed(() => [
sortable: true,
headerStyle: 'padding-left: 33px',
},
{
name: 'icons',
align: 'center',
field: (row) => row.cmrFk,
},
]);
function getProjectUrl() {
function getApiUrl() {
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>
<template>
<div class="column items-center">
@ -76,21 +107,18 @@ function getProjectUrl() {
:dense="$q.screen.lt.md"
:pagination="{ rowsPerPage: null }"
hide-pagination
row-key="cmrFk"
selection="multiple"
v-model:selected="selected"
: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>
<div style="width: 100%; display: table">
<div style="float: right; color: lightgray">
{{ `${rows.length} ${t('route.cmr.list.results')}` }}
</div>
</div>
</template>
<template #body-cell-hasCmrDms="{ value }">
<QTd align="center">
@ -104,13 +132,46 @@ function getProjectUrl() {
/>
</QTd>
</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>
</template>
</VnPaginate>
</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>
<QScrollArea class="fit text-grey-8">
<CmrFilter data-key="CmrList" />
<QTooltip>
{{ t('route.cmr.list.downloadCmrs') }}
</QTooltip>
</QScrollArea>
</QDrawer>
</div>
@ -120,7 +181,7 @@ function getProjectUrl() {
.list {
padding-top: 15px;
padding-bottom: 15px;
max-width: 900px;
max-width: 1000px;
width: 100%;
}
.grid-style-transition {