Create route tickets

This commit is contained in:
Kevin Martinez 2024-01-25 08:10:34 -03:00
parent 6629a2d59a
commit 67f862ebe3
4 changed files with 339 additions and 109 deletions

View File

@ -62,14 +62,8 @@ export default {
selectRows: 'Select all { numberRows } row(s)',
allRows: 'All { numberRows } row(s)',
markAll: 'Mark all',
requiredField: 'Required field',
class: 'clase',
type: 'type',
reason: 'reason',
noResults: 'No results',
system: 'System',
fieldRequired: 'Field required',
allowedFilesText: 'Allowed file types: { allowedContentTypes }',
},
errors: {
statusUnauthorized: 'Access denied',
@ -137,8 +131,6 @@ export default {
log: 'Log',
sms: 'Sms',
creditManagement: 'Credit management',
creditContracts: 'Credit contracts',
creditOpinion: 'Credit opinion',
others: 'Others',
},
list: {
@ -274,8 +266,6 @@ export default {
buys: 'Buys',
notes: 'Notes',
log: 'Log',
create: 'Create',
latestBuys: 'Latest buys',
},
list: {
newEntry: 'New entry',
@ -331,12 +321,6 @@ export default {
booked: 'Booked',
raid: 'Raid',
excludedFromAvailable: 'Inventory',
agency: 'Agency',
warehouseOut: 'Warehouse Out',
warehouseIn: 'Warehouse In',
shipped: 'Shipped',
landed: 'Landed',
id: 'ID',
},
buys: {
groupingPrice: 'Grouping price',
@ -350,12 +334,6 @@ export default {
grouping: 'Grouping',
buyingValue: 'Buying value',
packagingFk: 'Box',
file: 'File',
name: 'Name',
producer: 'Producer',
type: 'Type',
color: 'Color',
id: 'ID',
},
notes: {
observationType: 'Observation type',
@ -366,36 +344,6 @@ export default {
landed: 'Landed',
warehouseOut: 'Warehouse Out',
},
latestBuys: {
picture: 'Picture',
itemFk: 'Item ID',
packing: 'Packing',
grouping: 'Grouping',
quantity: 'Quantity',
description: 'Description',
size: 'Size',
tags: 'Tags',
type: 'Type',
intrastat: 'Intrastat',
origin: 'Origin',
weightByPiece: 'Weight/Piece',
isActive: 'Active',
family: 'Family',
entryFk: 'Entry',
buyingValue: 'Buying value',
freightValue: 'Freight value',
comissionValue: 'Commission value',
packageValue: 'Package value',
isIgnored: 'Is ignored',
price2: 'Grouping',
price3: 'Packing',
minPrice: 'Min',
ektFk: 'Ekt',
weight: 'Weight',
packagingFk: 'Package',
packingOut: 'Package out',
landing: 'Landing',
},
},
ticket: {
pageTitles: {
@ -547,7 +495,6 @@ export default {
responsible: 'Responsible',
worker: 'Worker',
redelivery: 'Redelivery',
returnOfMaterial: 'RMA',
},
basicData: {
customer: 'Customer',
@ -686,7 +633,6 @@ export default {
vat: 'VAT',
dueDay: 'Due day',
intrastat: 'Intrastat',
corrective: 'Corrective',
log: 'Logs',
},
list: {
@ -941,6 +887,7 @@ export default {
create: 'Create',
basicData: 'Basic Data',
summary: 'Summary',
tickets: 'Tickets'
},
cmr: {
list: {
@ -1070,7 +1017,6 @@ export default {
m3Price: 'M3 Price',
routePrice: 'Route price',
minimumKm: 'Minimum Km',
addRow: 'Add row',
},
consumption: {
entry: 'Entry',
@ -1087,8 +1033,8 @@ export default {
extraCommunity: 'Extra community',
travelCreate: 'New travel',
basicData: 'Basic data',
history: 'Log',
thermographs: 'Thermograph',
history: 'History',
thermographs: 'Termographs',
},
summary: {
confirmed: 'Confirmed',
@ -1100,10 +1046,7 @@ export default {
entries: 'Entries',
cloneShipping: 'Clone travel',
CloneTravelAndEntries: 'Clone travel and his entries',
deleteTravel: 'Delete travel',
AddEntry: 'Add entry',
thermographs: 'Thermographs',
hb: 'HB',
},
variables: {
search: 'Id/Reference',
@ -1115,50 +1058,6 @@ export default {
continent: 'Continent out',
totalEntries: 'Total entries',
},
basicData: {
reference: 'Reference',
agency: 'Agency',
shipped: 'Shipped',
landed: 'Landed',
warehouseOut: 'Warehouse Out',
warehouseIn: 'Warehouse In',
delivered: 'Delivered',
received: 'Received',
},
thermographs: {
code: 'Code',
temperature: 'Temperature',
state: 'State',
destination: 'Destination',
created: 'Created',
thermograph: 'Thermograph',
reference: 'Reference',
type: 'Type',
company: 'Company',
warehouse: 'Warehouse',
travelFileDescription: 'Travel id { travelId }',
file: 'File',
description: 'Description',
},
},
item: {
pageTitles: {
items: 'Items',
list: 'List',
diary: 'Diary',
tags: 'Tags',
},
descriptor: {
item: 'Item',
buyer: 'Buyer',
color: 'Color',
category: 'Category',
stems: 'Stems',
visible: 'Visible',
available: 'Available',
warehouseText: 'Calculated on the warehouse of { warehouseName }',
itemDiary: 'Item diary',
},
},
components: {
topbar: {},
@ -1183,9 +1082,5 @@ export default {
addToPinned: 'Add to pinned',
removeFromPinned: 'Remove from pinned',
},
VnLv: {
copyText: '{copyValue} has been copied to the clipboard',
},
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789',
},
};

View File

@ -941,6 +941,7 @@ export default {
create: 'Crear',
basicData: 'Datos básicos',
summary: 'Summary',
tickets: 'Tickets'
},
cmr: {
list: {

View File

@ -0,0 +1,325 @@
<script setup>
import VnPaginate from 'components/ui/VnPaginate.vue';
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { dashIfEmpty } from 'src/filters';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInput from 'components/common/VnInput.vue';
import axios from 'axios';
import { QIcon, useQuasar } from 'quasar';
import { useSession } from 'composables/useSession';
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import { useRoute } from 'vue-router';
const { t } = useI18n();
const quasar = useQuasar();
const session = useSession();
const route = useRoute();
const selectedRows = ref([]);
const columns = computed(() => [
{
name: 'order',
label: t('Order'),
field: (row) => dashIfEmpty(row?.priority),
sortable: false,
align: 'center',
},
{
name: 'street',
label: t('Street'),
field: (row) => row?.street,
sortable: false,
align: 'left',
},
{
name: 'city',
label: t('City'),
field: (row) => row?.city,
sortable: false,
align: 'left',
},
{
name: 'pc',
label: t('PC'),
field: (row) => row?.postalCode,
sortable: false,
align: 'center',
},
{
name: 'client',
label: t('Client'),
field: (row) => row?.nickname,
sortable: false,
align: 'left',
},
{
name: 'warehouse',
label: t('Warehouse'),
field: (row) => row?.warehouseName,
sortable: false,
align: 'left',
},
{
name: 'packages',
label: t('Packages'),
field: (row) => row?.packages,
sortable: false,
align: 'center',
},
{
name: 'volume',
label: 'm³',
field: (row) => row?.volume,
sortable: false,
align: 'center',
},
{
name: 'packaging',
label: t('Packaging'),
field: (row) => row?.ipt,
sortable: false,
align: 'center',
},
{
name: 'ticket',
label: t('Ticket'),
field: (row) => row?.id,
sortable: false,
align: 'center',
},
{
name: 'observations',
label: '',
field: (row) => row?.ticketObservation,
sortable: false,
align: 'left',
},
]);
const refreshKey = ref(0);
const confirmationDialog = ref(false);
const startingDate = ref(null);
const cloneRoutes = () => {
axios.post('Routes/clone', {
created: startingDate.value,
ids: selectedRows.value.map((row) => row?.id),
});
refreshKey.value++;
startingDate.value = null;
};
const showRouteReport = () => {
const ids = selectedRows.value.map((row) => row?.id);
const idString = ids.join(',');
let url;
if (selectedRows.value.length <= 1) {
url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getToken()}`;
} else {
const params = new URLSearchParams({
access_token: session.getToken(),
id: idString,
});
url = `api/Routes/downloadZip?${params.toString()}`;
}
window.open(url, '_blank');
};
const markAsServed = () => {
selectedRows.value.forEach((row) => {
if (row?.id) {
axios.patch(`Routes/${row?.id}`, { isOk: true });
}
});
refreshKey.value++;
startingDate.value = null;
};
const openTicketsDialog = () => {
quasar
.dialog({
component: RouteListTicketsDialog,
componentProps: {
id: route.params.id,
},
})
.onOk(() => refreshKey.value++);
};
</script>
<template>
<QDialog v-model="confirmationDialog">
<QCard style="min-width: 350px">
<QCardSection>
<p class="text-h6 q-ma-none">{{ t('Select the starting date') }}</p>
</QCardSection>
<QCardSection class="q-pt-none">
<VnInputDate
:label="t('Stating date')"
v-model="startingDate"
autofocus
/>
</QCardSection>
<QCardActions align="right">
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
<QBtn color="primary" v-close-popup @click="cloneRoutes">
{{ t('Clone') }}
</QBtn>
</QCardActions>
</QCard>
</QDialog>
<QPage class="column items-center">
<QToolbar class="bg-vn-dark justify-end">
<div id="st-actions" class="q-pa-sm">
<QBtn
icon="vn:clone"
color="primary"
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="confirmationDialog = true"
>
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
</QBtn>
<QBtn
icon="cloud_download"
color="primary"
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="showRouteReport"
>
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
</QBtn>
<QBtn
icon="check"
color="primary"
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="markAsServed"
>
<QTooltip>{{ t('Mark as served') }}</QTooltip>
</QBtn>
</div>
</QToolbar>
<div class="route-list">
<VnPaginate
:key="refreshKey"
data-key="RouteTicketList"
url="Routes/getTickets"
:filter="{ id: route.params.id }"
:order="['priority ASC']"
auto-load
>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable
v-model:selected="selectedRows"
:columns="columns"
:rows="rows"
:rows-per-page-options="[0]"
row-key="id"
flat
hide-pagination
selection="multiple"
>
<template #body-cell-order="{ row }">
<QTd class="order-field">
<VnInput
v-model="row.priority"
is-outlined
/>
</QTd>
</template>
<template #body-cell-city="{ value, row }">
<QTd auto-width>
<span
class="text-primary cursor-pointer"
@click="openBuscaman(entity?.route, row)"
>
{{ value }}
</span>
</QTd>
</template>
<template #body-cell-client="{ value, row }">
<QTd auto-width>
<span class="text-primary cursor-pointer">
{{ value }}
<CustomerDescriptorProxy :id="row?.clientFk" />
</span>
</QTd>
</template>
<template #body-cell-ticket="{ value, row }">
<QTd auto-width class="text-center">
<span class="text-primary cursor-pointer">
{{ value }}
<TicketDescriptorProxy :id="row?.id" />
</span>
</QTd>
</template>
<template #body-cell-observations="{ value }">
<QTd auto-width>
<div class="flex items-center no-wrap table-actions">
<QIcon
name="delete"
color="primary"
class="cursor-pointer"
size="xs"
>
<QTooltip>{{ t('globals.remove') }}</QTooltip>
</QIcon>
<QIcon
v-if="value"
name="vn:notes"
color="primary"
class="cursor-pointer"
>
<QTooltip>{{ value }}</QTooltip>
</QIcon>
</div>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="openTicketsDialog">
<QTooltip>
{{ t('newRoute') }}
</QTooltip>
</QBtn>
</QPageSticky>
</QPage>
</template>
<style lang="scss" scoped>
.route-list {
width: 100%;
}
.order-field {
max-width: 50px;
}
.table-actions {
gap: 12px;
}
</style>
<i18n>
en:
newRoute: New Route
es:
Order: Orden
Street: Dirección fiscal
City: Población
PC: CP
Client: Cliente
Warehouse: Almacén
Packages: Bultos
Packaging: Encajado
</i18n>

View File

@ -11,7 +11,7 @@ export default {
redirect: { name: 'RouteMain' },
menus: {
main: ['RouteList', 'CmrList'],
card: ['RouteBasicData'],
card: ['RouteBasicData', 'RouteTickets'],
},
children: [
{
@ -72,6 +72,15 @@ export default {
},
component: () => import('pages/Route/Card/RouteSummary.vue'),
},
{
path: 'tickets',
name: 'RouteTickets',
meta: {
title: 'tickets',
icon: 'vn:ticket',
},
component: () => import('src/pages/Route/RouteTickets.vue'),
},
],
},
],