feat: #6321 Show Free lines
This commit is contained in:
parent
0984d05220
commit
881e059121
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
import { computed, onMounted, onUnmounted, ref, toRefs } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { QBtn, QCheckbox } from 'quasar';
|
import { QBtn, QCheckbox } from 'quasar';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -30,6 +30,13 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
filter: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: () => {
|
||||||
|
true;
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
onMounted(() => (stateStore.rightDrawer = false));
|
onMounted(() => (stateStore.rightDrawer = false));
|
||||||
onUnmounted(() => (stateStore.rightDrawer = true));
|
onUnmounted(() => (stateStore.rightDrawer = true));
|
||||||
|
@ -208,7 +215,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||||
|
const { filter } = toRefs($props);
|
||||||
const emit = defineEmits([...useDialogPluginComponent.emits, 'selection']);
|
const emit = defineEmits([...useDialogPluginComponent.emits, 'selection']);
|
||||||
function rowsHasSelected(selection) {
|
function rowsHasSelected(selection) {
|
||||||
emit(
|
emit(
|
||||||
|
@ -259,6 +266,10 @@ function freeFirst({ alertLevel: a }, { alertLevel: b }) {
|
||||||
// En cualquier otro caso, no se cambia el orden
|
// En cualquier otro caso, no se cambia el orden
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
const handleRows = (rows) => {
|
||||||
|
if (filter.value.showFree) return rows.filter(({ alertLevel }) => alertLevel === 0);
|
||||||
|
return rows.sort(freeFirst);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -282,7 +293,7 @@ function freeFirst({ alertLevel: a }, { alertLevel: b }) {
|
||||||
<QTable
|
<QTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows.sort(freeFirst)"
|
:rows="handleRows(rows)"
|
||||||
row-key="ticketFk"
|
row-key="ticketFk"
|
||||||
selection="multiple"
|
selection="multiple"
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
|
|
|
@ -11,7 +11,6 @@ import NegativeOriginDialog from 'pages/Ticket/Negative/NegativeOriginDialog.vue
|
||||||
import TotalNegativeOriginDialog from 'pages/Ticket/Negative/TotalNegativeOriginDialog.vue';
|
import TotalNegativeOriginDialog from 'pages/Ticket/Negative/TotalNegativeOriginDialog.vue';
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -19,8 +18,8 @@ const selectedRows = ref([]);
|
||||||
const showNegativeOriginDialog = ref(false);
|
const showNegativeOriginDialog = ref(false);
|
||||||
const showTotalNegativeOriginDialog = ref(false);
|
const showTotalNegativeOriginDialog = ref(false);
|
||||||
const showProposalDialog = ref(false);
|
const showProposalDialog = ref(false);
|
||||||
|
const showFree = ref(true);
|
||||||
const currentRow = ref(null);
|
const currentRow = ref(null);
|
||||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
|
||||||
|
|
||||||
const viewSummary = (row) => {
|
const viewSummary = (row) => {
|
||||||
currentRow.value = row;
|
currentRow.value = row;
|
||||||
|
@ -153,6 +152,7 @@ const columns = computed(() => [
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn></QBtnGroup
|
</QBtn></QBtnGroup
|
||||||
>
|
>
|
||||||
|
<QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" />
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<div v-show="!currentRow" class="list">
|
<div v-show="!currentRow" class="list">
|
||||||
|
@ -230,7 +230,10 @@ const columns = computed(() => [
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="currentRow" class="list">
|
<div v-if="currentRow" class="list">
|
||||||
<TicketLackDetail :id="currentRow?.itemFk"></TicketLackDetail>
|
<TicketLackDetail
|
||||||
|
:id="currentRow?.itemFk"
|
||||||
|
:filter="{ showFree }"
|
||||||
|
></TicketLackDetail>
|
||||||
</div>
|
</div>
|
||||||
<ItemProposal
|
<ItemProposal
|
||||||
ref="proposalDialogRef"
|
ref="proposalDialogRef"
|
||||||
|
|
|
@ -41,3 +41,4 @@ negative:
|
||||||
peticionCompra: 'Petición compra'
|
peticionCompra: 'Petición compra'
|
||||||
isRookie: 'Cliente nuevo'
|
isRookie: 'Cliente nuevo'
|
||||||
turno: 'Linea turno'
|
turno: 'Linea turno'
|
||||||
|
showFree: Mostrar las lineas Free
|
||||||
|
|
Loading…
Reference in New Issue