forked from verdnatura/salix-front
updates
This commit is contained in:
parent
577c21e601
commit
d3b93b710d
|
@ -111,7 +111,7 @@ const onDataSaved = async () => {
|
|||
:filter="filterBanks"
|
||||
@on-fetch="(data) => (bankOptions = data)"
|
||||
auto-load
|
||||
url="dAccountings"
|
||||
url="Accountings"
|
||||
/>
|
||||
<fetch-data
|
||||
:filter="filterClientFindOne"
|
||||
|
|
|
@ -216,6 +216,7 @@ const entriesTableColumns = computed(() => {
|
|||
});
|
||||
|
||||
const copyOriginalRowsData = (rows) => {
|
||||
// el objetivo de esto es guardar los valores iniciales de todas las rows para evitar guardar cambios si la data no cambió al disparar los eventos
|
||||
originalRowDataCopy.value = JSON.parse(JSON.stringify(rows));
|
||||
};
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ async function insert() {
|
|||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Accountidngs"
|
||||
url="Accountings"
|
||||
auto-load
|
||||
limit="30"
|
||||
@on-fetch="(data) => (banks = data)"
|
||||
|
|
|
@ -8,7 +8,7 @@ import FetchData from 'components/FetchData.vue';
|
|||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const showChangeStateDialog = ref(false);
|
||||
const showSplitDialog = ref(false);
|
||||
const newState = ref(null);
|
||||
const resultSplit = ref([]);
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
|
@ -25,7 +25,7 @@ onMounted(() => {
|
|||
|
||||
const updateState = async () => {
|
||||
try {
|
||||
showChangeStateDialog.value = true;
|
||||
showSplitDialog.value = true;
|
||||
const rowsToUpdate = $props.tickets.map(({ ticketFk }) =>
|
||||
axios.post(`Tickets/state`, {
|
||||
ticketFk,
|
||||
|
@ -39,47 +39,10 @@ const updateState = async () => {
|
|||
dialogRef.value.hide({ type: 'refresh', refresh: true });
|
||||
}
|
||||
};
|
||||
const step = ref(1);
|
||||
|
||||
const labelStepperBtn = (step) => {
|
||||
switch (step) {
|
||||
case 1:
|
||||
return 'Split';
|
||||
|
||||
case 2:
|
||||
return 'Finish';
|
||||
|
||||
default:
|
||||
return 'Continue';
|
||||
}
|
||||
};
|
||||
const clickStepperBtn = () => {
|
||||
switch (stepperRef.value.modelValue) {
|
||||
case 1:
|
||||
split();
|
||||
default:
|
||||
stepperRef.value.next();
|
||||
break;
|
||||
}
|
||||
};
|
||||
const statusStepperBtn = () => {
|
||||
switch (stepperRef.value.modelValue) {
|
||||
case 1:
|
||||
return ticketsSelected.value.length < 1;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
const split = async (data = ticketsSelected.value) => {
|
||||
await axios.post(`Tickets/split`, data);
|
||||
resultSplit.value = data;
|
||||
};
|
||||
const stepperRef = ref(null);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide" v-model="showChangeStateDialog">
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide" v-model="showSplitDialog">
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<QAvatar
|
||||
|
@ -96,65 +59,26 @@ const stepperRef = ref(null);
|
|||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
<QCardSection class="row items-center justify-center column items-stretch">
|
||||
{{ tickets }}
|
||||
<QStepper v-model="step" ref="stepperRef" color="primary" animated>
|
||||
<QStep :name="1" title="Confirm tickets to split" icon="settings">
|
||||
{{ ticketsSelected }}
|
||||
<div>
|
||||
<QCheckbox
|
||||
class="q-pa-md"
|
||||
v-for="(ticket, index) in tickets"
|
||||
:key="index"
|
||||
v-model="ticketsSelected"
|
||||
:label="` Ticket: ${ticket.ticketFk}`"
|
||||
:val="ticket.ticketFk"
|
||||
>
|
||||
</QCheckbox>
|
||||
</div>
|
||||
</QStep>
|
||||
<QStep
|
||||
:name="2"
|
||||
title="Handle tickets splitted"
|
||||
icon="settings"
|
||||
:done="step > 2"
|
||||
><VnPaginate data-key="splitLack" :data="tickets">
|
||||
<template #body="{ rows }">
|
||||
<QTable :rows="rows" :columns="columns">
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTh
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
<QTr :props="props"></QTr
|
||||
></template> </QTable
|
||||
></template> </VnPaginate
|
||||
></QStep>
|
||||
<template #navigation>
|
||||
<QStepperNavigation>
|
||||
<QBtn
|
||||
@click="clickStepperBtn"
|
||||
color="primary"
|
||||
:label="labelStepperBtn(step)"
|
||||
:disabled="statusStepperBtn()"
|
||||
/>
|
||||
<QBtn
|
||||
v-if="step > 1"
|
||||
flat
|
||||
color="primary"
|
||||
@click="stepperRef.previous()"
|
||||
label="Back"
|
||||
class="q-ml-sm"
|
||||
/>
|
||||
</QStepperNavigation>
|
||||
</template>
|
||||
</QStepper>
|
||||
{{ tickets
|
||||
}}<VnPaginate data-key="splitLack" :data="tickets">
|
||||
<template #body="{ rows }">
|
||||
<QTable :rows="rows" :columns="columns">
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTh
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
<QTr :props="props"></QTr
|
||||
></template> </QTable
|
||||
></template>
|
||||
</VnPaginate>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn :label="t('globals.next')" color="primary" flat v-close-popup />
|
||||
|
|
|
@ -315,6 +315,10 @@ const handleRows = (rows) => {
|
|||
if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
|
||||
return rows.sort(freeFirst);
|
||||
};
|
||||
const split = async (data = selectedRows.value) => {
|
||||
await axios.post(`Tickets/split`, data);
|
||||
resultSplit.value = data;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -360,7 +364,14 @@ const handleRows = (rows) => {
|
|||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
@click="showSplitDialog = true"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('negative.detail.split.title'),
|
||||
t('negative.detail.split.subTitle'),
|
||||
() => split,
|
||||
() => (showSplitDialog = true)
|
||||
)
|
||||
"
|
||||
:disable="selectedRows.length < 1"
|
||||
icon="call_split"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue