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 RightMenu from '../common/RightMenu.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 $props = defineProps({
|
||||
|
@ -214,7 +214,7 @@ onBeforeMount(() => {
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if ($props.isEditable) document.addEventListener('mousedown', mousedownHandler);
|
||||
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
||||
mode.value =
|
||||
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||
? CARD_MODE
|
||||
|
@ -237,7 +237,7 @@ onMounted(async () => {
|
|||
});
|
||||
|
||||
onUnmounted(async () => {
|
||||
if ($props.isEditable) document.removeEventListener('mousedown', mousedownHandler);
|
||||
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
||||
});
|
||||
|
||||
watch(
|
||||
|
@ -385,7 +385,7 @@ function hasEditableFormat(column) {
|
|||
if (isEditableColumn(column)) return 'editable-text';
|
||||
}
|
||||
|
||||
const mousedownHandler = async (event) => {
|
||||
const clickHandler = async (event) => {
|
||||
const clickedElement = event.target.closest('td');
|
||||
const isDateElement = event.target.closest('.q-date');
|
||||
const isTimeElement = event.target.closest('.q-time');
|
||||
|
@ -408,7 +408,6 @@ const mousedownHandler = async (event) => {
|
|||
}
|
||||
|
||||
if (isEditableColumn(column)) {
|
||||
event.preventDefault();
|
||||
await renderInput(Number(rowIndex), colField, clickedElement);
|
||||
}
|
||||
};
|
||||
|
@ -645,21 +644,15 @@ const rowCtrlClickFunction = computed(() => {
|
|||
};
|
||||
return () => {};
|
||||
});
|
||||
const handleMultiCheck = (value) => {
|
||||
if (value) {
|
||||
const handleHeaderSelection = (evt, data) => {
|
||||
if (evt === 'selected' && data) {
|
||||
selected.value = tableRef.value.rows;
|
||||
} else {
|
||||
selected.value = [];
|
||||
}
|
||||
emit('update:selected', selected.value);
|
||||
};
|
||||
|
||||
const handleSelectedAll = (data) => {
|
||||
if (data) {
|
||||
} else if (evt === 'selectAll') {
|
||||
selected.value = data;
|
||||
} else {
|
||||
selected.value = [];
|
||||
}
|
||||
|
||||
emit('update:selected', selected.value);
|
||||
};
|
||||
</script>
|
||||
|
@ -725,14 +718,14 @@ const handleSelectedAll = (data) => {
|
|||
:data-cy
|
||||
>
|
||||
<template #header-selection>
|
||||
<VnMultiCheck
|
||||
<VnCheckboxMenu
|
||||
:searchUrl="searchUrl"
|
||||
:expand="$props.multiCheck.expand"
|
||||
v-model="selectAll"
|
||||
:url="$attrs['url']"
|
||||
@update:selected="handleMultiCheck"
|
||||
@select:all="handleSelectedAll"
|
||||
></VnMultiCheck>
|
||||
@update:selected="handleHeaderSelection('selected', $event)"
|
||||
@select:all="handleHeaderSelection('selectAll', $event)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<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,
|
||||
mapKey: $attrs['map-key'],
|
||||
});
|
||||
|
||||
const isMenuOpened = ref(false);
|
||||
const computedSortBy = computed(() => {
|
||||
return $props.sortBy || $props.optionLabel + ' ASC';
|
||||
});
|
||||
|
@ -186,7 +186,9 @@ onMounted(() => {
|
|||
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() {
|
||||
if (!$props.options) return;
|
||||
return filter($props.modelValue, $props.options)?.length;
|
||||
|
@ -369,6 +371,8 @@ function getCaption(opt) {
|
|||
:input-debounce="useURL ? '300' : '0'"
|
||||
:loading="someIsLoading"
|
||||
@virtual-scroll="onScroll"
|
||||
@popup-hide="isMenuOpened = false"
|
||||
@popup-show="isMenuOpened = true"
|
||||
@keydown="handleKeyDown"
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||
:data-url="url"
|
||||
|
|
|
@ -89,7 +89,6 @@ const columns = computed(() => [
|
|||
<CustomerNotificationsCampaignConsumption
|
||||
:selected-rows="selected.length > 0"
|
||||
:clients="selected"
|
||||
:promise="refreshData"
|
||||
/>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
|
|
@ -142,13 +142,13 @@ onMounted(async () => {
|
|||
valentinesDay: Valentine's Day
|
||||
mothersDay: Mother's Day
|
||||
allSaints: All Saints' Day
|
||||
Campaign consumption: Campaign consumption ({rows})
|
||||
Campaign consumption: Campaign consumption - {rows} records
|
||||
es:
|
||||
params:
|
||||
valentinesDay: Día de San Valentín
|
||||
mothersDay: Día de la Madre
|
||||
allSaints: Día de Todos los Santos
|
||||
Campaign consumption: Consumo campaña ({rows})
|
||||
Campaign consumption: Consumo campaña - {rows} registros
|
||||
Campaign: Campaña
|
||||
From: Desde
|
||||
To: Hasta
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('InvoiceOut list', () => {
|
|||
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
||||
});
|
||||
|
||||
it('should download all pdfs', () => {
|
||||
it.skip('should download all pdfs', () => {
|
||||
cy.get(columnCheckbox).click();
|
||||
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ describe('InvoiceOut list', () => {
|
|||
it('should open the invoice descriptor from table icon', () => {
|
||||
cy.get(firstSummaryIcon).click();
|
||||
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', () => {
|
||||
|
|
Loading…
Reference in New Issue