refactor: refs #6822 transferEntry moved to descriptor menu

This commit is contained in:
Robert Ferrús 2025-01-16 12:27:24 +01:00
parent 70b872b912
commit f3f4d03c16
2 changed files with 40 additions and 34 deletions

View File

@ -2,17 +2,10 @@
import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { useQuasar } from 'quasar';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { toDate } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import useNotify from 'src/composables/useNotify.js';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import filter from './EntryFilter.js';
import EntryDescriptorMenu from './EntryDescriptorMenu.vue';
const $props = defineProps({
@ -23,13 +16,10 @@ const $props = defineProps({
},
});
const quasar = useQuasar();
const route = useRoute();
const { t } = useI18n();
const entryDescriptorRef = ref(null);
const url = ref();
const { notify } = useNotify();
const entryFilter = {
include: [
{
@ -66,7 +56,6 @@ const entryFilter = {
},
],
};
const entityId = computed(() => {
return $props.id || route.params.id;
});
@ -94,27 +83,6 @@ const getEntryRedirectionFilter = (entry) => {
to,
});
};
const showEntryReport = () => {
openReport(`Entries/${route.params.id}/entry-order-pdf`);
};
const transferEntry = async () => {
let response = await axios.post(`Entries/${route.params.id}/transfer`);
notify('globals.dataSaved', 'positive');
const url = `#/entry/${response.data.newEntryFk[0].newEntryFk}/summary`;
window.open(url, '_blank');
};
const openDialog = () => {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('Se van a transferir las compra al dia siguiente'),
promise: transferEntry,
},
});
};
</script>
<template>
@ -122,7 +90,7 @@ const openDialog = () => {
ref="entryDescriptorRef"
module="Entry"
:url="`Entries/${entityId}`"
:filter="filter"
:filter="entryFilter"
title="supplier.nickname"
data-key="Entry"
>
@ -214,5 +182,4 @@ es:
Go to module index: Ir al índice del modulo
Inventory entry: Es inventario
Virtual entry: Es una redada
Transfer Entry: Transferir Entrada
</i18n>

View File

@ -1,5 +1,11 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useQuasar } from 'quasar';
import axios from 'axios';
import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify.js';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
const { openReport } = usePrintService();
@ -9,14 +15,47 @@ const $props = defineProps({
required: true,
},
});
const { t } = useI18n();
const { notify } = useNotify();
const quasar = useQuasar();
const route = useRoute();
function showEntryReport() {
openReport(`Entries/${$props.id}/entry-order-pdf`);
}
const openDialog = () => {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('transferEntryDialog'),
promise: transferEntry,
},
});
};
const transferEntry = async () => {
let response = await axios.post(`Entries/${route.params.id}/transfer`);
notify('globals.dataSaved', 'positive');
const url = `#/entry/${response.data.newEntryFk[0].newEntryFk}/summary`;
window.open(url, '_blank');
};
</script>
<template>
<QItem v-ripple clickable @click="showEntryReport">
<QItemSection>{{ $t('entryList.list.showEntryReport') }}</QItemSection>
</QItem>
<QItem v-ripple clickable @click="openDialog">
<QItemSection>{{ t('transferEntry') }}</QItemSection>
</QItem>
</template>
<i18n>
en:
transferEntryDialog: The entries will be transferred to the next day
transferEntry: Transfer Entry
es:
transferEntryDialog: Se van a transferir las compras al dia siguiente
transferEntry: Transferir Entrada
</i18n>