Merge branch 'dev' into Fix-VnTableFilterTranslations
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-01-08 12:24:52 +00:00
commit 1c2f3e7c53
26 changed files with 279 additions and 58 deletions

View File

@ -11,6 +11,7 @@ module.exports = defineConfig({
screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js',
videosFolder: 'test/cypress/videos',
downloadsFolder: 'test/cypress/downloads',
video: false,
specPattern: 'test/cypress/integration/**/*.spec.js',
experimentalRunAllSpecs: true,

View File

@ -25,6 +25,7 @@
"axios": "^1.4.0",
"chromium": "^3.0.3",
"croppie": "^2.6.5",
"moment": "^2.30.1",
"pinia": "^2.1.3",
"quasar": "^2.14.5",
"validator": "^13.9.0",

View File

@ -20,6 +20,9 @@ dependencies:
croppie:
specifier: ^2.6.5
version: 2.6.5
moment:
specifier: ^2.30.1
version: 2.30.1
pinia:
specifier: ^2.1.3
version: 2.1.7(typescript@5.5.4)(vue@3.4.19)
@ -832,8 +835,8 @@ packages:
vue-i18n:
optional: true
dependencies:
'@intlify/message-compiler': 10.0.0
'@intlify/shared': 10.0.0
'@intlify/message-compiler': 11.0.0-rc.1
'@intlify/shared': 11.0.0-rc.1
jsonc-eslint-parser: 1.4.1
source-map: 0.6.1
vue-i18n: 9.9.1(vue@3.4.19)
@ -847,11 +850,11 @@ packages:
'@intlify/message-compiler': 9.9.1
'@intlify/shared': 9.9.1
/@intlify/message-compiler@10.0.0:
resolution: {integrity: sha512-OcaWc63NC/9p1cMdgoNKBj4d61BH8sUW1Hfs6YijTd9656ZR4rNqXAlRnBrfS5ABq0vjQjpa8VnyvH9hK49yBw==}
/@intlify/message-compiler@11.0.0-rc.1:
resolution: {integrity: sha512-TGw2uBfuTFTegZf/BHtUQBEKxl7Q/dVGLoqRIdw8lFsp9g/53sYn5iD+0HxIzdYjbWL6BTJMXCPUHp9PxDTRPw==}
engines: {node: '>= 16'}
dependencies:
'@intlify/shared': 10.0.0
'@intlify/shared': 11.0.0-rc.1
source-map-js: 1.0.2
dev: true
@ -862,8 +865,8 @@ packages:
'@intlify/shared': 9.9.1
source-map-js: 1.0.2
/@intlify/shared@10.0.0:
resolution: {integrity: sha512-6ngLfI7DOTew2dcF9WMJx+NnMWghMBhIiHbGg+wRvngpzD5KZJZiJVuzMsUQE1a5YebEmtpTEfUrDp/NqVGdiw==}
/@intlify/shared@11.0.0-rc.1:
resolution: {integrity: sha512-8tR1xe7ZEbkabTuE/tNhzpolygUn9OaYp9yuYAF4MgDNZg06C3Qny80bes2/e9/Wm3aVkPUlCw6WgU7mQd0yEg==}
engines: {node: '>= 16'}
dev: true
@ -887,7 +890,7 @@ packages:
optional: true
dependencies:
'@intlify/bundle-utils': 4.0.0(vue-i18n@9.9.1)
'@intlify/shared': 10.0.0
'@intlify/shared': 11.0.0-rc.1
'@rollup/pluginutils': 4.2.1
'@vue/compiler-sfc': 3.4.19
debug: 4.3.4(supports-color@8.1.1)
@ -4960,6 +4963,10 @@ packages:
uuid: 8.3.2
dev: true
/moment@2.30.1:
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
dev: false
/ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}

View File

@ -525,6 +525,7 @@ invoiceOut:
card:
issued: Issued
customerCard: Customer card
ticketList: Ticket List
summary:
issued: Issued
dued: Due

View File

@ -83,7 +83,11 @@ const { openConfirmationModal } = useVnConfirm();
</template>
<template #body="{ entity }">
<VnLv :label="t('department.chat')" :value="entity.chatName" />
<VnLv :label="t('globals.email')" :value="entity.notificationEmail" copy />
<VnLv
:label="t('globals.params.email')"
:value="entity.notificationEmail"
copy
/>
<VnLv
:label="t('department.selfConsumptionCustomer')"
:value="entity.client?.name"

View File

@ -58,7 +58,7 @@ onMounted(async () => {
dash
/>
<VnLv
:label="t('globals.email')"
:label="t('globals.params.email')"
:value="department.notificationEmail"
dash
/>

View File

@ -1,24 +1,24 @@
<script setup>
import { computed } from 'vue';
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { QBtn } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import { usePrintService } from 'composables/usePrintService';
const { openReport } = usePrintService();
const { openReport } = usePrintService();
const buyRows = ref([]);
const route = useRoute();
const { t } = useI18n();
const $props = defineProps({
id: {
type: String,
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => $props.id || route.params.id);
const entriesTableColumns = computed(() => [
{
align: 'left',
@ -63,34 +63,39 @@ const entriesTableColumns = computed(() => [
field: 'grouping',
},
]);
</script>
function downloadCSV(rows) {
const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'comment'];
const csvRows = rows.map((row) => {
const buy = row;
const item = buy.item || {};
return [
buy.id,
buy.itemFk,
item.name || '',
buy.stickers,
buy.packing,
item.comment || '',
].join(',');
});
const csvContent = [headers.join(','), ...csvRows].join('\n');
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `${entityId.value}data.csv`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
<template>
<QDialog ref="dialogRef">
<QCard style="min-width: 800px">
<QCardSection class="row items-center q-pb-none">
<QAvatar
:icon="icon"
color="primary"
text-color="white"
size="xl"
v-if="icon"
/>
<span class="text-h6 text-grey">{{ title }}</span>
<QSpace />
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
</QCardSection>
<QCardActions align="right">
<QBtn
:label="t('myEntries.printLabels')"
color="primary"
icon="print"
:loading="isLoading"
@click="openReport(`Entries/${entityId}/labelSupplier`)"
unelevated
autofocus
/>
</QCardActions>
<QCardSection class="row items-center">
<VnPaginate
ref="entryBuysPaginateRef"
@ -101,6 +106,7 @@ const entriesTableColumns = computed(() => [
>
<template #body="{ rows }">
<QTable
ref="buyRows"
:rows="rows"
:columns="entriesTableColumns"
row-key="id"
@ -110,6 +116,26 @@ const entriesTableColumns = computed(() => [
:grid="$q.screen.lt.md"
:no-data-label="t('globals.noResults')"
>
<template #top-left>
<QBtn
:label="t('myEntries.downloadCsv')"
color="primary"
icon="csv"
@click="downloadCSV(rows)"
unelevated
/>
</template>
<template #top-right>
<QBtn
class="q-mr-lg"
:label="t('myEntries.printLabels')"
color="primary"
icon="print"
@click="
openReport(`Entries/${entityId}/labelSupplier`)
"
/>
</template>
<template #body="props">
<QTr>
<QTd v-for="col in props.cols" :key="col.name">
@ -118,7 +144,6 @@ const entriesTableColumns = computed(() => [
<QBtn
icon="visibility"
v-if="props.row.stickers > 0"
:loading="isLoading"
@click="
openReport(
`Entries/${props.row.id}/buy-label-supplier`

View File

@ -102,7 +102,7 @@ const columns = computed(() => [
actions: [
{
title: t('myEntries.printLabels'),
icon: 'print',
icon: 'move_item',
isPrimary: true,
action: (row) => printBuys(row.id),
},

View File

@ -17,5 +17,6 @@ myEntries:
warehouseInFk: Warehouse in
daysOnward: Days onward
daysAgo: Days ago
downloadCsv: Download CSV
wasteRecalc:
recalcOk: The wastes were successfully recalculated

View File

@ -20,5 +20,6 @@ myEntries:
warehouseInFk: Alm. entrada
daysOnward: Días adelante
daysAgo: Días atras
downloadCsv: Descargar CSV
wasteRecalc:
recalcOk: Se han recalculado las mermas correctamente

View File

@ -47,6 +47,7 @@ const states = ref();
:label="t('Amount')"
v-model="params.amount"
is-outlined
data-cy="InvoiceOutFilterAmountBtn"
/>
</QItemSection>
</QItem>

View File

@ -101,7 +101,18 @@ onMounted(async () => {
dense
outlined
rounded
/>
data-cy="InvoiceOutGlobalClientSelect"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} {{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect
:label="t('invoiceOutSerialType')"
v-model="formData.serialType"
@ -115,6 +126,7 @@ onMounted(async () => {
dense
outlined
rounded
data-cy="InvoiceOutGlobalSerialSelect"
/>
<VnInputDate
v-model="formData.invoiceDate"
@ -125,6 +137,7 @@ onMounted(async () => {
v-model="formData.maxShipped"
:label="t('maxShipped')"
is-outlined
data-cy="InvoiceOutGlobalMaxShippedDate"
/>
<VnSelect
:label="t('company')"
@ -134,6 +147,7 @@ onMounted(async () => {
dense
outlined
rounded
data-cy="InvoiceOutGlobalCompanySelect"
/>
<VnSelect
:label="t('printer')"
@ -142,6 +156,7 @@ onMounted(async () => {
dense
outlined
rounded
data-cy="InvoiceOutGlobalPrinterSelect"
/>
</div>
<QBtn

View File

@ -197,6 +197,7 @@ watchEffect(selectedRows);
icon-right="cloud_download"
@click="downloadPdf()"
:disable="!hasSelectedCards"
data-cy="InvoiceOutDownloadPdfBtn"
>
<QTooltip>{{ t('downloadPdf') }}</QTooltip>
</QBtn>
@ -245,6 +246,7 @@ watchEffect(selectedRows);
v-model="data.ticketFk"
:label="t('globals.ticket')"
style="flex: 1"
data-cy="InvoiceOutCreateTicketinput"
/>
<div
@ -359,6 +361,7 @@ watchEffect(selectedRows);
option-value="code"
option-filter
:expr-builder="exprBuilder"
data-cy="InvoiceOutCreateSerialSelect"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">

View File

@ -684,6 +684,7 @@ function setReference(data) {
color="primary"
fab
icon="vn:invoice-in"
data-cy="ticketListMakeInvoiceBtn"
/>
<QTooltip>
{{ t('ticketList.createInvoice') }}

View File

@ -22,6 +22,7 @@ import { useVnConfirm } from 'composables/useVnConfirm';
import { useArrayData } from 'composables/useArrayData';
import { toTimeFormat, secondsToHoursMinutes } from 'filters/date.js';
import toDateString from 'filters/toDateString.js';
import moment from 'moment';
import { date } from 'quasar';
const route = useRoute();
@ -64,6 +65,7 @@ const selectedDateFormatted = ref(toDateString(defaultDate.value));
const arrayData = useArrayData('workerData');
const acl = useAcl();
const selectedDateYear = computed(() => moment(selectedDate.value).isoWeekYear());
const worker = computed(() => arrayData.store?.data);
const canSend = computed(() =>
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }])
@ -278,7 +280,7 @@ const fetchHours = async () => {
const fetchWeekData = async () => {
const where = {
year: selectedDate.value.getFullYear(),
year: selectedDateYear.value,
week: selectedWeekNumber.value,
};
const mail = (
@ -343,7 +345,7 @@ const getMailStates = async (date) => {
const prevMonth = month == 1 ? 12 : month - 1;
const params = {
month,
year: date.getFullYear(),
year: selectedDateYear.value,
};
const curMonthStates = (await axios.get(url, { params })).data;
@ -370,7 +372,7 @@ const showReasonForm = () => {
const updateWorkerTimeControlMail = async (state, reason) => {
const params = {
year: selectedDate.value.getFullYear(),
year: selectedDateYear.value,
week: selectedWeekNumber.value,
state,
};
@ -400,7 +402,7 @@ const resendEmail = async () => {
const params = {
recipient: worker.value[0]?.user?.emailUser?.email,
week: selectedWeekNumber.value,
year: selectedDate.value.getFullYear(),
year: selectedDateYear.value,
workerId: Number(route.params.id),
state: 'SENDED',
};

View File

@ -1,2 +1,3 @@
reports/*
screenshots/*
downloads/*

View File

@ -0,0 +1,46 @@
/// <reference types="cypress" />
describe('InvoiceOut list', () => {
const invoice = {
Ticket: { val: '8' },
Serial: { val: 'Española rapida', type: 'select' },
};
const invoiceError = {
Ticket: { val: '1' },
Serial: { val: 'Española rapida', type: 'select' },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.typeSearchbar('{enter}');
});
it('should search and filter an invoice and enter to the summary', () => {
cy.typeSearchbar('1{enter}');
cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click();
cy.get('.header > a.q-btn > .q-btn__content').click();
cy.typeSearchbar('{enter}');
cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}');
});
it('should download all pdfs', () => {
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
});
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.fillInForm(invoiceError);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('This ticket is already invoiced');
});
it('should create a manual invoice and enter to its summary', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.fillInForm(invoice);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,21 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/ticket/list`);
cy.get('#searchbar input').type('{enter}');
});
it('should create an invoice from a ticket and go to that invoice', () => {
cy.searchByLabel('Customer ID', '1101');
cy.get(
'[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
).click();
cy.dataCy('ticketListMakeInvoiceBtn').click();
cy.checkNotification('Data saved');
cy.get('.q-virtual-scroll__content > :nth-child(1) > :nth-child(3)').click();
cy.get(':nth-child(8) > .value > .link').click();
cy.get('.header > :nth-child(3) > .q-btn__content').click();
});
});

View File

@ -0,0 +1,16 @@
/// <reference types="cypress" />
describe('InvoiceOut negative bases', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/negative-bases`);
});
it('should filter and download as CSV', () => {
cy.get(
':nth-child(7) > .full-width > :nth-child(1) > .column > div.q-px-xs > .q-field > .q-field__inner > .q-field__control'
).type('23{enter}');
cy.get('#subToolbar > .q-btn').click();
cy.checkNotification('CSV downloaded successfully');
});
});

View File

@ -0,0 +1,47 @@
/// <reference types="cypress" />
describe('InvoiceOut summary', () => {
const transferInvoice = {
Client: { val: 'employee', type: 'select' },
Type: { val: 'Error in customer data', type: 'select' },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.typeSearchbar('{enter}');
});
it('should generate the invoice PDF', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(6)').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('The invoice PDF document has been regenerated');
});
it('should refund the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(7)').click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
cy.checkNotification('The following refund ticket have been created 1000000');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(1)').click();
cy.fillInForm(transferInvoice);
cy.get('.q-mt-lg > .q-btn').click();
cy.checkNotification('Transferred invoice');
});
});

View File

@ -0,0 +1,28 @@
/// <reference types="cypress" />
describe('InvoiceOut global invoicing', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('administrative');
cy.visit(`/#/invoice-out/global-invoicing`);
});
it('should invoice the client tickets', () => {
cy.get('.q-mb-sm > .q-radio__inner').click();
cy.dataCy('InvoiceOutGlobalClientSelect').type('1102');
cy.get('.q-menu .q-item').contains('1102').click();
cy.dataCy('InvoiceOutGlobalSerialSelect').click();
cy.get('.q-menu .q-item').contains('global').click();
cy.dataCy('InvoiceOutGlobalCompanySelect').type('VNL');
cy.get('.q-menu .q-item').contains('VNL').click();
cy.dataCy('InvoiceOutGlobalPrinterSelect').type('printer1');
cy.get('.q-menu .q-item').contains('printer1').click();
cy.get(
'[label="Invoice date"] > .q-field > .q-field__inner > .q-field__control'
).click();
cy.get(':nth-child(5) > div > .q-btn > .q-btn__content > .block').click();
cy.get('.q-date__years-content > :nth-child(2) > .q-btn').click();
cy.get('.q-date__calendar-days > :nth-child(6) > .q-btn').click();
cy.get('[label="Max date ticket"]').type('01-01-2001{enter}');
cy.get('.q-card').should('be.visible');
});
});

View File

@ -16,10 +16,12 @@ describe('VnSearchBar', () => {
});
it('should stay on the list page if there are several results or none', () => {
cy.typeSearchbar('salesA{enter}');
cy.typeSearchbar('salesA{enter}');
checkTableLength(2);
cy.clearSearchbar();
cy.typeSearchbar('0{enter}');
checkTableLength(0);
});
@ -27,6 +29,7 @@ describe('VnSearchBar', () => {
const searchAndCheck = (searchTerm, expectedText) => {
cy.clearSearchbar();
cy.typeSearchbar(`${searchTerm}{enter}`);
cy.typeSearchbar(`${searchTerm}{enter}`);
cy.get(idGap).should('have.text', expectedText);
};

View File

@ -1,6 +1,5 @@
describe('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)';
const notification = '.q-notification__message';
const developerBossId = 120;
const payMethodCross =
'.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)';
@ -41,7 +40,7 @@ describe('WorkerCreate', () => {
cy.fillInForm(internal);
cy.get(payMethodCross).click();
cy.get(saveBtn).click();
cy.get(notification).should('contains.text', 'Payment method is required');
cy.checkNotification('Payment method is required');
});
it('should create an internal', () => {
@ -50,13 +49,13 @@ describe('WorkerCreate', () => {
'Pay method': { val: 'PayMethod one', type: 'select' },
});
cy.get(saveBtn).click();
cy.get(notification).should('contains.text', 'Data created');
cy.checkNotification('Data created');
});
it('should create an external', () => {
cy.get(externalRadio).click();
cy.fillInForm(external);
cy.get(saveBtn).click();
cy.get(notification).should('contains.text', 'Data created');
cy.checkNotification('Data created');
});
});

View File

@ -1,5 +1,4 @@
describe('ZoneBasicData', () => {
const notification = '.q-notification__message';
const priceBasicData = '[data-cy="Price_input"]';
beforeEach(() => {
@ -11,13 +10,13 @@ describe('ZoneBasicData', () => {
it('should throw an error if the name is empty', () => {
cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
cy.get('.q-btn-group > .q-btn--standard').click();
cy.get(notification).should('contains.text', "can't be blank");
cy.checkNotification("can't be blank");
});
it('should throw an error if the price is empty', () => {
cy.get(priceBasicData).clear();
cy.get('.q-btn-group > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'cannot be blank');
cy.checkNotification('cannot be blank');
});
it("should edit the basicData's zone", () => {

View File

@ -1,6 +1,4 @@
describe('ZoneCreate', () => {
const notification = '.q-notification__message';
const data = {
Name: { val: 'Zone pickup D' },
Price: { val: '3' },
@ -24,7 +22,7 @@ describe('ZoneCreate', () => {
cy.get('input[aria-label="Close"]').type('10:00');
cy.get('body').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Agency cannot be blank');
cy.checkNotification('Agency cannot be blank');
});
it('should create a zone', () => {
@ -35,6 +33,6 @@ describe('ZoneCreate', () => {
cy.get('input[aria-label="Close"]').type('10:00');
cy.get('body').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created');
cy.checkNotification('Data created');
});
});

View File

@ -124,7 +124,7 @@ Cypress.Commands.add('countSelectOptions', (selector, option) => {
});
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
cy.waitForElement('.q-form > .q-card');
cy.waitForElement(form);
cy.get(`${form} input`).each(([el]) => {
cy.wrap(el)
.invoke('attr', 'aria-label')
@ -277,7 +277,7 @@ Cypress.Commands.add('clearSearchbar', (element) => {
cy.get('[data-cy="vn-searchbar"]').clear();
});
Cypress.Commands.add('writeSearchbar', (value) => {
Cypress.Commands.add('typeSearchbar', (value) => {
cy.get('[data-cy="vn-searchbar"]').type(value);
});