Merge branch 'dev' of https: refs #8449//gitea.verdnatura.es/verdnatura/salix-front into 8449-vnLogFilter
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
5066cd8179
|
@ -1,16 +1,6 @@
|
||||||
import {
|
import { describe, it, expect, vi, afterEach, beforeEach, afterAll } from 'vitest';
|
||||||
describe,
|
|
||||||
it,
|
|
||||||
expect,
|
|
||||||
vi,
|
|
||||||
beforeAll,
|
|
||||||
afterEach,
|
|
||||||
beforeEach,
|
|
||||||
afterAll,
|
|
||||||
} from 'vitest';
|
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
import vnDate from 'src/boot/vnDate';
|
|
||||||
|
|
||||||
describe('VnNotes', () => {
|
describe('VnNotes', () => {
|
||||||
let vm;
|
let vm;
|
||||||
|
@ -18,6 +8,7 @@ describe('VnNotes', () => {
|
||||||
let spyFetch;
|
let spyFetch;
|
||||||
let postMock;
|
let postMock;
|
||||||
let patchMock;
|
let patchMock;
|
||||||
|
let deleteMock;
|
||||||
let expectedInsertBody;
|
let expectedInsertBody;
|
||||||
let expectedUpdateBody;
|
let expectedUpdateBody;
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
|
@ -57,6 +48,7 @@ describe('VnNotes', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
postMock = vi.spyOn(axios, 'post');
|
postMock = vi.spyOn(axios, 'post');
|
||||||
patchMock = vi.spyOn(axios, 'patch');
|
patchMock = vi.spyOn(axios, 'patch');
|
||||||
|
deleteMock = vi.spyOn(axios, 'delete');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -153,4 +145,16 @@ describe('VnNotes', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('delete', () => {
|
||||||
|
it('Should call axios.delete with url and vnPaginateRef.fetch', async () => {
|
||||||
|
generateWrapper();
|
||||||
|
createSpyFetch();
|
||||||
|
|
||||||
|
await vm.deleteNote({ id: 1 });
|
||||||
|
|
||||||
|
expect(deleteMock).toHaveBeenCalledWith(`${vm.$props.url}/1`);
|
||||||
|
expect(spyFetch).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,10 +18,10 @@ import VnInput from 'components/common/VnInput.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch']);
|
const emit = defineEmits(['onFetch']);
|
||||||
|
|
||||||
const $attrs = useAttrs();
|
const originalAttrs = useAttrs();
|
||||||
|
const $attrs = computed(() => {
|
||||||
const isRequired = computed(() => {
|
const { required, deletable, ...rest } = originalAttrs;
|
||||||
return Object.keys($attrs).includes('required');
|
return rest;
|
||||||
});
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -53,6 +53,11 @@ function handleClick(e) {
|
||||||
else insert();
|
else insert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deleteNote(e) {
|
||||||
|
await axios.delete(`${$props.url}/${e.id}`);
|
||||||
|
await vnPaginateRef.value.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
async function insert() {
|
async function insert() {
|
||||||
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
||||||
|
|
||||||
|
@ -157,7 +162,7 @@ const handleObservationTypes = (data) => {
|
||||||
v-model="newNote.observationTypeFk"
|
v-model="newNote.observationTypeFk"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
style="flex: 0.15"
|
style="flex: 0.15"
|
||||||
:required="isRequired"
|
:required="'required' in originalAttrs"
|
||||||
@keyup.enter.stop="insert"
|
@keyup.enter.stop="insert"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -165,11 +170,10 @@ const handleObservationTypes = (data) => {
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:label="$props.justInput && newNote.text ? '' : t('Add note here...')"
|
:label="$props.justInput && newNote.text ? '' : t('Add note here...')"
|
||||||
filled
|
filled
|
||||||
size="lg"
|
|
||||||
autogrow
|
autogrow
|
||||||
autofocus
|
autofocus
|
||||||
@keyup.enter.stop="handleClick"
|
@keyup.enter.stop="handleClick"
|
||||||
:required="isRequired"
|
:required="'required' in originalAttrs"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
|
@ -239,6 +243,21 @@ const handleObservationTypes = (data) => {
|
||||||
</QBadge>
|
</QBadge>
|
||||||
</div>
|
</div>
|
||||||
<span v-text="toDateHourMin(note.created)" />
|
<span v-text="toDateHourMin(note.created)" />
|
||||||
|
<div>
|
||||||
|
<QIcon
|
||||||
|
v-if="'deletable' in originalAttrs"
|
||||||
|
name="delete"
|
||||||
|
size="sm"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
@click="deleteNote(note)"
|
||||||
|
data-cy="notesRemoveNoteBtn"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('ticketNotes.removeNote') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="q-pa-xs q-my-none q-py-none">
|
<QCardSection class="q-pa-xs q-my-none q-py-none">
|
||||||
|
|
|
@ -134,7 +134,7 @@ const columns = computed(() => [
|
||||||
|
|
||||||
const STATE_COLOR = {
|
const STATE_COLOR = {
|
||||||
pending: 'bg-warning',
|
pending: 'bg-warning',
|
||||||
managed: 'bg-info',
|
loses: 'bg-negative',
|
||||||
resolved: 'bg-positive',
|
resolved: 'bg-positive',
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
|
|
||||||
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
|
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
|
||||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { sendEmail, openReport } = usePrintService();
|
const { sendEmail, openReport } = usePrintService();
|
||||||
|
@ -89,15 +90,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('Employee'),
|
label: t('Employee'),
|
||||||
columnField: {
|
name: 'workerFk',
|
||||||
component: 'userLink',
|
|
||||||
attrs: ({ row }) => {
|
|
||||||
return {
|
|
||||||
workerId: row.workerFk,
|
|
||||||
name: row.userName,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -131,7 +124,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'balance',
|
name: 'balance',
|
||||||
label: t('Balance'),
|
label: t('Balance'),
|
||||||
format: ({ balance }) => toCurrency(balance),
|
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -146,12 +138,14 @@ const columns = computed(() => [
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
title: t('globals.downloadPdf'),
|
title: t('globals.downloadPdf'),
|
||||||
|
isPrimary: true,
|
||||||
icon: 'cloud_download',
|
icon: 'cloud_download',
|
||||||
show: (row) => row.isInvoice,
|
show: (row) => row.isInvoice,
|
||||||
action: (row) => showBalancePdf(row),
|
action: (row) => showBalancePdf(row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Send compensation'),
|
title: t('Send compensation'),
|
||||||
|
isPrimary: true,
|
||||||
icon: 'outgoing_mail',
|
icon: 'outgoing_mail',
|
||||||
show: (row) => !!row.isCompensation,
|
show: (row) => !!row.isCompensation,
|
||||||
action: ({ id }) =>
|
action: ({ id }) =>
|
||||||
|
@ -256,6 +250,12 @@ const showBalancePdf = ({ id }) => {
|
||||||
<template #column-balance="{ rowIndex }">
|
<template #column-balance="{ rowIndex }">
|
||||||
{{ toCurrency(balances[rowIndex]?.balance) }}
|
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-workerFk="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.userName }}
|
||||||
|
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<span class="link" v-if="row.isInvoice" @click.stop>
|
<span class="link" v-if="row.isInvoice" @click.stop>
|
||||||
{{ t('bill', { ref: row.description }) }}
|
{{ t('bill', { ref: row.description }) }}
|
||||||
|
|
|
@ -3,18 +3,20 @@ import { onBeforeMount, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { getClientRisk } from '../composables/getClientRisk';
|
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
|
||||||
|
import { getClientRisk } from '../composables/getClientRisk';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputNumber from 'components/common/VnInputNumber.vue';
|
import VnInputNumber from 'components/common/VnInputNumber.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -48,7 +50,7 @@ const maxAmount = ref();
|
||||||
const accountingType = ref({});
|
const accountingType = ref({});
|
||||||
const isCash = ref(false);
|
const isCash = ref(false);
|
||||||
const formModelRef = ref(false);
|
const formModelRef = ref(false);
|
||||||
|
const amountToReturn = ref();
|
||||||
const filterBanks = {
|
const filterBanks = {
|
||||||
fields: ['id', 'bank', 'accountingTypeFk'],
|
fields: ['id', 'bank', 'accountingTypeFk'],
|
||||||
include: { relation: 'accountingType' },
|
include: { relation: 'accountingType' },
|
||||||
|
@ -90,7 +92,7 @@ function setPaymentType(data, accounting) {
|
||||||
let descriptions = [];
|
let descriptions = [];
|
||||||
if (accountingType.value.receiptDescription)
|
if (accountingType.value.receiptDescription)
|
||||||
descriptions.push(accountingType.value.receiptDescription);
|
descriptions.push(accountingType.value.receiptDescription);
|
||||||
if (data.description) descriptions.push(data.description);
|
if (data.description > 0) descriptions.push(data.description);
|
||||||
data.description = descriptions.join(', ');
|
data.description = descriptions.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ const calculateFromAmount = (event) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateFromDeliveredAmount = (event) => {
|
const calculateFromDeliveredAmount = (event) => {
|
||||||
initialData.amountToReturn = parseFloat(event) - initialData.amountPaid;
|
amountToReturn.value = event - initialData.amountPaid;
|
||||||
};
|
};
|
||||||
|
|
||||||
function onBeforeSave(data) {
|
function onBeforeSave(data) {
|
||||||
|
@ -121,17 +123,16 @@ async function onDataSaved(formData, { id }) {
|
||||||
recipient: formData.email,
|
recipient: formData.email,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (viewReceipt.value) openReport(`Receipts/${id}/receipt-pdf`);
|
if (viewReceipt.value) openReport(`Receipts/${id}/receipt-pdf`, {}, '_blank');
|
||||||
} finally {
|
} finally {
|
||||||
if ($props.promise) $props.promise();
|
if ($props.promise) $props.promise();
|
||||||
if (closeButton.value) closeButton.value.click();
|
if (closeButton.value) closeButton.value.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function accountShortToStandard({ target: { value } }) {
|
async function getSupplierClientReferences(value) {
|
||||||
if (!value) return (initialData.description = '');
|
if (!value) return (initialData.description = '');
|
||||||
initialData.compensationAccount = value.replace('.', '0'.repeat(11 - value.length));
|
const params = { bankAccount: value };
|
||||||
const params = { bankAccount: initialData.compensationAccount };
|
|
||||||
const { data } = await axios(`Clients/getClientOrSupplierReference`, { params });
|
const { data } = await axios(`Clients/getClientOrSupplierReference`, { params });
|
||||||
if (!data.clientId) {
|
if (!data.clientId) {
|
||||||
initialData.description = t('Supplier Compensation Reference', {
|
initialData.description = t('Supplier Compensation Reference', {
|
||||||
|
@ -241,17 +242,16 @@ async function getAmountPaid() {
|
||||||
@update:model-value="getAmountPaid()"
|
@update:model-value="getAmountPaid()"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<div v-if="accountingType.code == 'compensation'">
|
||||||
<div v-if="data.bankFk?.accountingType?.code == 'compensation'">
|
|
||||||
<div class="text-h6">
|
<div class="text-h6">
|
||||||
{{ t('Compensation') }}
|
{{ t('Compensation') }}
|
||||||
</div>
|
</div>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInputNumber
|
<VnAccountNumber
|
||||||
:label="t('Compensation account')"
|
:label="t('Compensation account')"
|
||||||
clearable
|
clearable
|
||||||
v-model="data.compensationAccount"
|
v-model="data.compensationAccount"
|
||||||
@blur="accountShortToStandard"
|
@blur="getSupplierClientReferences(data.compensationAccount)"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</div>
|
</div>
|
||||||
|
@ -261,8 +261,7 @@ async function getAmountPaid() {
|
||||||
clearable
|
clearable
|
||||||
v-model="data.description"
|
v-model="data.description"
|
||||||
/>
|
/>
|
||||||
|
<div v-if="accountingType.code == 'cash'">
|
||||||
<div v-if="data.bankFk?.accountingType?.code == 'cash'">
|
|
||||||
<div class="text-h6">{{ t('Cash') }}</div>
|
<div class="text-h6">{{ t('Cash') }}</div>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
|
@ -274,7 +273,7 @@ async function getAmountPaid() {
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
:label="t('Amount to return')"
|
:label="t('Amount to return')"
|
||||||
disable
|
disable
|
||||||
v-model="data.amountToReturn"
|
v-model="amountToReturn"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const state = useState();
|
||||||
|
const user = state.getUser();
|
||||||
|
const vehicleId = computed(() => route.params.id);
|
||||||
|
|
||||||
|
const noteFilter = computed(() => {
|
||||||
|
return {
|
||||||
|
order: 'created DESC',
|
||||||
|
where: { vehicleFk: vehicleId.value },
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
vehicleFk: vehicleId.value,
|
||||||
|
workerFk: user.value.id,
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnNotes
|
||||||
|
url="vehicleObservations"
|
||||||
|
:add-note="true"
|
||||||
|
:filter="noteFilter"
|
||||||
|
:body="body"
|
||||||
|
style="overflow-y: auto"
|
||||||
|
required
|
||||||
|
deletable
|
||||||
|
/>
|
||||||
|
</template>
|
|
@ -18,7 +18,6 @@ import { usePrintService } from 'composables/usePrintService';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnPopup from 'src/components/common/VnPopup.vue';
|
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -183,7 +182,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
showValue: false,
|
showValue: false,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
style: 'min-width: 170px;',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('globals.packages'),
|
label: t('globals.packages'),
|
||||||
|
@ -507,6 +505,7 @@ watch(route, () => {
|
||||||
:props="props"
|
:props="props"
|
||||||
@click="stopEventPropagation($event, col)"
|
@click="stopEventPropagation($event, col)"
|
||||||
:style="col.style"
|
:style="col.style"
|
||||||
|
style="padding-left: 5px"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="tableColumnComponents[col.name].component"
|
:is="tableColumnComponents[col.name].component"
|
||||||
|
@ -613,23 +612,10 @@ watch(route, () => {
|
||||||
<QTd class="text-right">
|
<QTd class="text-right">
|
||||||
<span>{{ entry.volumeKg }}</span>
|
<span>{{ entry.volumeKg }}</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd />
|
<QTd :colspan="5" class="text-right">
|
||||||
<QTd />
|
<span>
|
||||||
<QTd />
|
{{ entry.evaNotes }}
|
||||||
<QTd />
|
</span>
|
||||||
<QTd>
|
|
||||||
<QBtn
|
|
||||||
v-if="entry.evaNotes"
|
|
||||||
icon="comment"
|
|
||||||
size="md"
|
|
||||||
flat
|
|
||||||
color="primary"
|
|
||||||
>
|
|
||||||
<VnPopup
|
|
||||||
:title="t('globals.observations')"
|
|
||||||
:content="entry.evaNotes"
|
|
||||||
/>
|
|
||||||
</QBtn>
|
|
||||||
</QTd>
|
</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
@ -643,7 +629,11 @@ watch(route, () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.q-table) {
|
:deep(.q-table) {
|
||||||
|
table-layout: auto;
|
||||||
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
tbody tr td {
|
tbody tr td {
|
||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
|
|
|
@ -166,7 +166,7 @@ const vehicleCard = {
|
||||||
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
|
component: () => import('src/pages/Route/Vehicle/Card/VehicleCard.vue'),
|
||||||
redirect: { name: 'VehicleSummary' },
|
redirect: { name: 'VehicleSummary' },
|
||||||
meta: {
|
meta: {
|
||||||
menu: ['VehicleBasicData'],
|
menu: ['VehicleBasicData', 'VehicleNotes'],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
@ -187,6 +187,15 @@ const vehicleCard = {
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Route/Vehicle/Card/VehicleBasicData.vue'),
|
component: () => import('src/pages/Route/Vehicle/Card/VehicleBasicData.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'VehicleNotes',
|
||||||
|
path: 'notes',
|
||||||
|
meta: {
|
||||||
|
title: 'notes',
|
||||||
|
icon: 'vn:notes',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Vehicle/Card/VehicleNotes.vue'),
|
||||||
|
}
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
describe('Vehicle Notes', () => {
|
||||||
|
const selectors = {
|
||||||
|
addNoteInput: 'Add note here..._input',
|
||||||
|
saveNoteBtn: 'saveNote',
|
||||||
|
deleteNoteBtn: 'notesRemoveNoteBtn',
|
||||||
|
noteCard: '.column.full-width > :nth-child(1) > .q-card__section--vert',
|
||||||
|
};
|
||||||
|
|
||||||
|
const noteText = 'Golpe parachoques trasero';
|
||||||
|
const newNoteText = 'probando';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/route/vehicle/1/notes`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should add new note', () => {
|
||||||
|
cy.dataCy(selectors.addNoteInput).should('be.visible').type(newNoteText);
|
||||||
|
cy.dataCy(selectors.saveNoteBtn).click();
|
||||||
|
cy.validateContent(selectors.noteCard, newNoteText);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should delete note', () => {
|
||||||
|
cy.dataCy(selectors.deleteNoteBtn).first().should('be.visible').click();
|
||||||
|
cy.get(selectors.noteCard).first().should('have.text', noteText);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue