forked from verdnatura/salix-front
feat: refs #7401 add menu options
This commit is contained in:
parent
fdec25dc88
commit
eae2144e1d
|
@ -3,6 +3,7 @@ import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useSession } from 'src/composables/useSession';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -11,10 +12,20 @@ const props = defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const routeId = props.route.id;
|
||||||
|
|
||||||
|
async function openRouteReport() {
|
||||||
|
const url = new URL(window.location).origin;
|
||||||
|
const { getTokenMultimedia } = useSession();
|
||||||
|
const token = getTokenMultimedia();
|
||||||
|
window.open(
|
||||||
|
`${url}/api/Routes/${routeId}/driver-route-pdf?access_token=${token}`,
|
||||||
|
'_blank'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function confirmRemove() {
|
function confirmRemove() {
|
||||||
quasar
|
quasar
|
||||||
|
@ -29,20 +40,51 @@ function confirmRemove() {
|
||||||
.onOk(async () => await router.push({ name: 'RouteList' }));
|
.onOk(async () => await router.push({ name: 'RouteList' }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function sendMail() {
|
||||||
|
const params = {
|
||||||
|
id: routeId,
|
||||||
|
recipient: props?.route?.worker?.user?.emailUser?.email,
|
||||||
|
};
|
||||||
|
console.log('params: ', params);
|
||||||
|
await axios.post(`Routes/${routeId}/driver-route-email`, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function actualizeVolume() {
|
||||||
|
const params = { isOk: true };
|
||||||
|
await axios.post(`Routes/${routeId}/updateVolume`, params);
|
||||||
|
quasar.notify({
|
||||||
|
message: t('globals.dataUpdated'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function remove() {
|
async function remove() {
|
||||||
if (!props.route.id) {
|
await axios.delete(`Routes/${routeId}`);
|
||||||
return;
|
|
||||||
}
|
|
||||||
await axios.delete(`Routes/${props.route.id}`);
|
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
message: t('globals.dataDeleted'),
|
message: t('globals.dataDeleted'),
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add reports
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
<QItem @click="openRouteReport" v-ripple clickable>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="description" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{ t('seeReport') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem @click="sendMail" v-ripple clickable>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="outgoing_mail" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{ t('sendMail') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem @click="actualizeVolume" v-ripple clickable>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="package_2" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{ t('actualizeVolume') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem @click="confirmRemove" v-ripple clickable>
|
<QItem @click="confirmRemove" v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
|
@ -56,8 +98,14 @@ en:
|
||||||
confirmDeletion: Confirm deletion
|
confirmDeletion: Confirm deletion
|
||||||
confirmDeletionMessage: Are you sure you want to delete this route?
|
confirmDeletionMessage: Are you sure you want to delete this route?
|
||||||
deleteRoute: Delete route
|
deleteRoute: Delete route
|
||||||
|
seeReport: See route report
|
||||||
|
sendMail: Send route report
|
||||||
|
actualizeVolume: Actualize volume
|
||||||
es:
|
es:
|
||||||
confirmDeletion: Confirmar eliminación,
|
confirmDeletion: Confirmar eliminación,
|
||||||
confirmDeletionMessage: Seguro que quieres eliminar esta ruta?
|
confirmDeletionMessage: Seguro que quieres eliminar esta ruta?
|
||||||
deleteRoute: Eliminar ruta
|
deleteRoute: Eliminar ruta
|
||||||
|
seeReport: Ver informe de ruta
|
||||||
|
sendMail: Enviar informe de ruta
|
||||||
|
actualizeVolume: Actualizar volumen
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -155,7 +155,7 @@ const onSave = (data, response) => {
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Agency')"
|
:label="t('Agency')"
|
||||||
v-model="data.agencyModeFk"
|
v-model="data.agencyModeFk"
|
||||||
|
@ -170,7 +170,7 @@ const onSave = (data, response) => {
|
||||||
<VnInputDate v-model="data.created" :label="t('Created')" />
|
<VnInputDate v-model="data.created" :label="t('Created')" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<template v-if="!isNew">
|
<template v-if="!isNew">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput v-model="data.kmStart" :label="t('Km Start')" clearable />
|
<VnInput v-model="data.kmStart" :label="t('Km Start')" clearable />
|
||||||
<QInput
|
<QInput
|
||||||
v-model.number="data.kmEnd"
|
v-model.number="data.kmEnd"
|
||||||
|
@ -184,7 +184,7 @@ const onSave = (data, response) => {
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInputTime
|
<VnInputTime
|
||||||
v-model="data.started"
|
v-model="data.started"
|
||||||
:label="t('Hour started')"
|
:label="t('Hour started')"
|
||||||
|
@ -205,7 +205,7 @@ const onSave = (data, response) => {
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.description"
|
v-model="data.description"
|
||||||
:label="t('Description')"
|
:label="t('Description')"
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { toDate, toDateHourMin } from 'filters/index';
|
import { toDateHourMin } from 'filters/index';
|
||||||
import { useStateStore } from 'src/stores/useStateStore';
|
import { useStateStore } from 'src/stores/useStateStore';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
Loading…
Reference in New Issue