8179-testToMaster #909
|
@ -10,7 +10,7 @@ import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
|
||||||
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||||
import VnTableFilter from 'components/VnTable/VnFilter.vue';
|
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
|
@ -335,7 +335,7 @@ function handleOnDataSaved(_) {
|
||||||
)"
|
)"
|
||||||
:key="col.id"
|
:key="col.id"
|
||||||
>
|
>
|
||||||
<VnTableFilter
|
<VnFilter
|
||||||
:column="col"
|
:column="col"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
v-model="params[columnName(col)]"
|
v-model="params[columnName(col)]"
|
||||||
|
@ -442,7 +442,7 @@ function handleOnDataSaved(_) {
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<VnTableFilter
|
<VnFilter
|
||||||
v-if="$props.columnSearch"
|
v-if="$props.columnSearch"
|
||||||
:column="col"
|
:column="col"
|
||||||
:show-title="true"
|
:show-title="true"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import isValidDate from 'filters/isValidDate';
|
import isValidDate from 'filters/isValidDate';
|
||||||
|
|
||||||
export default function toHour(date) {
|
export default function toHour(date) {
|
||||||
|
console.log('date: ', date);
|
||||||
if (!isValidDate(date)) {
|
if (!isValidDate(date)) {
|
||||||
return '--:--';
|
return '--:--';
|
||||||
}
|
}
|
||||||
return (new Date(date || '')).toLocaleTimeString([], {
|
return new Date(date || '').toLocaleTimeString([], {
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
});
|
});
|
||||||
|
|
|
@ -872,6 +872,7 @@ route:
|
||||||
tickets: Tickets
|
tickets: Tickets
|
||||||
log: Log
|
log: Log
|
||||||
autonomous: Autonomous
|
autonomous: Autonomous
|
||||||
|
RouteExtendedList: Extended list
|
||||||
cmr:
|
cmr:
|
||||||
list:
|
list:
|
||||||
results: results
|
results: results
|
||||||
|
|
|
@ -216,6 +216,7 @@ globals:
|
||||||
RouteRoadmap: Troncales
|
RouteRoadmap: Troncales
|
||||||
RouteRoadmapCreate: Crear troncal
|
RouteRoadmapCreate: Crear troncal
|
||||||
autonomous: Autónomos
|
autonomous: Autónomos
|
||||||
|
RouteExtendedList: Listado extendido
|
||||||
suppliers: Proveedores
|
suppliers: Proveedores
|
||||||
supplier: Proveedor
|
supplier: Proveedor
|
||||||
supplierCreate: Nuevo proveedor
|
supplierCreate: Nuevo proveedor
|
||||||
|
|
|
@ -27,12 +27,15 @@ const columns = computed(() => [
|
||||||
condition: () => true,
|
condition: () => true,
|
||||||
},
|
},
|
||||||
isId: true,
|
isId: true,
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('globals.name'),
|
label: t('globals.name'),
|
||||||
name: 'name',
|
name: 'name',
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
|
columnFilter: false,
|
||||||
|
columnClass: 'expand',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -70,18 +73,34 @@ const columns = computed(() => [
|
||||||
data-key="AgencyList"
|
data-key="AgencyList"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
/>
|
/>
|
||||||
<VnTable
|
<div class="list-container">
|
||||||
ref="tableRef"
|
<div class="list">
|
||||||
data-key="AgencyList"
|
<VnTable
|
||||||
url="Agencies"
|
ref="tableRef"
|
||||||
order="name"
|
data-key="AgencyList"
|
||||||
:columns="columns"
|
url="Agencies"
|
||||||
:right-search="false"
|
order="name"
|
||||||
:use-model="true"
|
:columns="columns"
|
||||||
redirect="agency"
|
:right-search="false"
|
||||||
default-mode="card"
|
:use-model="true"
|
||||||
/>
|
redirect="agency"
|
||||||
|
default-mode="card"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
width: 55%;
|
||||||
|
}
|
||||||
|
.list-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
isOwn: Tiene propietario
|
isOwn: Tiene propietario
|
||||||
|
|
|
@ -0,0 +1,411 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useSession } from 'composables/useSession';
|
||||||
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import { toDate } from 'src/filters';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||||
|
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
||||||
|
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
|
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
|
|
||||||
|
const { openReport } = usePrintService();
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const session = useSession();
|
||||||
|
const selectedRows = ref([]);
|
||||||
|
const tableRef = ref([]);
|
||||||
|
const confirmationDialog = ref(false);
|
||||||
|
const startingDate = ref(null);
|
||||||
|
const router = useRouter();
|
||||||
|
const routeFilter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'workers',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'firstName'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'id',
|
||||||
|
label: 'Id',
|
||||||
|
chip: {
|
||||||
|
condition: () => true,
|
||||||
|
},
|
||||||
|
isId: true,
|
||||||
|
columnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'workerFk',
|
||||||
|
label: t('Worker'),
|
||||||
|
create: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'Workers/activeWithInheritedRole',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
useLike: false,
|
||||||
|
optionFilter: 'firstName',
|
||||||
|
find: {
|
||||||
|
value: 'workerFk',
|
||||||
|
label: 'workerUserName',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
useLike: false,
|
||||||
|
cardVisible: true,
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'agencyModeFk',
|
||||||
|
label: t('Agency'),
|
||||||
|
isTitle: true,
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'agencyModes',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
find: {
|
||||||
|
value: 'agencyModeFk',
|
||||||
|
label: 'agencyName',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columnClass: 'expand',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'vehicleFk',
|
||||||
|
label: t('Vehicle'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'vehicles',
|
||||||
|
fields: ['id', 'numberPlate'],
|
||||||
|
optionLabel: 'numberPlate',
|
||||||
|
optionFilterValue: 'numberPlate',
|
||||||
|
find: {
|
||||||
|
value: 'vehicleFk',
|
||||||
|
label: 'vehiclePlateNumber',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'created',
|
||||||
|
label: t('Date'),
|
||||||
|
columnFilter: false,
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
component: 'date',
|
||||||
|
format: ({ date }) => toDate(date),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'from',
|
||||||
|
label: t('From'),
|
||||||
|
visible: false,
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
component: 'date',
|
||||||
|
format: ({ date }) => toDate(date),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'to',
|
||||||
|
label: t('To'),
|
||||||
|
visible: false,
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
component: 'date',
|
||||||
|
format: ({ date }) => toDate(date),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'center',
|
||||||
|
name: 'm3',
|
||||||
|
label: t('Volume'),
|
||||||
|
cardVisible: true,
|
||||||
|
columnClass: 'shrink',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'started',
|
||||||
|
label: t('hourStarted'),
|
||||||
|
component: 'time',
|
||||||
|
columnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'finished',
|
||||||
|
label: t('hourFinished'),
|
||||||
|
component: 'time',
|
||||||
|
columnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'center',
|
||||||
|
name: 'kmStart',
|
||||||
|
label: t('KmStart'),
|
||||||
|
columnClass: 'shrink',
|
||||||
|
create: true,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'center',
|
||||||
|
name: 'kmEnd',
|
||||||
|
label: t('KmEnd'),
|
||||||
|
columnClass: 'shrink',
|
||||||
|
create: true,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'description',
|
||||||
|
label: t('Description'),
|
||||||
|
isTitle: true,
|
||||||
|
create: true,
|
||||||
|
component: 'input',
|
||||||
|
field: 'description',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'isOk',
|
||||||
|
label: t('Served'),
|
||||||
|
component: 'checkbox',
|
||||||
|
columnFilter: false,
|
||||||
|
columnClass: 'shrink',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('Add tickets'),
|
||||||
|
icon: 'vn:ticketAdd',
|
||||||
|
action: (row) => openTicketsDialog(row?.id),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('components.smartCard.viewSummary'),
|
||||||
|
icon: 'preview',
|
||||||
|
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('Route summary'),
|
||||||
|
icon: 'arrow_forward',
|
||||||
|
isPrimary: true,
|
||||||
|
action: (row) => navigate(row?.id),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
function navigate(id) {
|
||||||
|
router.push({ path: `/route/${id}` });
|
||||||
|
}
|
||||||
|
|
||||||
|
const cloneRoutes = () => {
|
||||||
|
if (!selectedRows.value.length || !startingDate.value) return;
|
||||||
|
axios.post('Routes/clone', {
|
||||||
|
created: startingDate.value,
|
||||||
|
ids: selectedRows.value.map((row) => row?.id),
|
||||||
|
});
|
||||||
|
startingDate.value = null;
|
||||||
|
tableRef.value.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
const showRouteReport = () => {
|
||||||
|
const ids = selectedRows.value.map((row) => row?.id);
|
||||||
|
const idString = ids.join(',');
|
||||||
|
let url = `Routes/${idString}/driver-route-pdf`;
|
||||||
|
let params = {};
|
||||||
|
if (selectedRows.value.length >= 1) {
|
||||||
|
params = {
|
||||||
|
id: idString,
|
||||||
|
};
|
||||||
|
url = `Routes/downloadZip`;
|
||||||
|
}
|
||||||
|
openReport(url, params, '_blank');
|
||||||
|
};
|
||||||
|
|
||||||
|
function markAsServed() {
|
||||||
|
selectedRows.value.forEach(async (row) => {
|
||||||
|
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
||||||
|
});
|
||||||
|
tableRef.value.reload();
|
||||||
|
startingDate.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const openTicketsDialog = (id) => {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: RouteListTicketsDialog,
|
||||||
|
componentProps: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(() => tableRef.value.reload());
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<RouteSearchbar />
|
||||||
|
<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('globals.clone') }}
|
||||||
|
</QBtn>
|
||||||
|
</QCardActions>
|
||||||
|
</QCard>
|
||||||
|
</QDialog>
|
||||||
|
<VnSubToolbar />
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel>
|
||||||
|
<RouteFilter data-key="RouteList" />
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
|
<VnTable
|
||||||
|
class="route-list"
|
||||||
|
ref="tableRef"
|
||||||
|
data-key="RouteList"
|
||||||
|
url="Routes/filter"
|
||||||
|
:columns="columns"
|
||||||
|
:right-search="false"
|
||||||
|
:is-editable="true"
|
||||||
|
:filter="routeFilter"
|
||||||
|
redirect="route"
|
||||||
|
:row-click="false"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'Routes',
|
||||||
|
title: t('Create route'),
|
||||||
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
|
formInitialData: {},
|
||||||
|
}"
|
||||||
|
save-url="Routes/crud"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
table-height="85vh"
|
||||||
|
v-model:selected="selectedRows"
|
||||||
|
:table="{
|
||||||
|
'row-key': 'id',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #moreBeforeActions>
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.table-input-cell {
|
||||||
|
max-width: 143px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.route-list {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-actions {
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
th:last-child,
|
||||||
|
td:last-child {
|
||||||
|
background-color: var(--vn-section-color);
|
||||||
|
position: sticky;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
newRoute: New Route
|
||||||
|
hourStarted: Started hour
|
||||||
|
hourFinished: Finished hour
|
||||||
|
es:
|
||||||
|
From: Desde
|
||||||
|
To: Hasta
|
||||||
|
Worker: Trabajador
|
||||||
|
Agency: Agencia
|
||||||
|
Vehicle: Vehículo
|
||||||
|
Volume: Volumen
|
||||||
|
Date: Fecha
|
||||||
|
Description: Descripción
|
||||||
|
Hour started: Hora inicio
|
||||||
|
Hour finished: Hora fin
|
||||||
|
KmStart: Km inicio
|
||||||
|
KmEnd: Km fin
|
||||||
|
Served: Servida
|
||||||
|
newRoute: Nueva Ruta
|
||||||
|
Clone Selected Routes: Clonar rutas seleccionadas
|
||||||
|
Select the starting date: Seleccione la fecha de inicio
|
||||||
|
Stating date: Fecha de inicio
|
||||||
|
Cancel: Cancelar
|
||||||
|
Mark as served: Marcar como servidas
|
||||||
|
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||||
|
Add ticket: Añadir tickets
|
||||||
|
Preview: Vista previa
|
||||||
|
Summary: Resumen
|
||||||
|
Route is closed: La ruta está cerrada
|
||||||
|
Route is not served: La ruta no está servida
|
||||||
|
hourStarted: Hora de inicio
|
||||||
|
hourFinished: Hora de fin
|
||||||
|
</i18n>
|
|
@ -1,34 +1,19 @@
|
||||||
<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 { useSession } from 'composables/useSession';
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { useQuasar } from 'quasar';
|
import { toHour } from 'src/filters';
|
||||||
import { toDate } from 'src/filters';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import axios from 'axios';
|
|
||||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||||
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
|
||||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
|
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { usePrintService } from 'src/composables/usePrintService';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { openReport } = usePrintService();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const quasar = useQuasar();
|
|
||||||
const session = useSession();
|
|
||||||
const selectedRows = ref([]);
|
|
||||||
const tableRef = ref([]);
|
const tableRef = ref([]);
|
||||||
const confirmationDialog = ref(false);
|
|
||||||
const startingDate = ref(null);
|
|
||||||
const router = useRouter();
|
|
||||||
const routeFilter = {
|
const routeFilter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -42,12 +27,12 @@ const routeFilter = {
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
isId: true,
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: 'Id',
|
label: 'Id',
|
||||||
chip: {
|
chip: {
|
||||||
condition: () => true,
|
condition: () => true,
|
||||||
},
|
},
|
||||||
isId: true,
|
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -55,138 +40,52 @@ const columns = computed(() => [
|
||||||
name: 'workerFk',
|
name: 'workerFk',
|
||||||
label: t('Worker'),
|
label: t('Worker'),
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'Workers/activeWithInheritedRole',
|
|
||||||
fields: ['id', 'name'],
|
|
||||||
useLike: false,
|
|
||||||
optionFilter: 'firstName',
|
|
||||||
find: {
|
|
||||||
value: 'workerFk',
|
|
||||||
label: 'workerUserName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
inWhere: true,
|
|
||||||
},
|
|
||||||
useLike: false,
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'agencyModeFk',
|
name: 'agencyModeName',
|
||||||
label: t('Agency'),
|
label: t('Agency'),
|
||||||
isTitle: true,
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'agencyModes',
|
|
||||||
fields: ['id', 'name'],
|
|
||||||
find: {
|
|
||||||
value: 'agencyModeFk',
|
|
||||||
label: 'agencyName',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'vehicleFk',
|
name: 'vehiclePlateNumber',
|
||||||
label: t('Vehicle'),
|
label: t('Vehicle'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
url: 'vehicles',
|
|
||||||
fields: ['id', 'numberPlate'],
|
|
||||||
optionLabel: 'numberPlate',
|
|
||||||
optionFilterValue: 'numberPlate',
|
|
||||||
find: {
|
|
||||||
value: 'vehicleFk',
|
|
||||||
label: 'vehiclePlateNumber',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
inWhere: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'created',
|
|
||||||
label: t('Date'),
|
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
|
||||||
component: 'date',
|
|
||||||
format: ({ date }) => toDate(date),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'from',
|
|
||||||
label: t('From'),
|
|
||||||
visible: false,
|
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
|
||||||
component: 'date',
|
|
||||||
format: ({ date }) => toDate(date),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'to',
|
|
||||||
label: t('To'),
|
|
||||||
visible: false,
|
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
|
||||||
component: 'date',
|
|
||||||
format: ({ date }) => toDate(date),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
name: 'm3',
|
|
||||||
label: t('Volume'),
|
|
||||||
cardVisible: true,
|
|
||||||
columnClass: 'shrink',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'started',
|
name: 'started',
|
||||||
label: t('hourStarted'),
|
label: t('hourStarted'),
|
||||||
component: 'time',
|
cardVisible: true,
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
format: (row) => toHour(row.started),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'finished',
|
name: 'finished',
|
||||||
label: t('hourFinished'),
|
label: t('hourFinished'),
|
||||||
component: 'time',
|
cardVisible: true,
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
},
|
format: (row) => toHour(row.started),
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
name: 'kmStart',
|
|
||||||
label: t('KmStart'),
|
|
||||||
columnClass: 'shrink',
|
|
||||||
create: true,
|
|
||||||
visible: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
name: 'kmEnd',
|
|
||||||
label: t('KmEnd'),
|
|
||||||
columnClass: 'shrink',
|
|
||||||
create: true,
|
|
||||||
visible: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
label: t('Description'),
|
label: t('Description'),
|
||||||
|
cardVisible: true,
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
create: true,
|
create: true,
|
||||||
component: 'input',
|
|
||||||
field: 'description',
|
field: 'description',
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -200,111 +99,29 @@ const columns = computed(() => [
|
||||||
align: 'right',
|
align: 'right',
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
|
||||||
title: t('Add tickets'),
|
|
||||||
icon: 'vn:ticketAdd',
|
|
||||||
action: (row) => openTicketsDialog(row?.id),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
action: (row) => viewSummary(row?.id, RouteSummary),
|
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||||
},
|
color: 'primary',
|
||||||
{
|
|
||||||
title: t('Route summary'),
|
|
||||||
icon: 'arrow_forward',
|
|
||||||
isPrimary: true,
|
|
||||||
action: (row) => navigate(row?.id),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function navigate(id) {
|
|
||||||
router.push({ path: `/route/${id}` });
|
|
||||||
}
|
|
||||||
|
|
||||||
const cloneRoutes = () => {
|
|
||||||
if (!selectedRows.value.length || !startingDate.value) return;
|
|
||||||
axios.post('Routes/clone', {
|
|
||||||
created: startingDate.value,
|
|
||||||
ids: selectedRows.value.map((row) => row?.id),
|
|
||||||
});
|
|
||||||
startingDate.value = null;
|
|
||||||
tableRef.value.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
const showRouteReport = () => {
|
|
||||||
const ids = selectedRows.value.map((row) => row?.id);
|
|
||||||
const idString = ids.join(',');
|
|
||||||
let url = `Routes/${idString}/driver-route-pdf`;
|
|
||||||
let params = {};
|
|
||||||
if (selectedRows.value.length >= 1) {
|
|
||||||
params = {
|
|
||||||
id: idString,
|
|
||||||
};
|
|
||||||
url = `Routes/downloadZip`;
|
|
||||||
}
|
|
||||||
openReport(url, params, '_blank');
|
|
||||||
};
|
|
||||||
|
|
||||||
function markAsServed() {
|
|
||||||
selectedRows.value.forEach(async (row) => {
|
|
||||||
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
|
||||||
});
|
|
||||||
tableRef.value.reload();
|
|
||||||
startingDate.value = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const openTicketsDialog = (id) => {
|
|
||||||
quasar
|
|
||||||
.dialog({
|
|
||||||
component: RouteListTicketsDialog,
|
|
||||||
componentProps: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.onOk(() => tableRef.value.reload());
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouteSearchbar />
|
<RouteSearchbar />
|
||||||
<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('globals.clone') }}
|
|
||||||
</QBtn>
|
|
||||||
</QCardActions>
|
|
||||||
</QCard>
|
|
||||||
</QDialog>
|
|
||||||
<VnSubToolbar />
|
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<RouteFilter data-key="RouteList" />
|
<RouteFilter data-key="RouteList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
class="route-list"
|
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="RouteList"
|
data-key="RouteList"
|
||||||
url="Routes/filter"
|
url="Routes/filter"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:is-editable="true"
|
|
||||||
:filter="routeFilter"
|
:filter="routeFilter"
|
||||||
redirect="route"
|
redirect="route"
|
||||||
:row-click="false"
|
:row-click="false"
|
||||||
|
@ -314,98 +131,22 @@ const openTicketsDialog = (id) => {
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {},
|
formInitialData: {},
|
||||||
}"
|
}"
|
||||||
save-url="Routes/crud"
|
|
||||||
:disable-option="{ card: true }"
|
|
||||||
table-height="85vh"
|
table-height="85vh"
|
||||||
v-model:selected="selectedRows"
|
|
||||||
:table="{
|
|
||||||
'row-key': 'id',
|
|
||||||
selection: 'multiple',
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<template #moreBeforeActions>
|
<template #column-workerFk="{ row }">
|
||||||
<QBtn
|
<span class="link" @click.stop>
|
||||||
icon="vn:clone"
|
{{ row?.workerUserName }}
|
||||||
color="primary"
|
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||||
class="q-mr-sm"
|
</span>
|
||||||
: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>
|
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.table-input-cell {
|
|
||||||
max-width: 143px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.route-list {
|
|
||||||
width: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table-actions {
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
th:last-child,
|
|
||||||
td:last-child {
|
|
||||||
background-color: var(--vn-section-color);
|
|
||||||
position: sticky;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
|
||||||
newRoute: New Route
|
|
||||||
hourStarted: Started hour
|
|
||||||
hourFinished: Finished hour
|
|
||||||
es:
|
es:
|
||||||
From: Desde
|
|
||||||
To: Hasta
|
|
||||||
Worker: Trabajador
|
Worker: Trabajador
|
||||||
Agency: Agencia
|
Agency: Agencia
|
||||||
Vehicle: Vehículo
|
Vehicle: Vehículo
|
||||||
Volume: Volumen
|
|
||||||
Date: Fecha
|
|
||||||
Description: Descripción
|
Description: Descripción
|
||||||
Hour started: Hora inicio
|
Hour started: Hora inicio
|
||||||
Hour finished: Hora fin
|
Hour finished: Hora fin
|
||||||
KmStart: Km inicio
|
|
||||||
KmEnd: Km fin
|
|
||||||
Served: Servida
|
|
||||||
newRoute: Nueva Ruta
|
|
||||||
Clone Selected Routes: Clonar rutas seleccionadas
|
|
||||||
Select the starting date: Seleccione la fecha de inicio
|
|
||||||
Stating date: Fecha de inicio
|
|
||||||
Cancel: Cancelar
|
|
||||||
Mark as served: Marcar como servidas
|
|
||||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
|
||||||
Add ticket: Añadir tickets
|
|
||||||
Preview: Vista previa
|
|
||||||
Summary: Resumen
|
|
||||||
Route is closed: La ruta está cerrada
|
|
||||||
Route is not served: La ruta no está servida
|
|
||||||
hourStarted: Hora de inicio
|
|
||||||
hourFinished: Hora de fin
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -11,7 +11,14 @@ export default {
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'RouteMain' },
|
redirect: { name: 'RouteMain' },
|
||||||
menus: {
|
menus: {
|
||||||
main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'],
|
main: [
|
||||||
|
'RouteList',
|
||||||
|
'RouteExtendedList',
|
||||||
|
'RouteAutonomous',
|
||||||
|
'RouteRoadmap',
|
||||||
|
'CmrList',
|
||||||
|
'AgencyList',
|
||||||
|
],
|
||||||
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
|
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
@ -19,9 +26,6 @@ export default {
|
||||||
path: '/route',
|
path: '/route',
|
||||||
name: 'RouteMain',
|
name: 'RouteMain',
|
||||||
component: () => import('src/components/common/VnSectionMain.vue'),
|
component: () => import('src/components/common/VnSectionMain.vue'),
|
||||||
props: {
|
|
||||||
leftDrawer: false,
|
|
||||||
},
|
|
||||||
redirect: { name: 'RouteList' },
|
redirect: { name: 'RouteList' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -33,6 +37,15 @@ export default {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Route/RouteList.vue'),
|
component: () => import('src/pages/Route/RouteList.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'extended-list',
|
||||||
|
name: 'RouteExtendedList',
|
||||||
|
meta: {
|
||||||
|
title: 'RouteExtendedList',
|
||||||
|
icon: 'format_list_bulleted',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/RouteExtendedList.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'create',
|
path: 'create',
|
||||||
name: 'RouteCreate',
|
name: 'RouteCreate',
|
||||||
|
@ -78,7 +91,7 @@ export default {
|
||||||
name: 'AgencyList',
|
name: 'AgencyList',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'agencyList',
|
title: 'agencyList',
|
||||||
icon: 'view_list',
|
icon: 'list',
|
||||||
},
|
},
|
||||||
component: () =>
|
component: () =>
|
||||||
import('src/pages/Route/Agency/AgencyList.vue'),
|
import('src/pages/Route/Agency/AgencyList.vue'),
|
||||||
|
|
Loading…
Reference in New Issue