Merge branch 'dev' into 7949-TicketModifications
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jon Elias 2025-02-27 14:01:31 +00:00
commit 00fff12093
9 changed files with 58 additions and 35 deletions

2
Jenkinsfile vendored
View File

@ -125,7 +125,7 @@ pipeline {
always { always {
sh "docker-compose ${env.COMPOSE_PARAMS} down -v" sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
junit( junit(
testResults: 'junit/e2e.xml', testResults: 'junit/e2e-*.xml',
allowEmptyResults: true allowEmptyResults: true
) )
} }

View File

@ -6,7 +6,7 @@ if (process.env.CI) {
urlHost = 'front'; urlHost = 'front';
reporter = 'junit'; reporter = 'junit';
reporterOptions = { reporterOptions = {
mochaFile: 'junit/e2e.xml', mochaFile: 'junit/e2e-[hash].xml',
toConsole: false, toConsole: false,
}; };
} else { } else {

View File

@ -310,8 +310,14 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
if (evt?.shiftKey && added) { if (evt?.shiftKey && added) {
const rowIndex = selectedRows[0].$index; const rowIndex = selectedRows[0].$index;
const selectedIndexes = new Set(selected.value.map((row) => row.$index)); const selectedIndexes = new Set(selected.value.map((row) => row.$index));
for (const row of rows) { const minIndex = selectedIndexes.size
if (row.$index == rowIndex) break; ? Math.min(...selectedIndexes, rowIndex)
: 0;
const maxIndex = Math.max(...selectedIndexes, rowIndex);
for (let i = minIndex; i <= maxIndex; i++) {
const row = rows[i];
if (row.$index == rowIndex) continue;
if (!selectedIndexes.has(row.$index)) { if (!selectedIndexes.has(row.$index)) {
selected.value.push(row); selected.value.push(row);
selectedIndexes.add(row.$index); selectedIndexes.add(row.$index);

View File

@ -27,30 +27,58 @@ describe('VnTable', () => {
beforeEach(() => (vm.selected = [])); beforeEach(() => (vm.selected = []));
describe('handleSelection()', () => { describe('handleSelection()', () => {
const rows = [{ $index: 0 }, { $index: 1 }, { $index: 2 }]; const rows = [
{ $index: 0 },
{ $index: 1 },
{ $index: 2 },
{ $index: 3 },
{ $index: 4 },
];
it('should add rows to selected when shift key is pressed and rows are added in ascending order', () => {
const selectedRows = [{ $index: 1 }]; const selectedRows = [{ $index: 1 }];
it('should add rows to selected when shift key is pressed and rows are added except last one', () => {
vm.handleSelection( vm.handleSelection(
{ evt: { shiftKey: true }, added: true, rows: selectedRows }, { evt: { shiftKey: true }, added: true, rows: selectedRows },
rows rows,
); );
expect(vm.selected).toEqual([{ $index: 0 }]); expect(vm.selected).toEqual([{ $index: 0 }]);
}); });
it('should add rows to selected when shift key is pressed and rows are added in descending order', () => {
const selectedRows = [{ $index: 3 }];
vm.handleSelection(
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
rows,
);
expect(vm.selected).toEqual([{ $index: 0 }, { $index: 1 }, { $index: 2 }]);
});
it('should not add rows to selected when shift key is not pressed', () => { it('should not add rows to selected when shift key is not pressed', () => {
const selectedRows = [{ $index: 1 }];
vm.handleSelection( vm.handleSelection(
{ evt: { shiftKey: false }, added: true, rows: selectedRows }, { evt: { shiftKey: false }, added: true, rows: selectedRows },
rows rows,
); );
expect(vm.selected).toEqual([]); expect(vm.selected).toEqual([]);
}); });
it('should not add rows to selected when rows are not added', () => { it('should not add rows to selected when rows are not added', () => {
const selectedRows = [{ $index: 1 }];
vm.handleSelection( vm.handleSelection(
{ evt: { shiftKey: true }, added: false, rows: selectedRows }, { evt: { shiftKey: true }, added: false, rows: selectedRows },
rows rows,
); );
expect(vm.selected).toEqual([]); expect(vm.selected).toEqual([]);
}); });
it('should add all rows between the smallest and largest selected indexes', () => {
vm.selected = [{ $index: 1 }, { $index: 3 }];
const selectedRows = [{ $index: 4 }];
vm.handleSelection(
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
rows,
);
expect(vm.selected).toEqual([{ $index: 1 }, { $index: 3 }, { $index: 2 }]);
});
}); });
}); });

View File

@ -204,8 +204,9 @@ async function search() {
} }
:deep(.q-field--focused) { :deep(.q-field--focused) {
.q-icon { .q-icon,
color: black; .q-placeholder {
color: var(--vn-black-text-color);
} }
} }

View File

@ -65,7 +65,7 @@ const entriesTableColumns = computed(() => [
]); ]);
function downloadCSV(rows) { function downloadCSV(rows) {
const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'comment']; const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'grouping', 'comment'];
const csvRows = rows.map((row) => { const csvRows = rows.map((row) => {
const buy = row; const buy = row;
@ -77,6 +77,7 @@ function downloadCSV(rows) {
item.name || '', item.name || '',
buy.stickers, buy.stickers,
buy.packing, buy.packing,
buy.grouping,
item.comment || '', item.comment || '',
].join(','); ].join(',');
}); });

View File

@ -120,22 +120,9 @@ const updateStock = async () => {
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('globals.producer')" :value="dashIfEmpty(entity.subName)" /> <VnLv :label="t('globals.producer')" :value="dashIfEmpty(entity.subName)" />
<VnLv <VnLv v-if="entity?.value5" :label="entity?.tag5" :value="entity.value5" />
v-if="entity.value5" <VnLv v-if="entity?.value6" :label="entity?.tag6" :value="entity.value6" />
:label="t('item.descriptor.color')" <VnLv v-if="entity?.value7" :label="entity?.tag7" :value="entity.value7" />
:value="entity.value5"
>
</VnLv>
<VnLv
v-if="entity.value6"
:label="t('item.descriptor.category')"
:value="entity.value6"
/>
<VnLv
v-if="entity.value7"
:label="t('item.list.stems')"
:value="entity.value7"
/>
</template> </template>
<template #icons="{ entity }"> <template #icons="{ entity }">
<QCardActions v-if="entity" class="q-gutter-x-md"> <QCardActions v-if="entity" class="q-gutter-x-md">

View File

@ -203,7 +203,7 @@ const updateQuantity = async (sale) => {
sale.isNew = false; sale.isNew = false;
await axios.post(`Sales/${id}/updateQuantity`, { quantity }); await axios.post(`Sales/${id}/updateQuantity`, { quantity });
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
tableRef.value.reload(); resetChanges();
} catch (e) { } catch (e) {
const { quantity } = tableRef.value.CrudModelRef.originalData.find( const { quantity } = tableRef.value.CrudModelRef.originalData.find(
(s) => s.id === sale.id, (s) => s.id === sale.id,
@ -247,7 +247,7 @@ const updateConcept = async (sale) => {
const data = { newConcept: sale.concept }; const data = { newConcept: sale.concept };
await axios.post(`Sales/${sale.id}/updateConcept`, data); await axios.post(`Sales/${sale.id}/updateConcept`, data);
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
tableRef.value.reload(); resetChanges();
}; };
const DEFAULT_EDIT = { const DEFAULT_EDIT = {
@ -298,7 +298,7 @@ const updatePrice = async (sale, newPrice) => {
sale.price = newPrice; sale.price = newPrice;
edit.value = { ...DEFAULT_EDIT }; edit.value = { ...DEFAULT_EDIT };
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
tableRef.value.reload(); resetChanges();
}; };
const changeDiscount = async (sale) => { const changeDiscount = async (sale) => {
@ -330,7 +330,7 @@ const updateDiscount = async (sales, newDiscount = null) => {
}; };
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params); await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
tableRef.value.reload(); resetChanges();
}; };
const getNewPrice = computed(() => { const getNewPrice = computed(() => {
@ -398,7 +398,7 @@ const removeSales = async () => {
await axios.post('Sales/deleteSales', params); await axios.post('Sales/deleteSales', params);
removeSelectedSales(); removeSelectedSales();
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
window.location.reload(); resetChanges();
}; };
const setTransferParams = async () => { const setTransferParams = async () => {

View File

@ -251,7 +251,7 @@ const fetchAvailableAgencies = async (formData) => {
const { options, agency } = response; const { options, agency } = response;
if (options) agenciesOptions.value = options; if (options) agenciesOptions.value = options;
if (agency) formData.agencyModeId = agency; if (agency) formData.agencyModeId = agency.agencyModeFk;
}; };
const fetchClient = async (formData) => { const fetchClient = async (formData) => {