0
0
Fork 0

Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7717_fixOrderCatalog

This commit is contained in:
Jon Elias 2024-07-30 08:03:46 +02:00
commit 2cd696aeb9
23 changed files with 223 additions and 172 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter, onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useValidator } from 'src/composables/useValidator'; import { useValidator } from 'src/composables/useValidator';
@ -97,6 +97,19 @@ defineExpose({
vnPaginateRef, vnPaginateRef,
}); });
onBeforeRouteLeave((to, from, next) => {
if (hasChanges.value)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
async function fetch(data) { async function fetch(data) {
resetData(data); resetData(data);
emit('onFetch', data); emit('onFetch', data);

View File

@ -196,8 +196,8 @@ async function filterHandler(val, update) {
map-options map-options
use-input use-input
@filter="filterHandler" @filter="filterHandler"
hide-selected :hide-selected="$attrs['hide-selected'] ?? true"
fill-input :fill-input="$attrs['fill-input'] ?? true"
ref="vnSelectRef" ref="vnSelectRef"
lazy-rules lazy-rules
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"

View File

@ -7,7 +7,7 @@ defineProps({
</script> </script>
<template> <template>
<div :class="$q.screen.gt.md ? 'q-pb-lg' : 'q-pb-md'"> <div :class="$q.screen.gt.md ? 'q-pb-lg' : 'q-pb-md'">
<div class="header-link"> <div class="header-link" :style="{ cursor: url ? 'pointer' : 'default' }">
<a :href="url" :class="url ? 'link' : 'color-vn-text'"> <a :href="url" :class="url ? 'link' : 'color-vn-text'">
{{ text }} {{ text }}
<QIcon v-if="url" :name="icon" /> <QIcon v-if="url" :name="icon" />

View File

@ -153,6 +153,12 @@ select:-webkit-autofill {
background-color: var(--vn-section-color); background-color: var(--vn-section-color);
} }
.q-table td[shrink] {
text-overflow: ellipsis;
overflow: hidden;
max-width: 80px;
}
.tr-header { .tr-header {
color: var(--vn-label-color); color: var(--vn-label-color);
} }

View File

@ -254,6 +254,9 @@ globals:
comment: Comment comment: Comment
observations: Observations observations: Observations
goToModuleIndex: Go to module index goToModuleIndex: Go to module index
unsavedPopup:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred
@ -386,8 +389,8 @@ customer:
extendedList: extendedList:
tableVisibleColumns: tableVisibleColumns:
id: Identifier id: Identifier
name: Comercial name name: Name
socialName: Business name socialName: Social name
fi: Tax number fi: Tax number
salesPersonFk: Salesperson salesPersonFk: Salesperson
credit: Credit credit: Credit
@ -997,18 +1000,6 @@ route:
shipped: Preparation date shipped: Preparation date
viewCmr: View CMR viewCmr: View CMR
downloadCmrs: Download CMRs downloadCmrs: Download CMRs
columnLabels:
Id: Id
vehicle: Vehicle
description: Description
isServed: Served
worker: Worker
date: Date
started: Started
actions: Actions
agency: Agency
volume: Volume
finished: Finished
supplier: supplier:
list: list:
payMethod: Pay method payMethod: Pay method

View File

@ -256,6 +256,9 @@ globals:
comment: Comentario comment: Comentario
observations: Observaciones observations: Observaciones
goToModuleIndex: Ir al índice del módulo goToModuleIndex: Ir al índice del módulo
unsavedPopup:
title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar?
errors: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor
@ -385,7 +388,7 @@ customer:
extendedList: extendedList:
tableVisibleColumns: tableVisibleColumns:
id: Identificador id: Identificador
name: Nombre Comercial name: Nombre
socialName: Razón social socialName: Razón social
fi: NIF / CIF fi: NIF / CIF
salesPersonFk: Comercial salesPersonFk: Comercial
@ -978,18 +981,6 @@ route:
shipped: Fecha preparación shipped: Fecha preparación
viewCmr: Ver CMR viewCmr: Ver CMR
downloadCmrs: Descargar CMRs downloadCmrs: Descargar CMRs
columnLabels:
Id: Id
vehicle: Vehículo
description: Descripción
isServed: Servida
worker: Trabajador
date: Fecha
started: Iniciada
actions: Acciones
agency: Agencia
volume: Volumen
finished: Finalizada
supplier: supplier:
list: list:
payMethod: Método de pago payMethod: Método de pago

View File

@ -2,6 +2,7 @@
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import InvoiceInFilter from '../InvoiceInFilter.vue'; import InvoiceInFilter from '../InvoiceInFilter.vue';
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
const filter = { const filter = {
include: [ include: [
@ -28,8 +29,9 @@ const filter = {
:descriptor="InvoiceInDescriptor" :descriptor="InvoiceInDescriptor"
:filter-panel="InvoiceInFilter" :filter-panel="InvoiceInFilter"
search-data-key="InvoiceInList" search-data-key="InvoiceInList"
search-url="InvoiceIns/filter" >
searchbar-label="Search invoice" <template #searchbar>
searchbar-info="You can search by invoice reference" <InvoiceInSearchbar />
/> </template>
</VnCard>
</template> </template>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { ref, reactive, computed, onBeforeMount } from 'vue'; import { ref, reactive, computed, onBeforeMount } from 'vue';
import { useRouter, onBeforeRouteLeave } from 'vue-router'; import { useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import axios from 'axios'; import axios from 'axios';
@ -129,33 +129,23 @@ onBeforeMount(async () => {
totalAmount.value = data.totalDueDay; totalAmount.value = data.totalDueDay;
}); });
onBeforeRouteLeave(async (to, from) => { onBeforeRouteUpdate(async (to, from) => {
invoiceInCorrection.correcting.length = 0; invoiceInCorrection.correcting.length = 0;
invoiceInCorrection.corrected = null; invoiceInCorrection.corrected = null;
if (to.params.id !== from.params.id) await setInvoiceCorrection(entityId.value); if (to.params.id !== from.params.id) {
await setInvoiceCorrection(to.params.id);
const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`);
totalAmount.value = data.totalDueDay;
}
}); });
async function setInvoiceCorrection(id) { async function setInvoiceCorrection(id) {
const [{ data: correctingData }, { data: correctedData }] = await Promise.all([ const { data: correctingData } = await axios.get('InvoiceInCorrections', {
axios.get('InvoiceInCorrections', { params: { filter: { where: { correctingFk: id } } },
params: { });
filter: { const { data: correctedData } = await axios.get('InvoiceInCorrections', {
where: { params: { filter: { where: { correctedFk: id } } },
correctingFk: id, });
},
},
},
}),
axios.get('InvoiceInCorrections', {
params: {
filter: {
where: {
correctedFk: id,
},
},
},
}),
]);
if (correctingData[0]) invoiceInCorrection.corrected = correctingData[0].correctedFk; if (correctingData[0]) invoiceInCorrection.corrected = correctingData[0].correctedFk;
@ -380,7 +370,7 @@ const createInvoiceInCorrection = async () => {
</template> </template>
</VnLv> </VnLv>
</template> </template>
<template #action="{ entity }"> <template #actions="{ entity }">
<QCardActions> <QCardActions>
<QBtn <QBtn
size="md" size="md"
@ -448,7 +438,7 @@ const createInvoiceInCorrection = async () => {
readonly readonly
/> />
<VnSelect <VnSelect
:label="`${useCapitalize(t('globals.class'))}*`" :label="`${useCapitalize(t('globals.class'))}`"
v-model="correctionFormData.invoiceClass" v-model="correctionFormData.invoiceClass"
:options="siiTypeInvoiceOuts" :options="siiTypeInvoiceOuts"
option-value="id" option-value="id"
@ -458,7 +448,7 @@ const createInvoiceInCorrection = async () => {
</QItemSection> </QItemSection>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="`${useCapitalize(t('globals.type'))}*`" :label="`${useCapitalize(t('globals.type'))}`"
v-model="correctionFormData.invoiceType" v-model="correctionFormData.invoiceType"
:options="cplusRectificationTypes" :options="cplusRectificationTypes"
option-value="id" option-value="id"
@ -466,7 +456,7 @@ const createInvoiceInCorrection = async () => {
:required="true" :required="true"
/> />
<VnSelect <VnSelect
:label="`${useCapitalize(t('globals.reason'))}*`" :label="`${useCapitalize(t('globals.reason'))}`"
v-model="correctionFormData.invoiceReason" v-model="correctionFormData.invoiceReason"
:options="invoiceCorrectionTypes" :options="invoiceCorrectionTypes"
option-value="id" option-value="id"
@ -494,6 +484,9 @@ const createInvoiceInCorrection = async () => {
.q-card { .q-card {
max-width: 45em; max-width: 45em;
} }
.q-field:nth-child(1) {
padding-bottom: 20px;
}
} }
@media (max-width: $breakpoint-xs) { @media (max-width: $breakpoint-xs) {

View File

@ -72,7 +72,13 @@ const columns = computed(() => [
]); ]);
const getTotal = (data, key) => const getTotal = (data, key) =>
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0); data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
const option = options.find(({ id }) => id == obj);
return option ? `${obj}:${option[prop]}` : '';
};
</script> </script>
<template> <template>
<FetchData <FetchData
@ -92,7 +98,7 @@ const getTotal = (data, key) =>
ref="invoiceInFormRef" ref="invoiceInFormRef"
data-key="InvoiceInIntrastats" data-key="InvoiceInIntrastats"
url="InvoiceInIntrastats" url="InvoiceInIntrastats"
:auto-load="!currency" auto-load
:data-required="{ invoiceInFk: invoiceInId }" :data-required="{ invoiceInFk: invoiceInId }"
:filter="filter" :filter="filter"
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
@ -124,6 +130,9 @@ const getTotal = (data, key) =>
option-value="id" option-value="id"
option-label="description" option-label="description"
:filter-options="['id', 'description']" :filter-options="['id', 'description']"
:hide-selected="false"
:fill-input="false"
:display-value="formatOpt(row, col, 'description')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -247,7 +256,11 @@ const getTotal = (data, key) =>
} }
} }
</style> </style>
<style lang="scss" scoped></style> <style lang="scss" scoped>
:deep(.q-table tr .q-td:nth-child(2) input) {
display: none;
}
</style>
<i18n> <i18n>
en: en:
amount: Amount amount: Amount

View File

@ -66,7 +66,7 @@ const vatColumns = ref([
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate), field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value, currency.value), format: (value) => toCurrency(value, currency.value),
sortable: true, sortable: true,
align: 'center', align: 'left',
}, },
{ {
name: 'currency', name: 'currency',
@ -339,6 +339,16 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QTh> </QTh>
</QTr> </QTr>
</template> </template>
<template #body-cell-vat="{ value: vatCell }">
<QTd :title="vatCell" shrink>
{{ vatCell }}
</QTd>
</template>
<template #body-cell-transaction="{ value: transactionCell }">
<QTd :title="transactionCell" shrink>
{{ transactionCell }}
</QTd>
</template>
<template #bottom-row> <template #bottom-row>
<QTr class="bg"> <QTr class="bg">
<QTd></QTd> <QTd></QTd>
@ -347,7 +357,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
}}</QTd> }}</QTd>
<QTd></QTd> <QTd></QTd>
<QTd></QTd> <QTd></QTd>
<QTd class="text-center">{{ <QTd>{{
toCurrency(getTotalTax(entity.invoiceInTax, currency)) toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd> }}</QTd>
<QTd></QTd> <QTd></QTd>
@ -423,6 +433,10 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
.bg { .bg {
background-color: var(--vn-accent-color); background-color: var(--vn-accent-color);
} }
.q-chip {
color: var(--vn-text-color);
}
@media (min-width: $breakpoint-md) { @media (min-width: $breakpoint-md) {
.summaryBody { .summaryBody {
.vat { .vat {

View File

@ -162,8 +162,14 @@ async function addExpense() {
} }
} }
const getTotalTaxableBase = (rows) => const getTotalTaxableBase = (rows) =>
rows.reduce((acc, { taxableBase }) => acc + +taxableBase, 0); rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0); const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
const option = options.find(({ id }) => id == obj);
return option ? `${obj}:${option[prop]}` : '';
};
</script> </script>
<template> <template>
<FetchData <FetchData
@ -254,8 +260,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
:option-value="col.optionValue" :option-value="col.optionValue"
:option-label="col.optionLabel" :option-label="col.optionLabel"
:filter-options="['id', 'vat']" :filter-options="['id', 'vat']"
:autofocus="col.tabIndex == 1" :hide-selected="false"
input-debounce="0" :fill-input="false"
:display-value="formatOpt(row, col, 'vat')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -280,6 +287,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
:filter-options="['id', 'transaction']" :filter-options="['id', 'transaction']"
:autofocus="col.tabIndex == 1" :autofocus="col.tabIndex == 1"
input-debounce="0" input-debounce="0"
:hide-selected="false"
:fill-input="false"
:display-value="formatOpt(row, col, 'transaction')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -474,11 +484,16 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
/> />
</QPageSticky> </QPageSticky>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .bg {
background-color: var(--vn-light-gray); background-color: var(--vn-light-gray);
} }
:deep(.q-table tr td:nth-child(n + 4):nth-child(-n + 5) input) {
display: none;
}
@media (max-width: $breakpoint-xs) { @media (max-width: $breakpoint-xs) {
.q-dialog { .q-dialog {
.q-card { .q-card {

View File

@ -7,13 +7,19 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnCurrency from 'src/components/common/VnCurrency.vue';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } }); defineProps({ dataKey: { type: String, required: true } });
const suppliers = ref([]); const activities = ref([]);
</script> </script>
<template> <template>
<FetchData
url="SupplierActivities"
auto-load
@on-fetch="(data) => (activities = data)"
/>
<VnFilterPanel :data-key="dataKey" :search-button="true"> <VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -29,11 +35,7 @@ const suppliers = ref([]);
v-model="params.supplierRef" v-model="params.supplierRef"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -43,11 +45,7 @@ const suppliers = ref([]);
v-model="params.fi" v-model="params.fi"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -59,12 +57,11 @@ const suppliers = ref([]);
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:options="suppliers"
dense dense
outlined outlined
rounded rounded
> :filter-options="['id', 'name']"
</VnSelect> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -74,11 +71,7 @@ const suppliers = ref([]);
v-model="params.account" v-model="params.account"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="person" size="sm" />
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -105,7 +98,21 @@ const suppliers = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-md"> <QItem>
<QItemSection>
<VnSelect
:label="t('params.supplierActivityFk')"
v-model="params.supplierActivityFk"
dense
outlined
rounded
option-value="code"
option-label="name"
:options="activities"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection> <QItemSection>
<QCheckbox <QCheckbox
:label="t('params.isBooked')" :label="t('params.isBooked')"
@ -114,6 +121,14 @@ const suppliers = ref([]);
toggle-indeterminate toggle-indeterminate
/> />
</QItemSection> </QItemSection>
<QItemSection>
<QCheckbox
:label="t('params.correctingFk')"
v-model="params.correctingFk"
@update:model-value="searchFn()"
toggle-indeterminate
/>
</QItemSection>
</QItem> </QItem>
<QExpansionItem :label="t('More options')" expand-separator> <QExpansionItem :label="t('More options')" expand-separator>
<QItem> <QItem>
@ -123,11 +138,7 @@ const suppliers = ref([]);
v-model="params.serialNumber" v-model="params.serialNumber"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -137,11 +148,7 @@ const suppliers = ref([]);
v-model="params.serial" v-model="params.serial"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -151,11 +158,7 @@ const suppliers = ref([]);
v-model="params.awbCode" v-model="params.awbCode"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
</QExpansionItem> </QExpansionItem>
@ -166,7 +169,7 @@ const suppliers = ref([]);
<i18n> <i18n>
en: en:
params: params:
search: ID search: Id or supplier name
supplierRef: Supplier ref. supplierRef: Supplier ref.
supplierFk: Supplier supplierFk: Supplier
fi: Supplier fiscal id fi: Supplier fiscal id
@ -177,12 +180,17 @@ en:
dued: Dued dued: Dued
serialNumber: Serial Number serialNumber: Serial Number
serial: Serial serial: Serial
account: Account account: Ledger account
isBooked: is booked isBooked: is booked
correctedFk: Rectificatives correctedFk: Rectified
issued: Issued
to: To
awbCode: AWB
correctingFk: Rectificative
supplierActivityFk: Supplier activity
es: es:
params: params:
search: Contiene search: Id o nombre proveedor
supplierRef: Ref. proveedor supplierRef: Ref. proveedor
supplierFk: Proveedor supplierFk: Proveedor
clientFk: Cliente clientFk: Cliente
@ -193,10 +201,12 @@ es:
amount: Importe amount: Importe
issued: Emitida issued: Emitida
isBooked: Conciliada isBooked: Conciliada
account: Cuenta account: Cuenta contable
created: Creada created: Creada
dued: Vencida dued: Vencida
correctedFk: Rectificativas correctedFk: Rectificada
correctingFk: Rectificativa
supplierActivityFk: Actividad proveedor
From: Desde From: Desde
To: Hasta To: Hasta
Amount: Importe Amount: Importe

View File

@ -1,44 +1,29 @@
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from 'vue'; import { onMounted, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { downloadFile } from 'src/composables/downloadFile'; import { downloadFile } from 'src/composables/downloadFile';
import { toDate, toCurrency } from 'src/filters/index'; import { toDate, toCurrency } from 'src/filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue'; import CardList from 'src/components/ui/CardList.vue';
import InvoiceInFilter from './InvoiceInFilter.vue'; import InvoiceInFilter from './InvoiceInFilter.vue';
import { getUrl } from 'src/composables/getUrl';
import InvoiceInSummary from './Card/InvoiceInSummary.vue'; import InvoiceInSummary from './Card/InvoiceInSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceInSearchbar from 'src/pages/InvoiceIn/InvoiceInSearchbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
let url = ref();
const { t } = useI18n(); const { t } = useI18n();
onMounted(async () => { onMounted(async () => (stateStore.rightDrawer = true));
stateStore.rightDrawer = true;
url.value = await getUrl('');
});
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
function navigate(id) {
router.push({ path: `/invoice-in/${id}` });
}
</script> </script>
<template> <template>
<VnSearchbar <InvoiceInSearchbar />
data-key="InvoiceInList"
:label="t('Search invoice')"
:info="t('You can search by invoice reference')"
/>
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<InvoiceInFilter data-key="InvoiceInList" /> <InvoiceInFilter data-key="InvoiceInList" />
@ -54,10 +39,10 @@ function navigate(id) {
> >
<template #body="{ rows }"> <template #body="{ rows }">
<CardList <CardList
v-for="row of rows" v-for="(row, index) of rows"
:key="row.id" :key="index"
:title="row.supplierRef" :title="row.supplierRef"
@click="navigate(row.id)" @click="$router.push({ path: `/invoice-in/${row.id}` })"
:id="row.id" :id="row.id"
> >
<template #list-items> <template #list-items>
@ -102,7 +87,9 @@ function navigate(id) {
<template #actions> <template #actions>
<QBtn <QBtn
:label="t('components.smartCard.openCard')" :label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)" @click.stop="
$router.push({ path: `/invoice-in/${row.id}` })
"
outline outline
type="reset" type="reset"
/> />
@ -115,7 +102,7 @@ function navigate(id) {
class="q-mt-sm" class="q-mt-sm"
/> />
<QBtn <QBtn
:label="t('Download')" :label="t('globals.download')"
class="q-mt-sm" class="q-mt-sm"
@click.stop="downloadFile(row.dmsFk)" @click.stop="downloadFile(row.dmsFk)"
type="submit" type="submit"
@ -131,10 +118,3 @@ function navigate(id) {
<QBtn color="primary" icon="add" size="lg" round :href="`/#/invoice-in/create`" /> <QBtn color="primary" icon="add" size="lg" round :href="`/#/invoice-in/create`" />
</QPageSticky> </QPageSticky>
</template> </template>
<i18n>
es:
Search invoice: Buscar factura recibida
You can search by invoice reference: Puedes buscar por referencia de la factura
Download: Descargar
</i18n>

View File

@ -0,0 +1,18 @@
<script setup>
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
</script>
<template>
<VnSearchbar
data-key="InvoiceInList"
:label="t('Search invoice')"
:info="t('Search invoices in by id or supplier fiscal name')"
url="InvoiceIns/filter"
/>
</template>
<i18n>
es:
Search invoice: Buscar factura recibida
Search invoices in by id or supplier fiscal name: Buscar facturas recibidas por id o por nombre fiscal del proveedor
</i18n>

View File

@ -1,2 +0,0 @@
Search invoice: Buscar factura recibida
You can search by invoice reference: Puedes buscar por referencia de la factura

View File

@ -7,6 +7,7 @@ import axios from 'axios';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin'; import { useLogin } from 'src/composables/useLogin';
import VnInput from 'src/components/common/VnInput.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const session = useSession(); const session = useSession();

View File

@ -9,12 +9,16 @@ describe('InvoiceInCorrective', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/1/summary`); cy.visit(`/#/invoice-in/1/summary`);
cy.waitForElement('.q-page'); cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
cy.openActionsDescriptor(); cy.openActionsDescriptor();
cy.get(createRectificative).click(); cy.get(createRectificative).click();
cy.get(saveDialog).click(); cy.get(saveDialog).click();
cy.wait('@corrective').then((interception) => {
const correctingId = interception.response.body;
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
});
cy.get(rectificativeSection).click(); cy.get(rectificativeSection).click();
cy.get('tbody > tr:visible').should('have.length', 1); cy.get('tbody > tr:visible').should('have.length', 1);
}); });

View File

@ -11,25 +11,29 @@ describe('InvoiceInIntrastat', () => {
it('should edit the first line', () => { it('should edit the first line', () => {
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid'); cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid');
cy.get(inputBtns).eq(1).click(); cy.get(inputBtns).eq(1).click();
cy.saveCard(); cy.saveCard();
cy.visit(`/#/invoice-in/1/intrastat`); cy.get(`${firstLineCode} span`).should(
'have.text',
cy.getValue(firstLineCode).should('equal', 'Plantas vivas: Esqueje/injerto, Vid'); '6021010:Plantas vivas: Esqueje/injerto, Vid'
);
}); });
it('should add a new row', () => { it('should add a new row', () => {
const rowData = [false, 'Plantas vivas: Esqueje/injerto, Vid', 30, 10, 5, 'FR'];
cy.addRow(); cy.addRow();
cy.fillRow(thirdRow, rowData); cy.fillRow(thirdRow, [
false,
'Plantas vivas: Esqueje/injerto, Vid',
30,
10,
5,
'FR',
]);
cy.saveCard(); cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });
it('should remove the first line', () => { it('should remove the first line', () => {
cy.removeRow(2); cy.removeRow(1);
}); });
}); });

View File

@ -16,9 +16,7 @@ describe('InvoiceInVat', () => {
it('should edit the sage iva', () => { it('should edit the sage iva', () => {
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE'); cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
cy.saveCard(); cy.saveCard();
cy.visit(`/#/invoice-in/1/vat`); cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
cy.getValue(firstLineVat).should('equal', '8');
}); });
it('should add a new row', () => { it('should add a new row', () => {

View File

@ -5,15 +5,7 @@ describe('WorkerList', () => {
cy.visit('/#/worker/list'); cy.visit('/#/worker/list');
}); });
it('should opern the worker summary', () => { it('should open the worker summary', () => {
cy.get( cy.get('.q-drawer .q-form input[aria-label="Name"]').type('jessica jones{enter}');
':nth-child(1) > .text-right > .q-btn > .q-btn__content > .q-icon'
).click();
});
it('should go to the worker summary', () => {
cy.get('#searchbar > .q-field > .q-field__inner > .q-field__control').type(
'jessica jones{enter}'
);
}); });
}); });

View File

@ -2,6 +2,7 @@ describe('WorkerLocker', () => {
const workerId = 1109; const workerId = 1109;
const lockerCode = '2F'; const lockerCode = '2F';
const input = '.q-card input'; const input = '.q-card input';
const thirdOpt = '[role="listbox"] .q-item:nth-child(3)';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('productionBoss'); cy.login('productionBoss');
@ -10,7 +11,9 @@ describe('WorkerLocker', () => {
it('should allocates a locker', () => { it('should allocates a locker', () => {
cy.get(input).click(); cy.get(input).click();
cy.get(input).type(`${lockerCode}{enter}`); cy.waitForElement('[role="listbox"]');
cy.get(input).should('have.value', lockerCode); cy.get(thirdOpt).click();
cy.saveCard();
cy.get(input).invoke('val').should('eq', lockerCode);
}); });
}); });

View File

@ -100,6 +100,7 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
case 'select': case 'select':
cy.wrap(el).type(val); cy.wrap(el).type(val);
cy.get('.q-menu .q-item').contains(val).click(); cy.get('.q-menu .q-item').contains(val).click();
cy.get('body').click();
break; break;
case 'date': case 'date':
cy.wrap(el).type(val.split('-').join('')); cy.wrap(el).type(val.split('-').join(''));
@ -187,11 +188,14 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
}); });
Cypress.Commands.add('removeRow', (rowIndex) => { Cypress.Commands.add('removeRow', (rowIndex) => {
const trEls = 'tbody > tr:visible';
let rowsBefore; let rowsBefore;
cy.get('tbody > tr:visible') cy.get('tbody > tr')
.its('length') .its('length')
.then((length) => { .then((length) => {
cy.get('.q-checkbox').eq(rowIndex).click(); cy.get(`${trEls} .q-checkbox`)
.eq(rowIndex - 1)
.click();
cy.removeCard(); cy.removeCard();
cy.get('.q-dialog button').eq(2).click(); cy.get('.q-dialog button').eq(2).click();
rowsBefore = length; rowsBefore = length;
@ -200,7 +204,7 @@ Cypress.Commands.add('removeRow', (rowIndex) => {
// Check the existence of tbody before performing the second assertion. // Check the existence of tbody before performing the second assertion.
cy.get('tbody').then(($tbody) => { cy.get('tbody').then(($tbody) => {
if ($tbody.length > 0) if ($tbody.length > 0)
cy.get('tbody > tr:visible').should('have.length', rowsBefore - 1); cy.get('tbody > tr').should('have.length', rowsBefore - 1);
}); });
}); });
}); });

View File

@ -38,6 +38,7 @@ vi.mock('vue-router', () => ({
meta: { moduleName: 'mockName' }, meta: { moduleName: 'mockName' },
path: 'mockSection/list', path: 'mockSection/list',
}), }),
onBeforeRouteLeave: () => {},
})); }));
vi.mock('axios'); vi.mock('axios');