forked from verdnatura/salix-front
Reviewed-on: verdnatura/salix-front#466 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
328c54deee
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRouter, onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
|
@ -97,6 +97,19 @@ defineExpose({
|
|||
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) {
|
||||
resetData(data);
|
||||
emit('onFetch', data);
|
||||
|
|
|
@ -196,8 +196,8 @@ async function filterHandler(val, update) {
|
|||
map-options
|
||||
use-input
|
||||
@filter="filterHandler"
|
||||
hide-selected
|
||||
fill-input
|
||||
:hide-selected="$attrs['hide-selected'] ?? true"
|
||||
:fill-input="$attrs['fill-input'] ?? true"
|
||||
ref="vnSelectRef"
|
||||
lazy-rules
|
||||
:class="{ required: $attrs.required }"
|
||||
|
|
|
@ -7,7 +7,7 @@ defineProps({
|
|||
</script>
|
||||
<template>
|
||||
<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'">
|
||||
{{ text }}
|
||||
<QIcon v-if="url" :name="icon" />
|
||||
|
|
|
@ -153,6 +153,12 @@ select:-webkit-autofill {
|
|||
background-color: var(--vn-section-color);
|
||||
}
|
||||
|
||||
.q-table td[shrink] {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
.tr-header {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
|
|
|
@ -254,6 +254,9 @@ globals:
|
|||
comment: Comment
|
||||
observations: Observations
|
||||
goToModuleIndex: Go to module index
|
||||
unsavedPopup:
|
||||
title: Unsaved changes will be lost
|
||||
subtitle: Are you sure exit without saving?
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
|
@ -386,8 +389,8 @@ customer:
|
|||
extendedList:
|
||||
tableVisibleColumns:
|
||||
id: Identifier
|
||||
name: Comercial name
|
||||
socialName: Business name
|
||||
name: Name
|
||||
socialName: Social name
|
||||
fi: Tax number
|
||||
salesPersonFk: Salesperson
|
||||
credit: Credit
|
||||
|
@ -997,18 +1000,6 @@ route:
|
|||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
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:
|
||||
list:
|
||||
payMethod: Pay method
|
||||
|
|
|
@ -256,6 +256,9 @@ globals:
|
|||
comment: Comentario
|
||||
observations: Observaciones
|
||||
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:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
@ -385,7 +388,7 @@ customer:
|
|||
extendedList:
|
||||
tableVisibleColumns:
|
||||
id: Identificador
|
||||
name: Nombre Comercial
|
||||
name: Nombre
|
||||
socialName: Razón social
|
||||
fi: NIF / CIF
|
||||
salesPersonFk: Comercial
|
||||
|
@ -978,18 +981,6 @@ route:
|
|||
shipped: Fecha preparación
|
||||
viewCmr: Ver CMR
|
||||
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:
|
||||
list:
|
||||
payMethod: Método de pago
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import VnCard from 'components/common/VnCard.vue';
|
||||
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
|
||||
import InvoiceInFilter from '../InvoiceInFilter.vue';
|
||||
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
|
@ -28,8 +29,9 @@ const filter = {
|
|||
:descriptor="InvoiceInDescriptor"
|
||||
:filter-panel="InvoiceInFilter"
|
||||
search-data-key="InvoiceInList"
|
||||
search-url="InvoiceIns/filter"
|
||||
searchbar-label="Search invoice"
|
||||
searchbar-info="You can search by invoice reference"
|
||||
/>
|
||||
>
|
||||
<template #searchbar>
|
||||
<InvoiceInSearchbar />
|
||||
</template>
|
||||
</VnCard>
|
||||
</template>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
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 { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
|
@ -129,33 +129,23 @@ onBeforeMount(async () => {
|
|||
totalAmount.value = data.totalDueDay;
|
||||
});
|
||||
|
||||
onBeforeRouteLeave(async (to, from) => {
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
invoiceInCorrection.correcting.length = 0;
|
||||
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) {
|
||||
const [{ data: correctingData }, { data: correctedData }] = await Promise.all([
|
||||
axios.get('InvoiceInCorrections', {
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
correctingFk: id,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
axios.get('InvoiceInCorrections', {
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
correctedFk: id,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
]);
|
||||
const { data: correctingData } = await axios.get('InvoiceInCorrections', {
|
||||
params: { filter: { where: { correctingFk: id } } },
|
||||
});
|
||||
const { data: correctedData } = await axios.get('InvoiceInCorrections', {
|
||||
params: { filter: { where: { correctedFk: id } } },
|
||||
});
|
||||
|
||||
if (correctingData[0]) invoiceInCorrection.corrected = correctingData[0].correctedFk;
|
||||
|
||||
|
@ -380,7 +370,7 @@ const createInvoiceInCorrection = async () => {
|
|||
</template>
|
||||
</VnLv>
|
||||
</template>
|
||||
<template #action="{ entity }">
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions>
|
||||
<QBtn
|
||||
size="md"
|
||||
|
@ -448,7 +438,7 @@ const createInvoiceInCorrection = async () => {
|
|||
readonly
|
||||
/>
|
||||
<VnSelect
|
||||
:label="`${useCapitalize(t('globals.class'))}*`"
|
||||
:label="`${useCapitalize(t('globals.class'))}`"
|
||||
v-model="correctionFormData.invoiceClass"
|
||||
:options="siiTypeInvoiceOuts"
|
||||
option-value="id"
|
||||
|
@ -458,7 +448,7 @@ const createInvoiceInCorrection = async () => {
|
|||
</QItemSection>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="`${useCapitalize(t('globals.type'))}*`"
|
||||
:label="`${useCapitalize(t('globals.type'))}`"
|
||||
v-model="correctionFormData.invoiceType"
|
||||
:options="cplusRectificationTypes"
|
||||
option-value="id"
|
||||
|
@ -466,7 +456,7 @@ const createInvoiceInCorrection = async () => {
|
|||
:required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="`${useCapitalize(t('globals.reason'))}*`"
|
||||
:label="`${useCapitalize(t('globals.reason'))}`"
|
||||
v-model="correctionFormData.invoiceReason"
|
||||
:options="invoiceCorrectionTypes"
|
||||
option-value="id"
|
||||
|
@ -494,6 +484,9 @@ const createInvoiceInCorrection = async () => {
|
|||
.q-card {
|
||||
max-width: 45em;
|
||||
}
|
||||
.q-field:nth-child(1) {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
|
|
|
@ -72,7 +72,13 @@ const columns = computed(() => [
|
|||
]);
|
||||
|
||||
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>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -92,7 +98,7 @@ const getTotal = (data, key) =>
|
|||
ref="invoiceInFormRef"
|
||||
data-key="InvoiceInIntrastats"
|
||||
url="InvoiceInIntrastats"
|
||||
:auto-load="!currency"
|
||||
auto-load
|
||||
:data-required="{ invoiceInFk: invoiceInId }"
|
||||
:filter="filter"
|
||||
v-model:selected="rowsSelected"
|
||||
|
@ -124,6 +130,9 @@ const getTotal = (data, key) =>
|
|||
option-value="id"
|
||||
option-label="description"
|
||||
:filter-options="['id', 'description']"
|
||||
:hide-selected="false"
|
||||
:fill-input="false"
|
||||
:display-value="formatOpt(row, col, 'description')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -247,7 +256,11 @@ const getTotal = (data, key) =>
|
|||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
:deep(.q-table tr .q-td:nth-child(2) input) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
amount: Amount
|
||||
|
|
|
@ -66,7 +66,7 @@ const vatColumns = ref([
|
|||
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
|
||||
format: (value) => toCurrency(value, currency.value),
|
||||
sortable: true,
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'currency',
|
||||
|
@ -339,6 +339,16 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
</QTh>
|
||||
</QTr>
|
||||
</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>
|
||||
<QTr class="bg">
|
||||
<QTd></QTd>
|
||||
|
@ -347,7 +357,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
}}</QTd>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd class="text-center">{{
|
||||
<QTd>{{
|
||||
toCurrency(getTotalTax(entity.invoiceInTax, currency))
|
||||
}}</QTd>
|
||||
<QTd></QTd>
|
||||
|
@ -423,6 +433,10 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
.bg {
|
||||
background-color: var(--vn-accent-color);
|
||||
}
|
||||
.q-chip {
|
||||
color: var(--vn-text-color);
|
||||
}
|
||||
|
||||
@media (min-width: $breakpoint-md) {
|
||||
.summaryBody {
|
||||
.vat {
|
||||
|
|
|
@ -162,8 +162,14 @@ async function addExpense() {
|
|||
}
|
||||
}
|
||||
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 formatOpt = (row, { model, options }, prop) => {
|
||||
const obj = row[model];
|
||||
const option = options.find(({ id }) => id == obj);
|
||||
return option ? `${obj}:${option[prop]}` : '';
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -254,8 +260,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
|
|||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'vat']"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
input-debounce="0"
|
||||
:hide-selected="false"
|
||||
:fill-input="false"
|
||||
:display-value="formatOpt(row, col, 'vat')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -280,6 +287,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
|
|||
:filter-options="['id', 'transaction']"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
input-debounce="0"
|
||||
:hide-selected="false"
|
||||
:fill-input="false"
|
||||
:display-value="formatOpt(row, col, 'transaction')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -474,11 +484,16 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
|
|||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bg {
|
||||
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) {
|
||||
.q-dialog {
|
||||
.q-card {
|
||||
|
|
|
@ -7,13 +7,19 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnCurrency from 'src/components/common/VnCurrency.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
const suppliers = ref([]);
|
||||
const activities = ref([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="SupplierActivities"
|
||||
auto-load
|
||||
@on-fetch="(data) => (activities = data)"
|
||||
/>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
@ -29,11 +35,7 @@ const suppliers = ref([]);
|
|||
v-model="params.supplierRef"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="vn:client" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -43,11 +45,7 @@ const suppliers = ref([]);
|
|||
v-model="params.fi"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -59,12 +57,11 @@ const suppliers = ref([]);
|
|||
:label="t('params.supplierFk')"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:options="suppliers"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelect>
|
||||
:filter-options="['id', 'name']"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -74,11 +71,7 @@ const suppliers = ref([]);
|
|||
v-model="params.account"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="person" size="sm" />
|
||||
</template>
|
||||
</VnInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -105,7 +98,21 @@ const suppliers = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</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>
|
||||
<QCheckbox
|
||||
:label="t('params.isBooked')"
|
||||
|
@ -114,6 +121,14 @@ const suppliers = ref([]);
|
|||
toggle-indeterminate
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.correctingFk')"
|
||||
v-model="params.correctingFk"
|
||||
@update:model-value="searchFn()"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QExpansionItem :label="t('More options')" expand-separator>
|
||||
<QItem>
|
||||
|
@ -123,11 +138,7 @@ const suppliers = ref([]);
|
|||
v-model="params.serialNumber"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -137,11 +148,7 @@ const suppliers = ref([]);
|
|||
v-model="params.serial"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -151,11 +158,7 @@ const suppliers = ref([]);
|
|||
v-model="params.awbCode"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
|
@ -166,7 +169,7 @@ const suppliers = ref([]);
|
|||
<i18n>
|
||||
en:
|
||||
params:
|
||||
search: ID
|
||||
search: Id or supplier name
|
||||
supplierRef: Supplier ref.
|
||||
supplierFk: Supplier
|
||||
fi: Supplier fiscal id
|
||||
|
@ -177,12 +180,17 @@ en:
|
|||
dued: Dued
|
||||
serialNumber: Serial Number
|
||||
serial: Serial
|
||||
account: Account
|
||||
account: Ledger account
|
||||
isBooked: is booked
|
||||
correctedFk: Rectificatives
|
||||
correctedFk: Rectified
|
||||
issued: Issued
|
||||
to: To
|
||||
awbCode: AWB
|
||||
correctingFk: Rectificative
|
||||
supplierActivityFk: Supplier activity
|
||||
es:
|
||||
params:
|
||||
search: Contiene
|
||||
search: Id o nombre proveedor
|
||||
supplierRef: Ref. proveedor
|
||||
supplierFk: Proveedor
|
||||
clientFk: Cliente
|
||||
|
@ -193,10 +201,12 @@ es:
|
|||
amount: Importe
|
||||
issued: Emitida
|
||||
isBooked: Conciliada
|
||||
account: Cuenta
|
||||
account: Cuenta contable
|
||||
created: Creada
|
||||
dued: Vencida
|
||||
correctedFk: Rectificativas
|
||||
correctedFk: Rectificada
|
||||
correctingFk: Rectificativa
|
||||
supplierActivityFk: Actividad proveedor
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Amount: Importe
|
||||
|
|
|
@ -1,44 +1,29 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import { toDate, toCurrency } from 'src/filters/index';
|
||||
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 CardList from 'src/components/ui/CardList.vue';
|
||||
import InvoiceInFilter from './InvoiceInFilter.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import InvoiceInSummary from './Card/InvoiceInSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import InvoiceInSearchbar from 'src/pages/InvoiceIn/InvoiceInSearchbar.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
let url = ref();
|
||||
const { t } = useI18n();
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
url.value = await getUrl('');
|
||||
});
|
||||
onMounted(async () => (stateStore.rightDrawer = true));
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/invoice-in/${id}` });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="InvoiceInList"
|
||||
:label="t('Search invoice')"
|
||||
:info="t('You can search by invoice reference')"
|
||||
/>
|
||||
<InvoiceInSearchbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<InvoiceInFilter data-key="InvoiceInList" />
|
||||
|
@ -54,10 +39,10 @@ function navigate(id) {
|
|||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
v-for="(row, index) of rows"
|
||||
:key="index"
|
||||
:title="row.supplierRef"
|
||||
@click="navigate(row.id)"
|
||||
@click="$router.push({ path: `/invoice-in/${row.id}` })"
|
||||
:id="row.id"
|
||||
>
|
||||
<template #list-items>
|
||||
|
@ -102,7 +87,9 @@ function navigate(id) {
|
|||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
@click.stop="
|
||||
$router.push({ path: `/invoice-in/${row.id}` })
|
||||
"
|
||||
outline
|
||||
type="reset"
|
||||
/>
|
||||
|
@ -115,7 +102,7 @@ function navigate(id) {
|
|||
class="q-mt-sm"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('Download')"
|
||||
:label="t('globals.download')"
|
||||
class="q-mt-sm"
|
||||
@click.stop="downloadFile(row.dmsFk)"
|
||||
type="submit"
|
||||
|
@ -131,10 +118,3 @@ function navigate(id) {
|
|||
<QBtn color="primary" icon="add" size="lg" round :href="`/#/invoice-in/create`" />
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura recibida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
Download: Descargar
|
||||
</i18n>
|
||||
|
|
|
@ -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>
|
|
@ -1,2 +0,0 @@
|
|||
Search invoice: Buscar factura recibida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
|
@ -9,12 +9,16 @@ describe('InvoiceInCorrective', () => {
|
|||
cy.viewport(1280, 720);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/invoice-in/1/summary`);
|
||||
cy.waitForElement('.q-page');
|
||||
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||
|
||||
cy.openActionsDescriptor();
|
||||
|
||||
cy.get(createRectificative).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('tbody > tr:visible').should('have.length', 1);
|
||||
});
|
||||
|
|
|
@ -11,25 +11,29 @@ describe('InvoiceInIntrastat', () => {
|
|||
|
||||
it('should edit the first line', () => {
|
||||
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid');
|
||||
|
||||
cy.get(inputBtns).eq(1).click();
|
||||
|
||||
cy.saveCard();
|
||||
cy.visit(`/#/invoice-in/1/intrastat`);
|
||||
|
||||
cy.getValue(firstLineCode).should('equal', 'Plantas vivas: Esqueje/injerto, Vid');
|
||||
cy.get(`${firstLineCode} span`).should(
|
||||
'have.text',
|
||||
'6021010:Plantas vivas: Esqueje/injerto, Vid'
|
||||
);
|
||||
});
|
||||
|
||||
it('should add a new row', () => {
|
||||
const rowData = [false, 'Plantas vivas: Esqueje/injerto, Vid', 30, 10, 5, 'FR'];
|
||||
|
||||
cy.addRow();
|
||||
cy.fillRow(thirdRow, rowData);
|
||||
cy.fillRow(thirdRow, [
|
||||
false,
|
||||
'Plantas vivas: Esqueje/injerto, Vid',
|
||||
30,
|
||||
10,
|
||||
5,
|
||||
'FR',
|
||||
]);
|
||||
cy.saveCard();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
});
|
||||
|
||||
it('should remove the first line', () => {
|
||||
cy.removeRow(2);
|
||||
cy.removeRow(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,9 +16,7 @@ describe('InvoiceInVat', () => {
|
|||
it('should edit the sage iva', () => {
|
||||
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
|
||||
cy.saveCard();
|
||||
cy.visit(`/#/invoice-in/1/vat`);
|
||||
|
||||
cy.getValue(firstLineVat).should('equal', '8');
|
||||
cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
|
||||
});
|
||||
|
||||
it('should add a new row', () => {
|
||||
|
|
|
@ -100,6 +100,7 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
|||
case 'select':
|
||||
cy.wrap(el).type(val);
|
||||
cy.get('.q-menu .q-item').contains(val).click();
|
||||
cy.get('body').click();
|
||||
break;
|
||||
case 'date':
|
||||
cy.wrap(el).type(val.split('-').join(''));
|
||||
|
@ -187,11 +188,14 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add('removeRow', (rowIndex) => {
|
||||
const trEls = 'tbody > tr:visible';
|
||||
let rowsBefore;
|
||||
cy.get('tbody > tr:visible')
|
||||
cy.get('tbody > tr')
|
||||
.its('length')
|
||||
.then((length) => {
|
||||
cy.get('.q-checkbox').eq(rowIndex).click();
|
||||
cy.get(`${trEls} .q-checkbox`)
|
||||
.eq(rowIndex - 1)
|
||||
.click();
|
||||
cy.removeCard();
|
||||
cy.get('.q-dialog button').eq(2).click();
|
||||
rowsBefore = length;
|
||||
|
@ -200,7 +204,7 @@ Cypress.Commands.add('removeRow', (rowIndex) => {
|
|||
// Check the existence of tbody before performing the second assertion.
|
||||
cy.get('tbody').then(($tbody) => {
|
||||
if ($tbody.length > 0)
|
||||
cy.get('tbody > tr:visible').should('have.length', rowsBefore - 1);
|
||||
cy.get('tbody > tr').should('have.length', rowsBefore - 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -38,6 +38,7 @@ vi.mock('vue-router', () => ({
|
|||
meta: { moduleName: 'mockName' },
|
||||
path: 'mockSection/list',
|
||||
}),
|
||||
onBeforeRouteLeave: () => {},
|
||||
}));
|
||||
|
||||
vi.mock('axios');
|
||||
|
|
Loading…
Reference in New Issue