Merge branch 'dev' into 7347_supplierConsumption
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
253b30822c
|
@ -34,7 +34,7 @@ import VnTableFilter from './VnTableFilter.vue';
|
||||||
import { getColAlign } from 'src/composables/getColAlign';
|
import { getColAlign } from 'src/composables/getColAlign';
|
||||||
import RightMenu from '../common/RightMenu.vue';
|
import RightMenu from '../common/RightMenu.vue';
|
||||||
import VnScroll from '../common/VnScroll.vue';
|
import VnScroll from '../common/VnScroll.vue';
|
||||||
import VnMultiCheck from '../common/VnMultiCheck.vue';
|
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
||||||
|
|
||||||
const arrayData = useArrayData(useAttrs()['data-key']);
|
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -214,7 +214,7 @@ onBeforeMount(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if ($props.isEditable) document.addEventListener('mousedown', mousedownHandler);
|
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
||||||
mode.value =
|
mode.value =
|
||||||
quasar.platform.is.mobile && !$props.disableOption?.card
|
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||||
? CARD_MODE
|
? CARD_MODE
|
||||||
|
@ -237,7 +237,7 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(async () => {
|
onUnmounted(async () => {
|
||||||
if ($props.isEditable) document.removeEventListener('mousedown', mousedownHandler);
|
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -385,7 +385,7 @@ function hasEditableFormat(column) {
|
||||||
if (isEditableColumn(column)) return 'editable-text';
|
if (isEditableColumn(column)) return 'editable-text';
|
||||||
}
|
}
|
||||||
|
|
||||||
const mousedownHandler = async (event) => {
|
const clickHandler = async (event) => {
|
||||||
const clickedElement = event.target.closest('td');
|
const clickedElement = event.target.closest('td');
|
||||||
const isDateElement = event.target.closest('.q-date');
|
const isDateElement = event.target.closest('.q-date');
|
||||||
const isTimeElement = event.target.closest('.q-time');
|
const isTimeElement = event.target.closest('.q-time');
|
||||||
|
@ -408,7 +408,6 @@ const mousedownHandler = async (event) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEditableColumn(column)) {
|
if (isEditableColumn(column)) {
|
||||||
event.preventDefault();
|
|
||||||
await renderInput(Number(rowIndex), colField, clickedElement);
|
await renderInput(Number(rowIndex), colField, clickedElement);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -645,21 +644,15 @@ const rowCtrlClickFunction = computed(() => {
|
||||||
};
|
};
|
||||||
return () => {};
|
return () => {};
|
||||||
});
|
});
|
||||||
const handleMultiCheck = (value) => {
|
const handleHeaderSelection = (evt, data) => {
|
||||||
if (value) {
|
if (evt === 'selected' && data) {
|
||||||
selected.value = tableRef.value.rows;
|
selected.value = tableRef.value.rows;
|
||||||
} else {
|
} else if (evt === 'selectAll') {
|
||||||
selected.value = [];
|
|
||||||
}
|
|
||||||
emit('update:selected', selected.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSelectedAll = (data) => {
|
|
||||||
if (data) {
|
|
||||||
selected.value = data;
|
selected.value = data;
|
||||||
} else {
|
} else {
|
||||||
selected.value = [];
|
selected.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('update:selected', selected.value);
|
emit('update:selected', selected.value);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -725,14 +718,14 @@ const handleSelectedAll = (data) => {
|
||||||
:data-cy
|
:data-cy
|
||||||
>
|
>
|
||||||
<template #header-selection>
|
<template #header-selection>
|
||||||
<VnMultiCheck
|
<VnCheckboxMenu
|
||||||
:searchUrl="searchUrl"
|
:searchUrl="searchUrl"
|
||||||
:expand="$props.multiCheck.expand"
|
:expand="$props.multiCheck.expand"
|
||||||
v-model="selectAll"
|
v-model="selectAll"
|
||||||
:url="$attrs['url']"
|
:url="$attrs['url']"
|
||||||
@update:selected="handleMultiCheck"
|
@update:selected="handleHeaderSelection('selected', $event)"
|
||||||
@select:all="handleSelectedAll"
|
@select:all="handleHeaderSelection('selectAll', $event)"
|
||||||
></VnMultiCheck>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #top-left v-if="!$props.withoutHeader">
|
<template #top-left v-if="!$props.withoutHeader">
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import VnCheckbox from './VnCheckbox.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { toRaw } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
const route = useRoute();
|
||||||
|
const { t } = useI18n();
|
||||||
|
const model = defineModel({ type: [Boolean] });
|
||||||
|
const props = defineProps({
|
||||||
|
expand: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
searchUrl: {
|
||||||
|
type: [String, Boolean],
|
||||||
|
default: 'table',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const value = ref(false);
|
||||||
|
const menuRef = ref(null);
|
||||||
|
const errorMessage = ref(null);
|
||||||
|
const rows = ref(0);
|
||||||
|
const onClick = async () => {
|
||||||
|
if (value.value) {
|
||||||
|
const { filter } = JSON.parse(route.query[props.searchUrl]);
|
||||||
|
filter.limit = 0;
|
||||||
|
const params = {
|
||||||
|
params: { filter: JSON.stringify(filter) },
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get(props.url, params);
|
||||||
|
rows.value = data;
|
||||||
|
} catch (error) {
|
||||||
|
const response = error.response;
|
||||||
|
if (response.data.error.name === 'UserError') {
|
||||||
|
errorMessage.value = t('tooManyResults');
|
||||||
|
} else {
|
||||||
|
errorMessage.value = response.data.error.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
defineEmits(['update:selected', 'select:all']);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex items-center no-wrap" style="display: flex">
|
||||||
|
<VnCheckbox v-model="value" @click="$emit('update:selected', value)" />
|
||||||
|
<QIcon
|
||||||
|
style="margin-left: -10px"
|
||||||
|
data-cy="btnMultiCheck"
|
||||||
|
v-if="value && $props.expand"
|
||||||
|
name="expand_more"
|
||||||
|
@click="onClick"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QMenu
|
||||||
|
fit
|
||||||
|
anchor="bottom start"
|
||||||
|
self="top left"
|
||||||
|
ref="menuRef"
|
||||||
|
data-cy="menuMultiCheck"
|
||||||
|
>
|
||||||
|
<QList separator>
|
||||||
|
<QItem
|
||||||
|
data-cy="selectAll"
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="
|
||||||
|
$refs.menuRef.hide();
|
||||||
|
$emit('select:all', toRaw(rows));
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
<span v-text="t('Select all')" />
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel overline caption>
|
||||||
|
<span
|
||||||
|
v-if="errorMessage"
|
||||||
|
class="text-negative"
|
||||||
|
v-text="errorMessage"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-else
|
||||||
|
v-text="t('records', { rows: rows.length })"
|
||||||
|
/>
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<slot name="more-options"></slot>
|
||||||
|
</QList>
|
||||||
|
</QMenu>
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<i18n lang="yml">
|
||||||
|
en:
|
||||||
|
tooManyResults: Too many results. Please narrow down your search.
|
||||||
|
records: '{rows} records'
|
||||||
|
es:
|
||||||
|
Select all: Seleccionar todo
|
||||||
|
tooManyResults: Demasiados registros. Restringe la búsqueda.
|
||||||
|
records: '{rows} registros'
|
||||||
|
</i18n>
|
|
@ -1,80 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import VnCheckbox from './VnCheckbox.vue';
|
|
||||||
import axios from 'axios';
|
|
||||||
import { toRaw } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const model = defineModel({ type: [Boolean] });
|
|
||||||
const props = defineProps({
|
|
||||||
expand: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: String,
|
|
||||||
default: null,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
searchUrl: {
|
|
||||||
type: [String, Boolean],
|
|
||||||
default: 'table',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const value = ref(false);
|
|
||||||
const rows = ref(0);
|
|
||||||
const onClick = () => {
|
|
||||||
if (value.value) {
|
|
||||||
const { filter } = JSON.parse(route.query[props.searchUrl]);
|
|
||||||
filter.limit = 0;
|
|
||||||
const params = {
|
|
||||||
params: { filter: JSON.stringify(filter) },
|
|
||||||
};
|
|
||||||
axios
|
|
||||||
.get(props.url, params)
|
|
||||||
.then(({ data }) => {
|
|
||||||
rows.value = data;
|
|
||||||
})
|
|
||||||
.catch(console.error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
defineEmits(['update:selected', 'select:all']);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div style="display: flex">
|
|
||||||
<VnCheckbox v-model="value" @click="$emit('update:selected', value)" />
|
|
||||||
<QBtn
|
|
||||||
v-if="value && $props.expand"
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
icon="expand_more"
|
|
||||||
@click="onClick"
|
|
||||||
>
|
|
||||||
<QMenu anchor="bottom right" self="top right">
|
|
||||||
<QList>
|
|
||||||
<QItem v-ripple clickable @click="$emit('select:all', toRaw(rows))">
|
|
||||||
{{ t('Select all', { rows: rows.length }) }}
|
|
||||||
</QItem>
|
|
||||||
<slot name="more-options"></slot>
|
|
||||||
</QList>
|
|
||||||
</QMenu>
|
|
||||||
</QBtn>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<i18n lang="yml">
|
|
||||||
en:
|
|
||||||
Select all: 'Select all ({rows})'
|
|
||||||
fr:
|
|
||||||
Select all: 'Sélectionner tout ({rows})'
|
|
||||||
es:
|
|
||||||
Select all: 'Seleccionar todo ({rows})'
|
|
||||||
de:
|
|
||||||
Select all: 'Alle auswählen ({rows})'
|
|
||||||
it:
|
|
||||||
Select all: 'Seleziona tutto ({rows})'
|
|
||||||
pt:
|
|
||||||
Select all: 'Selecionar tudo ({rows})'
|
|
||||||
</i18n>
|
|
|
@ -161,7 +161,7 @@ const arrayData = useArrayData(arrayDataKey, {
|
||||||
searchUrl: false,
|
searchUrl: false,
|
||||||
mapKey: $attrs['map-key'],
|
mapKey: $attrs['map-key'],
|
||||||
});
|
});
|
||||||
|
const isMenuOpened = ref(false);
|
||||||
const computedSortBy = computed(() => {
|
const computedSortBy = computed(() => {
|
||||||
return $props.sortBy || $props.optionLabel + ' ASC';
|
return $props.sortBy || $props.optionLabel + ' ASC';
|
||||||
});
|
});
|
||||||
|
@ -186,7 +186,9 @@ onMounted(() => {
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
const someIsLoading = computed(() => isLoading.value || !!arrayData?.isLoading?.value);
|
const someIsLoading = computed(
|
||||||
|
() => (isLoading.value || !!arrayData?.isLoading?.value) && !isMenuOpened.value,
|
||||||
|
);
|
||||||
function findKeyInOptions() {
|
function findKeyInOptions() {
|
||||||
if (!$props.options) return;
|
if (!$props.options) return;
|
||||||
return filter($props.modelValue, $props.options)?.length;
|
return filter($props.modelValue, $props.options)?.length;
|
||||||
|
@ -369,6 +371,8 @@ function getCaption(opt) {
|
||||||
:input-debounce="useURL ? '300' : '0'"
|
:input-debounce="useURL ? '300' : '0'"
|
||||||
:loading="someIsLoading"
|
:loading="someIsLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
|
@popup-hide="isMenuOpened = false"
|
||||||
|
@popup-show="isMenuOpened = true"
|
||||||
@keydown="handleKeyDown"
|
@keydown="handleKeyDown"
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
:data-url="url"
|
:data-url="url"
|
||||||
|
|
|
@ -89,7 +89,6 @@ const columns = computed(() => [
|
||||||
<CustomerNotificationsCampaignConsumption
|
<CustomerNotificationsCampaignConsumption
|
||||||
:selected-rows="selected.length > 0"
|
:selected-rows="selected.length > 0"
|
||||||
:clients="selected"
|
:clients="selected"
|
||||||
:promise="refreshData"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
|
|
@ -142,13 +142,13 @@ onMounted(async () => {
|
||||||
valentinesDay: Valentine's Day
|
valentinesDay: Valentine's Day
|
||||||
mothersDay: Mother's Day
|
mothersDay: Mother's Day
|
||||||
allSaints: All Saints' Day
|
allSaints: All Saints' Day
|
||||||
Campaign consumption: Campaign consumption ({rows})
|
Campaign consumption: Campaign consumption - {rows} records
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
valentinesDay: Día de San Valentín
|
valentinesDay: Día de San Valentín
|
||||||
mothersDay: Día de la Madre
|
mothersDay: Día de la Madre
|
||||||
allSaints: Día de Todos los Santos
|
allSaints: Día de Todos los Santos
|
||||||
Campaign consumption: Consumo campaña ({rows})
|
Campaign consumption: Consumo campaña - {rows} registros
|
||||||
Campaign: Campaña
|
Campaign: Campaña
|
||||||
From: Desde
|
From: Desde
|
||||||
To: Hasta
|
To: Hasta
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('InvoiceOut list', () => {
|
||||||
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should download all pdfs', () => {
|
it.skip('should download all pdfs', () => {
|
||||||
cy.get(columnCheckbox).click();
|
cy.get(columnCheckbox).click();
|
||||||
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
||||||
});
|
});
|
||||||
|
@ -31,7 +31,7 @@ describe('InvoiceOut list', () => {
|
||||||
it('should open the invoice descriptor from table icon', () => {
|
it('should open the invoice descriptor from table icon', () => {
|
||||||
cy.get(firstSummaryIcon).click();
|
cy.get(firstSummaryIcon).click();
|
||||||
cy.get('.cardSummary').should('be.visible');
|
cy.get('.cardSummary').should('be.visible');
|
||||||
cy.get('.summaryHeader > div').should('include.text', 'V10100001');
|
cy.get('.summaryHeader > div').should('include.text', 'A1111111');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the client descriptor', () => {
|
it('should open the client descriptor', () => {
|
||||||
|
|
Loading…
Reference in New Issue