feat: refs #8930 add vehicle management to invoice summary and vehicle linking functionality
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
259a8f7df2
commit
6122b64268
|
@ -11,6 +11,7 @@ import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorP
|
||||||
import InvoiceIntoBook from '../InvoiceInToBook.vue';
|
import InvoiceIntoBook from '../InvoiceInToBook.vue';
|
||||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import InvoiceInDescriptorMenu from './InvoiceInDescriptorMenu.vue';
|
import InvoiceInDescriptorMenu from './InvoiceInDescriptorMenu.vue';
|
||||||
|
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
|
||||||
|
|
||||||
const props = defineProps({ id: { type: [Number, String], default: 0 } });
|
const props = defineProps({ id: { type: [Number, String], default: 0 } });
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -161,6 +162,22 @@ const intrastatColumns = ref([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const vehicleColumns = ref([
|
||||||
|
{
|
||||||
|
name: 'numberPlate',
|
||||||
|
label: 'invoiceIn.summary.vehicle',
|
||||||
|
field: (row) => row.vehicleInvoiceIn?.numberPlate,
|
||||||
|
format: (value) => value,
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'amount',
|
||||||
|
label: 'invoiceIn.list.amount',
|
||||||
|
field: (row) => toCurrency(row.vehicleInvoiceIn?.amount),
|
||||||
|
align: 'left',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
invoiceInUrl.value = `${await getUrl('')}invoiceIn/${entityId.value}/`;
|
invoiceInUrl.value = `${await getUrl('')}invoiceIn/${entityId.value}/`;
|
||||||
});
|
});
|
||||||
|
@ -186,6 +203,8 @@ const getTotalTax = (tax) =>
|
||||||
tax.reduce((acc, cur) => acc + taxRate(cur.taxableBase, cur.taxTypeSage?.rate), 0);
|
tax.reduce((acc, cur) => acc + taxRate(cur.taxableBase, cur.taxTypeSage?.rate), 0);
|
||||||
|
|
||||||
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
|
const getVehicleTotalAmount = (vehicles) =>
|
||||||
|
vehicles.reduce((acc, cur) => acc + cur.amount, 0);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
|
@ -218,6 +237,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="getLink('basic-data')"
|
:url="getLink('basic-data')"
|
||||||
:text="t('globals.pageTitles.basicData')"
|
:text="t('globals.pageTitles.basicData')"
|
||||||
|
data-cy="basicDataTitleLink"
|
||||||
/>
|
/>
|
||||||
<div class="vn-card-group">
|
<div class="vn-card-group">
|
||||||
<div class="vn-card-content">
|
<div class="vn-card-content">
|
||||||
|
@ -320,7 +340,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QCard>
|
</QCard>
|
||||||
<!--Vat-->
|
<!--Vat-->
|
||||||
<QCard v-if="entity.invoiceInTax.length" class="vat">
|
<QCard v-if="entity.invoiceInTax.length" class="vat">
|
||||||
<VnTitle :url="getLink('vat')" :text="t('invoiceIn.card.vat')" />
|
<VnTitle
|
||||||
|
:url="getLink('vat')"
|
||||||
|
:text="t('invoiceIn.card.vat')"
|
||||||
|
data-cy="vatTitleLink"
|
||||||
|
/>
|
||||||
<QTable
|
<QTable
|
||||||
:columns="vatColumns"
|
:columns="vatColumns"
|
||||||
:rows="entity.invoiceInTax"
|
:rows="entity.invoiceInTax"
|
||||||
|
@ -377,7 +401,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QCard>
|
</QCard>
|
||||||
<!--Due Day-->
|
<!--Due Day-->
|
||||||
<QCard v-if="entity.invoiceInDueDay.length" class="due-day">
|
<QCard v-if="entity.invoiceInDueDay.length" class="due-day">
|
||||||
<VnTitle :url="getLink('due-day')" :text="t('invoiceIn.card.dueDay')" />
|
<VnTitle
|
||||||
|
:url="getLink('due-day')"
|
||||||
|
:text="t('invoiceIn.card.dueDay')"
|
||||||
|
data-cy="dueDayTitleLink"
|
||||||
|
/>
|
||||||
<QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat>
|
<QTable :columns="dueDayColumns" :rows="entity.invoiceInDueDay" flat>
|
||||||
<template #header="dueDayProps">
|
<template #header="dueDayProps">
|
||||||
<QTr :props="dueDayProps" class="bg">
|
<QTr :props="dueDayProps" class="bg">
|
||||||
|
@ -412,10 +440,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</QTable>
|
</QTable>
|
||||||
</QCard>
|
</QCard>
|
||||||
<!--Intrastat-->
|
<!--Intrastat-->
|
||||||
<QCard v-if="entity.invoiceInIntrastat.length">
|
<QCard v-if="entity.invoiceInIntrastat.length" class="vat">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="getLink('intrastat')"
|
:url="getLink('intrastat')"
|
||||||
:text="t('invoiceIn.card.intrastat')"
|
:text="t('invoiceIn.card.intrastat')"
|
||||||
|
data-cy="intrastatTitleLink"
|
||||||
/>
|
/>
|
||||||
<QTable
|
<QTable
|
||||||
:columns="intrastatColumns"
|
:columns="intrastatColumns"
|
||||||
|
@ -449,6 +478,53 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
<!-- Vehicle -->
|
||||||
|
<QCard v-if="entity?.vehicleInvoiceIn?.length" class="due-day">
|
||||||
|
<VnTitle
|
||||||
|
:url="getLink('vehicle')"
|
||||||
|
:text="t('invoiceIn.summary.vehicle')"
|
||||||
|
data-cy="vehicleTitleLink"
|
||||||
|
/>
|
||||||
|
<QTable :columns="vehicleColumns" :rows="entity.vehicleInvoiceIn" flat>
|
||||||
|
<template #header="vehicleProps">
|
||||||
|
<QTr :props="vehicleProps" class="bg">
|
||||||
|
<QTh
|
||||||
|
v-for="col in vehicleProps.cols"
|
||||||
|
:key="col.name"
|
||||||
|
:props="vehicleProps"
|
||||||
|
>
|
||||||
|
{{ t(col.label) }}
|
||||||
|
</QTh>
|
||||||
|
</QTr>
|
||||||
|
</template>
|
||||||
|
<template #body="vehicleProps">
|
||||||
|
<QTr :props="vehicleProps">
|
||||||
|
<QTd>
|
||||||
|
<span class="link" data-cy="invoiceInSummary_vehicle">
|
||||||
|
{{ vehicleProps.row.vehicle.numberPlate }}
|
||||||
|
<VehicleDescriptorProxy
|
||||||
|
:id="vehicleProps.row.vehicleFk"
|
||||||
|
/> </span
|
||||||
|
></QTd>
|
||||||
|
<QTd align="left">{{
|
||||||
|
toCurrency(vehicleProps.row.amount)
|
||||||
|
}}</QTd>
|
||||||
|
</QTr>
|
||||||
|
</template>
|
||||||
|
<template #bottom-row>
|
||||||
|
<QTr class="bg">
|
||||||
|
<QTd></QTd>
|
||||||
|
<QTd>
|
||||||
|
{{
|
||||||
|
toCurrency(
|
||||||
|
getVehicleTotalAmount(entity.vehicleInvoiceIn),
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</QTd>
|
||||||
|
</QTr>
|
||||||
|
</template>
|
||||||
|
</QTable>
|
||||||
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
<script setup>
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import { toCurrency } from 'src/filters';
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import axios from 'axios';
|
||||||
|
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const dataKey = 'InvoiceInVehicleList';
|
||||||
|
const filter = {
|
||||||
|
include: [{ relation: 'vehicle', scope: { fields: ['id', 'numberPlate'] } }],
|
||||||
|
};
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'vehicleFk',
|
||||||
|
label: t('invoiceIn.summary.vehicle'),
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'vehicles',
|
||||||
|
fields: ['id', 'numberPlate'],
|
||||||
|
optionLabel: 'numberPlate',
|
||||||
|
optionFilterValue: 'numberPlate',
|
||||||
|
find: {
|
||||||
|
value: 'vehicleFk',
|
||||||
|
label: 'vehiclePlateNumber',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
create: true,
|
||||||
|
format: (row) => row.vehicle?.numberPlate,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'amount',
|
||||||
|
label: t('invoiceIn.list.amount'),
|
||||||
|
format: (row) => toCurrency(row.amount),
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('invoiceIn.unlinkVehicle'),
|
||||||
|
icon: 'delete',
|
||||||
|
action: (row) =>
|
||||||
|
openConfirmationModal(
|
||||||
|
t('invoiceIn.unlinkVehicle'),
|
||||||
|
t('invoiceIn.unlinkVehicleConfirmation'),
|
||||||
|
() => unassignVehicle(row.id),
|
||||||
|
),
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function unassignVehicle(id) {
|
||||||
|
try {
|
||||||
|
await axios.delete(`VehicleInvoiceIns/${id}`);
|
||||||
|
notify(t('invoiceIn.unlinkedVehicle'), 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
|
} catch (e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnTable
|
||||||
|
ref="tableRef"
|
||||||
|
:data-key="dataKey"
|
||||||
|
url="VehicleInvoiceIns"
|
||||||
|
:user-filter="filter"
|
||||||
|
:filter="{ where: { invoiceInFk: route.params.id } }"
|
||||||
|
:columns="columns"
|
||||||
|
:column-search="false"
|
||||||
|
:right-search="false"
|
||||||
|
:create="{
|
||||||
|
urlCreate: 'VehicleInvoiceIns',
|
||||||
|
title: t('invoiceIn.linkVehicleToInvoiceIn'),
|
||||||
|
onDataSaved: () => tableRef.reload(),
|
||||||
|
formInitialData: { invoiceInFk: route.params.id },
|
||||||
|
}"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
|
<template #column-vehicleFk="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.vehicle?.numberPlate }}
|
||||||
|
<VehicleDescriptorProxy :id="row?.vehicleFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template #more-create-dialog="{ data }">
|
||||||
|
<VnInputNumber
|
||||||
|
:label="t('invoiceIn.list.amount')"
|
||||||
|
v-model="data.amount"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
|
</template>
|
|
@ -63,10 +63,18 @@ invoiceIn:
|
||||||
net: Net
|
net: Net
|
||||||
stems: Stems
|
stems: Stems
|
||||||
country: Country
|
country: Country
|
||||||
|
vehicle: Vehicle
|
||||||
params:
|
params:
|
||||||
|
invoiceInFk: Invoice nº
|
||||||
|
vehicleFk: Vehicle
|
||||||
|
amount: Amount
|
||||||
search: Id or supplier name
|
search: Id or supplier name
|
||||||
correctedFk: Corrected
|
correctedFk: Corrected
|
||||||
isBooked: Is booked
|
isBooked: Is booked
|
||||||
account: Ledger account
|
account: Ledger account
|
||||||
correctingFk: Rectificative
|
correctingFk: Rectificative
|
||||||
noMatch: No match with the vat({totalTaxableBase})
|
noMatch: No match with the vat({totalTaxableBase})
|
||||||
|
linkVehicleToInvoiceIn: Link vehicle to invoice
|
||||||
|
unlinkedVehicle: Unlinked vehicle
|
||||||
|
unlinkVehicle: Unlink vehicle
|
||||||
|
unlinkVehicleConfirmation: This vehicle will be unlinked from this invoice! Continue anyway?
|
||||||
|
|
|
@ -61,10 +61,18 @@ invoiceIn:
|
||||||
net: Neto
|
net: Neto
|
||||||
stems: Tallos
|
stems: Tallos
|
||||||
country: País
|
country: País
|
||||||
|
vehicle: Vehículo
|
||||||
params:
|
params:
|
||||||
|
invoiceInFk: Factura nº
|
||||||
|
vehicleFk: Vehículo
|
||||||
|
amount: Importe
|
||||||
search: Id o nombre proveedor
|
search: Id o nombre proveedor
|
||||||
correctedFk: Rectificada
|
correctedFk: Rectificada
|
||||||
isBooked: Contabilizada
|
isBooked: Contabilizada
|
||||||
account: Cuenta contable
|
account: Cuenta contable
|
||||||
correctingFk: Rectificativa
|
correctingFk: Rectificativa
|
||||||
noMatch: No cuadra con el iva({totalTaxableBase})
|
noMatch: No cuadra con el iva({totalTaxableBase})
|
||||||
|
linkVehicleToInvoiceIn: Vincular vehículo a factura
|
||||||
|
unlinkedVehicle: Vehículo desvinculado
|
||||||
|
unlinkVehicle: Desvincular vehículo
|
||||||
|
unlinkVehicleConfirmation: Este vehículo se desvinculará de esta factura! ¿Continuar de todas formas?
|
||||||
|
|
|
@ -18,6 +18,7 @@ const invoiceInCard = {
|
||||||
'InvoiceInIntrastat',
|
'InvoiceInIntrastat',
|
||||||
'InvoiceInCorrective',
|
'InvoiceInCorrective',
|
||||||
'InvoiceInLog',
|
'InvoiceInLog',
|
||||||
|
'InvoiceInVehicle',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
@ -75,6 +76,15 @@ const invoiceInCard = {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
|
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'InvoiceInVehicle',
|
||||||
|
path: 'vehicle',
|
||||||
|
meta: {
|
||||||
|
title: 'vehicle',
|
||||||
|
icon: 'directions_car',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/InvoiceIn/Card/InvoiceInVehicle.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'InvoiceInLog',
|
name: 'InvoiceInLog',
|
||||||
path: 'log',
|
path: 'log',
|
||||||
|
|
|
@ -1,24 +1,153 @@
|
||||||
describe('InvoiceInSummary', () => {
|
describe('InvoiceInSummary', () => {
|
||||||
|
const url = '/#/invoice-in/1/summary';
|
||||||
|
|
||||||
|
const selectors = {
|
||||||
|
supplierLink: '[data-cy="invoiceInSummary_supplier"]',
|
||||||
|
vehicleLink: '[data-cy="invoiceInSummary_vehicle"]',
|
||||||
|
descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
|
||||||
|
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
|
||||||
|
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
||||||
|
supplierDescriptorTitle: '[data-cy="vnDescriptor_description"]',
|
||||||
|
vehicleDescriptorTitle: '[data-cy="vnDescriptor_title"]',
|
||||||
|
};
|
||||||
|
|
||||||
|
const sectionSelectors = {
|
||||||
|
basicDataIcon: 'InvoiceInBasicData-menu-item',
|
||||||
|
vatIcon: 'InvoiceInVat-menu-item',
|
||||||
|
dueDayIcon: 'InvoiceInDueDay-menu-item',
|
||||||
|
intrastatIcon: 'InvoiceInIntrastat-menu-item',
|
||||||
|
vehicleIcon: 'InvoiceInVehicle-menu-item',
|
||||||
|
logIcon: 'InvoiceInLog-menu-item',
|
||||||
|
};
|
||||||
|
|
||||||
|
const titlesLinks = {
|
||||||
|
basicData: '[data-cy="basicDataTitleLink"].link',
|
||||||
|
vat: '[data-cy="vatTitleLink"].link',
|
||||||
|
dueDay: '[data-cy="dueDayTitleLink"].link',
|
||||||
|
intrastat: '[data-cy="intrastatTitleLink"].link',
|
||||||
|
vehicle: '[data-cy="vehicleTitleLink"].link',
|
||||||
|
};
|
||||||
|
|
||||||
|
const basePath = 'invoice-in/1/';
|
||||||
|
const sectionRegex = {
|
||||||
|
basicData: new RegExp(`${basePath}basic-data`),
|
||||||
|
vat: new RegExp(`${basePath}vat`),
|
||||||
|
dueDay: new RegExp(`${basePath}due-day`),
|
||||||
|
intrastat: new RegExp(`${basePath}intrastat`),
|
||||||
|
vehicle: new RegExp(`${basePath}vehicle`),
|
||||||
|
log: new RegExp(`${basePath}log`),
|
||||||
|
};
|
||||||
|
|
||||||
|
const supplierSummaryUrlRegex = /supplier\/\d+\/summary/;
|
||||||
|
const vehicleSummaryUrlRegex = /vehicle\/\d+\/summary/;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('administrative');
|
cy.login('administrative');
|
||||||
cy.visit('/#/invoice-in/3/summary');
|
cy.visit(url);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to the corresponding section when clicking on the icons in the left menu', () => {
|
||||||
|
cy.dataCy(sectionSelectors.basicDataIcon).click();
|
||||||
|
cy.location().should('match', sectionRegex.basicData);
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.dataCy(sectionSelectors.vatIcon).click();
|
||||||
|
cy.location().should('match', sectionRegex.vat);
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.dataCy(sectionSelectors.dueDayIcon).click();
|
||||||
|
cy.location().should('match', sectionRegex.dueDay);
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.dataCy(sectionSelectors.intrastatIcon).click();
|
||||||
|
cy.location().should('match', sectionRegex.intrastat);
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.dataCy(sectionSelectors.vehicleIcon).click();
|
||||||
|
cy.location().should('match', sectionRegex.vehicle);
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.dataCy(sectionSelectors.logIcon).click();
|
||||||
|
cy.location().should('match', sectionRegex.log);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Title links redirections', () => {
|
||||||
|
it('Should redirect to invoiceIn basic-data when clicking on basic-data title link', () => {
|
||||||
|
cy.get(titlesLinks.basicData).click();
|
||||||
|
cy.location().should('match', sectionRegex.basicData);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to invoiceIn vat when clicking on basic-data title link', () => {
|
||||||
|
cy.get(titlesLinks.vat).click();
|
||||||
|
cy.location().should('match', sectionRegex.vat);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to invoiceIn due-day when clicking on basic-data title link', () => {
|
||||||
|
cy.get(titlesLinks.dueDay).click();
|
||||||
|
cy.location().should('match', sectionRegex.dueDay);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to invoiceIn intrastat when clicking on basic-data title link', () => {
|
||||||
|
cy.get(titlesLinks.intrastat).click();
|
||||||
|
cy.location().should('match', sectionRegex.intrastat);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to invoiceIn vehicle when clicking on basic-data title link', () => {
|
||||||
|
cy.get(titlesLinks.vehicle).click();
|
||||||
|
cy.location().should('match', sectionRegex.vehicle);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should booking and unbooking the invoice properly', () => {
|
it('should booking and unbooking the invoice properly', () => {
|
||||||
|
cy.visit('/#/invoice-in/3/summary');
|
||||||
const checkbox = '[data-cy="vnLvIs booked"] > .q-checkbox';
|
const checkbox = '[data-cy="vnLvIs booked"] > .q-checkbox';
|
||||||
cy.dataCy('invoiceInSummary_book').click();
|
cy.dataCy('invoiceInSummary_book').click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
cy.validateCheckbox(checkbox);
|
cy.validateCheckbox(checkbox);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the supplier descriptor popup', () => {
|
describe('Supplier pop-ups', () => {
|
||||||
cy.intercept('GET', /Suppliers\/\d+/).as('getSupplier');
|
it('Should redirect to the supplier summary from the supplier descriptor pop-up', () => {
|
||||||
cy.dataCy('invoiceInSummary_supplier').then(($el) => {
|
cy.checkRedirectionFromPopUp({
|
||||||
const description = $el.text().trim();
|
selectorToClick: selectors.supplierLink,
|
||||||
$el.click();
|
steps: [selectors.descriptorGoToSummaryBtn],
|
||||||
cy.wait('@getSupplier').then(() =>
|
expectedUrlRegex: supplierSummaryUrlRegex,
|
||||||
cy.validateDescriptor({ description, popup: true }),
|
expectedTextSelector: selectors.supplierDescriptorTitle,
|
||||||
);
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => {
|
||||||
|
cy.checkRedirectionFromPopUp({
|
||||||
|
selectorToClick: selectors.supplierLink,
|
||||||
|
steps: [
|
||||||
|
selectors.descriptorOpenSummaryBtn,
|
||||||
|
selectors.summaryGoToSummaryBtn,
|
||||||
|
],
|
||||||
|
expectedUrlRegex: supplierSummaryUrlRegex,
|
||||||
|
expectedTextSelector: selectors.supplierDescriptorTitle,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Vehicle pop-ups', () => {
|
||||||
|
it('Should redirect to the vehicle summary from the vehicle descriptor pop-up', () => {
|
||||||
|
cy.checkRedirectionFromPopUp({
|
||||||
|
selectorToClick: selectors.vehicleLink,
|
||||||
|
steps: [selectors.descriptorGoToSummaryBtn],
|
||||||
|
expectedUrlRegex: vehicleSummaryUrlRegex,
|
||||||
|
expectedTextSelector: selectors.vehicleDescriptorTitle,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to the vehicle summary from summary pop-up from the vehicle descriptor pop-up', () => {
|
||||||
|
cy.checkRedirectionFromPopUp({
|
||||||
|
selectorToClick: selectors.vehicleLink,
|
||||||
|
steps: [
|
||||||
|
selectors.descriptorOpenSummaryBtn,
|
||||||
|
selectors.summaryGoToSummaryBtn,
|
||||||
|
],
|
||||||
|
expectedUrlRegex: vehicleSummaryUrlRegex,
|
||||||
|
expectedTextSelector: selectors.vehicleDescriptorTitle,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
describe('InvoiceInVehicle', () => {
|
||||||
|
const selectors = {
|
||||||
|
tableActionUnlink: 'tableAction-0',
|
||||||
|
firstVehicleLink:
|
||||||
|
'tr:first-child > [data-col-field="vehicleFk"] > .no-padding > .link',
|
||||||
|
descriptorOpenSummaryBtn: '.q-menu .descriptor [data-cy="openSummaryBtn"]',
|
||||||
|
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
|
||||||
|
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
|
||||||
|
descriptorTitle: '[data-cy="vnDescriptor_title"]',
|
||||||
|
};
|
||||||
|
const vehicleSummaryUrlRegex = /vehicle\/\d+\/summary/;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('administrative');
|
||||||
|
cy.visit(`/#/invoice-in/1/vehicle`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should link vehicle to the invoice', () => {
|
||||||
|
const data = {
|
||||||
|
Vehicle: { val: '2222-IMK', type: 'select' },
|
||||||
|
Amount: { val: 125 },
|
||||||
|
};
|
||||||
|
cy.addBtnClick();
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should unlink vehicle to the invoice', () => {
|
||||||
|
cy.dataCy(selectors.tableActionUnlink).last().click();
|
||||||
|
cy.clickConfirm();
|
||||||
|
cy.checkNotification('Unlinked vehicle');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Vehicle pop-ups', () => {
|
||||||
|
it('Should redirect to the vehicle summary from the vehicle descriptor pop-up', () => {
|
||||||
|
cy.checkRedirectionFromPopUp({
|
||||||
|
selectorToClick: selectors.firstVehicleLink,
|
||||||
|
steps: [selectors.descriptorGoToSummaryBtn],
|
||||||
|
expectedUrlRegex: vehicleSummaryUrlRegex,
|
||||||
|
expectedTextSelector: selectors.descriptorTitle,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to the vehicle summary from summary pop-up from the vehicle descriptor pop-up', () => {
|
||||||
|
cy.checkRedirectionFromPopUp({
|
||||||
|
selectorToClick: selectors.firstVehicleLink,
|
||||||
|
steps: [
|
||||||
|
selectors.descriptorOpenSummaryBtn,
|
||||||
|
selectors.summaryGoToSummaryBtn,
|
||||||
|
],
|
||||||
|
expectedUrlRegex: vehicleSummaryUrlRegex,
|
||||||
|
expectedTextSelector: selectors.descriptorTitle,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue