feat: #6321 Show Free lines

This commit is contained in:
Javier Segarra 2024-05-08 14:06:23 +02:00
parent 0984d05220
commit 881e059121
3 changed files with 21 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { computed, onMounted, onUnmounted, ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox } from 'quasar';
import axios from 'axios';
@ -30,6 +30,13 @@ const $props = defineProps({
type: Number,
required: true,
},
filter: {
type: Object,
required: false,
default: () => {
true;
},
},
});
onMounted(() => (stateStore.rightDrawer = false));
onUnmounted(() => (stateStore.rightDrawer = true));
@ -208,7 +215,7 @@ const columns = computed(() => [
},
]);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
const { filter } = toRefs($props);
const emit = defineEmits([...useDialogPluginComponent.emits, 'selection']);
function rowsHasSelected(selection) {
emit(
@ -259,6 +266,10 @@ function freeFirst({ alertLevel: a }, { alertLevel: b }) {
// En cualquier otro caso, no se cambia el orden
return 0;
}
const handleRows = (rows) => {
if (filter.value.showFree) return rows.filter(({ alertLevel }) => alertLevel === 0);
return rows.sort(freeFirst);
};
</script>
<template>
@ -282,7 +293,7 @@ function freeFirst({ alertLevel: a }, { alertLevel: b }) {
<QTable
ref="tableRef"
:columns="columns"
:rows="rows.sort(freeFirst)"
:rows="handleRows(rows)"
row-key="ticketFk"
selection="multiple"
v-model:selected="selectedRows"

View File

@ -11,7 +11,6 @@ import NegativeOriginDialog from 'pages/Ticket/Negative/NegativeOriginDialog.vue
import TotalNegativeOriginDialog from 'pages/Ticket/Negative/TotalNegativeOriginDialog.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useDialogPluginComponent } from 'quasar';
const stateStore = useStateStore();
const { t } = useI18n();
@ -19,8 +18,8 @@ const selectedRows = ref([]);
const showNegativeOriginDialog = ref(false);
const showTotalNegativeOriginDialog = ref(false);
const showProposalDialog = ref(false);
const showFree = ref(true);
const currentRow = ref(null);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
const viewSummary = (row) => {
currentRow.value = row;
@ -153,6 +152,7 @@ const columns = computed(() => [
</QTooltip>
</QBtn></QBtnGroup
>
<QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" />
</template>
</VnSubToolbar>
<div v-show="!currentRow" class="list">
@ -230,7 +230,10 @@ const columns = computed(() => [
</VnPaginate>
</div>
<div v-if="currentRow" class="list">
<TicketLackDetail :id="currentRow?.itemFk"></TicketLackDetail>
<TicketLackDetail
:id="currentRow?.itemFk"
:filter="{ showFree }"
></TicketLackDetail>
</div>
<ItemProposal
ref="proposalDialogRef"

View File

@ -41,3 +41,4 @@ negative:
peticionCompra: 'Petición compra'
isRookie: 'Cliente nuevo'
turno: 'Linea turno'
showFree: Mostrar las lineas Free