forked from verdnatura/salix-front
Ticket expedition
This commit is contained in:
parent
053059997a
commit
fe67f21206
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, onUnmounted, reactive } from 'vue';
|
||||
import { onMounted, ref, computed, onUnmounted, reactive, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
|
@ -28,7 +28,6 @@ const { notify } = useNotify();
|
|||
const { openConfirmationModal } = useVnConfirm();
|
||||
const editPriceProxyRef = ref(null);
|
||||
const newTicketDialogRef = ref(null);
|
||||
const expeditionsFetchDataRef = ref(null);
|
||||
const logsTableDialogRef = ref(null);
|
||||
|
||||
const expeditionsLogsData = ref([]);
|
||||
|
@ -47,18 +46,34 @@ const exprBuilder = (param, value) => {
|
|||
}
|
||||
};
|
||||
|
||||
const arrayData = useArrayData('ticketExpeditions', {
|
||||
const expeditionsFilter = computed(() => ({
|
||||
where: { ticketFk: route.params.id },
|
||||
order: ['created DESC'],
|
||||
}));
|
||||
|
||||
const expeditionsArrayData = useArrayData('ticketExpeditions', {
|
||||
url: 'Expeditions/filter',
|
||||
filter: { where: { ticketFk: route.params.id }, order: ['created DESC'] },
|
||||
filter: expeditionsFilter.value,
|
||||
exprBuilder: exprBuilder,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const ticketExpeditions = computed(() => store.data);
|
||||
const expeditionsStore = expeditionsArrayData.store;
|
||||
const ticketExpeditions = computed(() => expeditionsStore.data);
|
||||
|
||||
// watch(
|
||||
// () => route.params.id,
|
||||
// async () => await getSales()
|
||||
// );
|
||||
const ticketArrayData = useArrayData('ticketData');
|
||||
const ticketStore = ticketArrayData.store;
|
||||
const ticketData = computed(() => ticketStore.data);
|
||||
|
||||
const refetchExpeditions = async () => {
|
||||
await expeditionsArrayData.applyFilter({
|
||||
params: { filter: JSON.stringify(expeditionsFilter.value) },
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async () => await refetchExpeditions(),
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const params = reactive({});
|
||||
|
||||
|
@ -66,7 +81,7 @@ const applyColumnFilter = async (col) => {
|
|||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await arrayData.addFilter({ params });
|
||||
await expeditionsArrayData.addFilter({ params });
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
|
@ -220,7 +235,7 @@ const deleteExpedition = async () => {
|
|||
);
|
||||
const params = { expeditionIds };
|
||||
await axios.post('Expeditions/deleteExpeditions', params);
|
||||
expeditionsFetchDataRef.value.fetch();
|
||||
await refetchExpeditions();
|
||||
selectedExpeditions.value = [];
|
||||
notify(t('expedition.expeditionRemoved'), 'positive');
|
||||
} catch (error) {
|
||||
|
@ -253,7 +268,7 @@ onMounted(async () => {
|
|||
stateStore.rightDrawer = true;
|
||||
const filteredColumns = columns.value.filter((col) => col.name !== 'history');
|
||||
allColumnNames.value = filteredColumns.map((col) => col.name);
|
||||
await arrayData.fetch({ append: false });
|
||||
// await expeditionsArrayData.fetch({ append: false });
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
@ -280,7 +295,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<QBtnDropdown
|
||||
ref="btnDropdownRef"
|
||||
color="primary"
|
||||
:label="t('ticketSale.more')"
|
||||
:label="t('expedition.move')"
|
||||
:disable="!selectedExpeditions.length"
|
||||
>
|
||||
<template #label>
|
||||
|
@ -435,7 +450,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QTable>
|
||||
<QDialog ref="newTicketDialogRef" transition-show="scale" transition-hide="scale">
|
||||
<ExpeditionNewTicket
|
||||
:ticket="ticketExpeditions"
|
||||
:ticket="ticketData"
|
||||
:with-route="newTicketWithRoute"
|
||||
:selected-expeditions="selectedExpeditions"
|
||||
/>
|
||||
|
|
|
@ -98,3 +98,4 @@ expedition:
|
|||
expeditionRemoved: Expedition removed
|
||||
removeExpeditionSubtitle: Are you sure you want to delete this expedition?
|
||||
worker: Worker
|
||||
move: Move
|
||||
|
|
|
@ -97,6 +97,7 @@ expedition:
|
|||
expeditionRemoved: Expedición eliminada
|
||||
removeExpeditionSubtitle: ¿Está seguro de eliminar esta expedición?
|
||||
worker: Trabajador
|
||||
move: Mover
|
||||
card:
|
||||
search: Buscar tickets
|
||||
searchInfo: Buscar tickets por identificador o alias
|
||||
|
|
Loading…
Reference in New Issue