0
0
Fork 0

Merge branch 'dev' into 6943-customer_migration_subsection

This commit is contained in:
Alex Moreno 2024-07-30 11:33:11 +00:00
commit ed110beda6
40 changed files with 415 additions and 299 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "24.32.0", "version": "24.34.0",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",

View File

@ -1,28 +1,11 @@
import { getCurrentInstance } from 'vue'; import { getCurrentInstance } from 'vue';
const filterAvailableInput = (element) => {
return element.classList.contains('q-field__native') && !element.disabled;
};
const filterAvailableText = (element) => {
return (
element.__vueParentComponent.type.name === 'QInput' &&
element.__vueParentComponent?.attrs?.class !== 'vn-input-date'
);
};
export default { export default {
mounted: function () { mounted: function () {
const vm = getCurrentInstance(); const vm = getCurrentInstance();
if (vm.type.name === 'QForm') { if (vm.type.name === 'QForm') {
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) { if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
// AUTOFOCUS // TODO: AUTOFOCUS IS NOT FOCUSING
const elementsArray = Array.from(this.$el.elements);
const availableInputs = elementsArray.filter(filterAvailableInput);
const firstInputElement = availableInputs.find(filterAvailableText);
if (firstInputElement) {
firstInputElement.focus();
}
const that = this; const that = this;
this.$el.addEventListener('keyup', function (evt) { this.$el.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') { if (evt.key === 'Enter') {

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

@ -15,7 +15,7 @@ const props = defineProps({
default: null, default: null,
}, },
warehouseFk: { warehouseFk: {
type: Boolean, type: Number,
default: null, default: null,
}, },
}); });
@ -23,7 +23,7 @@ const props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const regularizeFormData = reactive({ const regularizeFormData = reactive({
itemFk: props.itemFk, itemFk: Number(props.itemFk),
warehouseFk: props.warehouseFk, warehouseFk: props.warehouseFk,
quantity: null, quantity: null,
}); });
@ -53,6 +53,7 @@ const onDataSaved = (data) => {
<QInput <QInput
:label="t('Type the visible quantity')" :label="t('Type the visible quantity')"
v-model.number="data.quantity" v-model.number="data.quantity"
type="number"
autofocus autofocus
/> />
</VnRow> </VnRow>
@ -60,7 +61,7 @@ const onDataSaved = (data) => {
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('Warehouse')"
v-model="data.warehouseFk" v-model.number="data.warehouseFk"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"

View File

@ -47,7 +47,7 @@ const defaultAttrs = {
}; };
const forceAttrs = { const forceAttrs = {
label: $props.showTitle ? '' : $props.column.label, label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
}; };
const selectComponent = { const selectComponent = {

View File

@ -81,7 +81,7 @@ async function fetchViewConfigData() {
return; return;
} }
} catch (err) { } catch (err) {
console.err('Error fetching config view data', err); console.error('Error fetching config view data', err);
} }
} }

View File

@ -84,7 +84,7 @@ const fetchViewConfigData = async () => {
setUserConfigViewData(defaultColumns); setUserConfigViewData(defaultColumns);
} }
} catch (err) { } catch (err) {
console.err('Error fetching config view data', err); console.error('Error fetching config view data', err);
} }
}; };

View File

@ -199,8 +199,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);
} }
@ -209,6 +215,7 @@ input::-webkit-inner-spin-button {
max-width: 100%; max-width: 100%;
} }
.q-table__container {
/* ===== Scrollbar CSS ===== / /* ===== Scrollbar CSS ===== /
/ Firefox */ / Firefox */
@ -231,6 +238,7 @@ input::-webkit-inner-spin-button {
*::-webkit-scrollbar-track { *::-webkit-scrollbar-track {
background: transparent; background: transparent;
} }
}
.q-table { .q-table {
th, th,

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

@ -1,71 +1,89 @@
<script setup> <script setup>
import { computed, onMounted } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters/index'; import { toDate } from 'src/filters/index';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import EntryBuysTableDialog from './EntryBuysTableDialog.vue'; import EntryBuysTableDialog from './EntryBuysTableDialog.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnInput from 'src/components/common/VnInput.vue';
const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
onMounted(async () => {
stateStore.rightDrawer = true;
});
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'id', name: 'id',
label: t('customer.extendedList.tableVisibleColumns.id'), label: t('customer.extendedList.tableVisibleColumns.id'),
chip: { columnFilter: false,
condition: () => true, isTitle: true,
},
isId: true,
isTitle: false,
}, },
{ {
align: 'left', visible: false,
align: 'right',
label: t('shipped'), label: t('shipped'),
name: 'shipped', name: 'shipped',
isTitle: false, columnFilter: {
create: true, name: 'fromShipped',
cardVisible: true, label: t('fromShipped'),
component: 'date', component: 'date',
columnField: {
component: null,
}, },
format: ({ shipped }) => toDate(shipped), format: ({ shipped }) => toDate(shipped),
}, },
{ {
visible: false,
align: 'left', align: 'left',
label: t('shipped'),
name: 'shipped',
columnFilter: {
name: 'toShipped',
label: t('toShipped'),
component: 'date',
},
format: ({ shipped }) => toDate(shipped),
cardVisible: true,
},
{
align: 'right',
label: t('shipped'),
name: 'shipped',
columnFilter: false,
format: ({ shipped }) => toDate(shipped),
},
{
align: 'right',
label: t('landed'), label: t('landed'),
name: 'landed', name: 'landed',
isTitle: false, columnFilter: false,
create: true,
cardVisible: false,
component: 'date',
columnField: {
component: null,
},
format: ({ landed }) => toDate(landed), format: ({ landed }) => toDate(landed),
}, },
{
align: 'right',
label: t('globals.wareHouseIn'),
name: 'warehouseInFk',
format: (row) => row.warehouseInName,
cardVisible: true,
columnFilter: {
component: 'select',
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
},
alias: 't',
inWhere: true,
},
},
{ {
align: 'left', align: 'left',
label: t('globals.wareHouseIn'), label: t('globals.daysOnward'),
name: 'warehouseInName', name: 'days',
isTitle: false, visible: false,
cardVisible: true,
create: false,
}, },
{ {
align: 'right', align: 'right',
name: 'tableActions', name: 'tableActions',
computed,
actions: [ actions: [
{ {
title: t('printBuys'), title: t('printBuys'),
@ -87,35 +105,19 @@ const printBuys = (rowId) => {
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
data-key="EntryList" data-key="myEntriesList"
url="Entries/filter" url="Entries/filter"
:label="t('Search entries')" :label="t('Search entries')"
:info="t('You can search by entry reference')" :info="t('You can search by entry reference')"
/> />
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnTable <VnTable
ref="myEntriesRef"
data-key="myEntriesList" data-key="myEntriesList"
url="Entries/filter" url="Entries/filter"
:columns="columns" :columns="columns"
default-mode="card" default-mode="card"
order="shipped DESC"
auto-load auto-load
:right-search="true" />
>
<template #moreFilterPanel="{ params }">
<VnInput
:label="t('globals.daysOnward')"
v-model="params.days"
class="q-px-xs row"
dense
filled
outlined
></VnInput>
</template>
</VnTable>
</div>
</QPage>
</template> </template>
<i18n> <i18n>

View File

@ -8,4 +8,6 @@ entryFilter:
reference: Reference reference: Reference
landed: Landed landed: Landed
shipped: Shipped shipped: Shipped
fromShipped: Shipped(from)
toShipped: Shipped(to)
printBuys: Print buys printBuys: Print buys

View File

@ -12,4 +12,6 @@ entryFilter:
landed: F. llegada landed: F. llegada
shipped: F. salida shipped: F. salida
fromShipped: F. salida(desde)
toShipped: F. salida(hasta)
Print buys: Imprimir etiquetas Print buys: Imprimir etiquetas

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;
@ -207,8 +197,14 @@ async function cloneInvoice() {
const isAdministrative = () => hasAny(['administrative']); const isAdministrative = () => hasAny(['administrative']);
const isAgricultural = () => const isAgricultural = () => {
invoiceIn.value?.supplier?.sageWithholdingFk === config.value[0]?.sageWithholdingFk; console.error(config);
if (!config.value) return false;
return (
invoiceIn.value?.supplier?.sageFarmerWithholdingFk ===
config?.value[0]?.sageWithholdingFk
);
};
function showPdfInvoice() { function showPdfInvoice() {
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`); if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
@ -374,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"
@ -442,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"
@ -452,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"
@ -460,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"
@ -488,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

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue'; import { onMounted, computed, onUnmounted, reactive, ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -17,6 +17,7 @@ import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { date } from 'quasar'; import { date } from 'quasar';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -33,6 +34,7 @@ const itemsBalanceFilter = reactive({
const itemBalances = ref([]); const itemBalances = ref([]);
const warehouseFk = ref(null); const warehouseFk = ref(null);
const _showWhatsBeforeInventory = ref(false); const _showWhatsBeforeInventory = ref(false);
const inventoriedDate = ref(null);
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -98,7 +100,7 @@ const showWhatsBeforeInventory = computed({
set: (val) => { set: (val) => {
_showWhatsBeforeInventory.value = val; _showWhatsBeforeInventory.value = val;
if (!val) itemsBalanceFilter.where.date = null; if (!val) itemsBalanceFilter.where.date = null;
else itemsBalanceFilter.where.date = new Date(); else itemsBalanceFilter.where.date = inventoriedDate.value ?? new Date();
}, },
}); });
@ -113,18 +115,36 @@ const getBadgeAttrs = (_date) => {
return attrs; return attrs;
}; };
const scrollToToday = async () => {
await nextTick();
const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`);
if (todayCell) {
todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
};
const formatDateForAttribute = (dateValue) => {
if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD');
return dateValue;
};
const originTypeMap = { const originTypeMap = {
entry: { entry: {
descriptor: EntryDescriptorProxy, descriptor: EntryDescriptorProxy,
icon: 'vn:entry', icon: 'vn:entry',
color: 'green',
}, },
ticket: { ticket: {
descriptor: TicketDescriptorProxy, descriptor: TicketDescriptorProxy,
icon: 'vn:ticket', icon: 'vn:ticket',
color: 'red',
}, },
order: { order: {
descriptor: OrderDescriptorProxy, descriptor: OrderDescriptorProxy,
icon: 'vn:basket', icon: 'vn:basket',
color: 'yellow',
}, },
}; };
@ -142,7 +162,10 @@ onMounted(async () => {
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk; if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk;
else if (user.value) warehouseFk.value = user.value.warehouseFk; else if (user.value) warehouseFk.value = user.value.warehouseFk;
itemsBalanceFilter.where.warehouseFk = warehouseFk.value; itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
const { data } = await axios.get('Configs/findOne');
inventoriedDate.value = data.inventoried;
await fetchItemBalances(); await fetchItemBalances();
await scrollToToday();
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
@ -215,7 +238,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd> </QTd>
</template> </template>
<template #body-cell-date="{ row }"> <template #body-cell-date="{ row }">
<QTd @click.stop> <QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
<QBadge <QBadge
v-bind="getBadgeAttrs(row.shipped)" v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none" class="q-ma-none"
@ -237,12 +260,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
> >
{{ row.originId }} {{ row.originId }}
</component> </component>
<span class="link">
<QIcon <QIcon
:name="originTypeMap[row.originType]?.icon" :name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm" class="fill-icon q-mr-sm"
size="xs" size="sm"
:color="originTypeMap[row.originType]?.color"
/> />
<span class="link">
{{ row.originId }} {{ row.originId }}
</span> </span>
</QTd> </QTd>
@ -264,7 +288,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
> >
{{ row.entityId }} {{ row.entityId }}
</component> </component>
<span class="link"> <span :class="{ link: row.entityId }">
{{ dashIfEmpty(row.entityName) }} {{ dashIfEmpty(row.entityName) }}
</span> </span>
</QBadge> </QBadge>

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

@ -3,6 +3,7 @@ import axios from 'axios';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useSession } from 'src/composables/useSession';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
const props = defineProps({ const props = defineProps({
@ -11,10 +12,20 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const router = useRouter(); const router = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const routeId = props.route.id;
async function openRouteReport() {
const url = new URL(window.location).origin;
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
window.open(
`${url}/api/Routes/${routeId}/driver-route-pdf?access_token=${token}`,
'_blank'
);
}
function confirmRemove() { function confirmRemove() {
quasar quasar
@ -29,20 +40,50 @@ function confirmRemove() {
.onOk(async () => await router.push({ name: 'RouteList' })); .onOk(async () => await router.push({ name: 'RouteList' }));
} }
async function remove() { async function sendMail() {
if (!props.route.id) { const params = {
return; id: routeId,
recipient: props?.route?.worker?.user?.emailUser?.email,
};
await axios.post(`Routes/${routeId}/driver-route-email`, params);
} }
await axios.delete(`Routes/${props.route.id}`);
async function actualizeVolume() {
const params = { isOk: true };
await axios.post(`Routes/${routeId}/updateVolume`, params);
quasar.notify({
message: t('globals.dataUpdated'),
type: 'positive',
});
}
async function remove() {
await axios.delete(`Routes/${routeId}`);
quasar.notify({ quasar.notify({
message: t('globals.dataDeleted'), message: t('globals.dataDeleted'),
type: 'positive', type: 'positive',
}); });
} }
// TODO: Add reports
</script> </script>
<template> <template>
<QItem @click="openRouteReport" v-ripple clickable>
<QItemSection avatar>
<QIcon name="description" />
</QItemSection>
<QItemSection>{{ t('seeReport') }}</QItemSection>
</QItem>
<QItem @click="sendMail" v-ripple clickable>
<QItemSection avatar>
<QIcon name="outgoing_mail" />
</QItemSection>
<QItemSection>{{ t('sendMail') }}</QItemSection>
</QItem>
<QItem @click="actualizeVolume" v-ripple clickable>
<QItemSection avatar>
<QIcon name="package_2" />
</QItemSection>
<QItemSection>{{ t('actualizeVolume') }}</QItemSection>
</QItem>
<QItem @click="confirmRemove" v-ripple clickable> <QItem @click="confirmRemove" v-ripple clickable>
<QItemSection avatar> <QItemSection avatar>
<QIcon name="delete" /> <QIcon name="delete" />
@ -56,8 +97,14 @@ en:
confirmDeletion: Confirm deletion confirmDeletion: Confirm deletion
confirmDeletionMessage: Are you sure you want to delete this route? confirmDeletionMessage: Are you sure you want to delete this route?
deleteRoute: Delete route deleteRoute: Delete route
seeReport: See route report
sendMail: Send route report
actualizeVolume: Actualize volume
es: es:
confirmDeletion: Confirmar eliminación, confirmDeletion: Confirmar eliminación,
confirmDeletionMessage: Seguro que quieres eliminar esta ruta? confirmDeletionMessage: Seguro que quieres eliminar esta ruta?
deleteRoute: Eliminar ruta deleteRoute: Eliminar ruta
seeReport: Ver informe de ruta
sendMail: Enviar informe de ruta
actualizeVolume: Actualizar volumen
</i18n> </i18n>

View File

@ -3,7 +3,7 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { toDate, toDateHourMin } from 'filters/index'; import { toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import axios from 'axios'; import axios from 'axios';

View File

@ -2,8 +2,6 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
@ -15,12 +13,6 @@ const { t } = useI18n();
const workersOptions = ref([]); const workersOptions = ref([]);
</script> </script>
<template> <template>
<FetchData
url="Workers/search"
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC', limit: 30 }"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<FormModel <FormModel
:url="`Suppliers/${route.params.id}`" :url="`Suppliers/${route.params.id}`"
:url-update="`Suppliers/${route.params.id}`" :url-update="`Suppliers/${route.params.id}`"
@ -44,6 +36,8 @@ const workersOptions = ref([]);
option-label="name" option-label="name"
hide-selected hide-selected
map-options map-options
url="Workers/search"
sort-by="nickname ASC"
:rules="validate('supplier.workerFk')" :rules="validate('supplier.workerFk')"
> >
<template #append> <template #append>

View File

@ -38,7 +38,7 @@ const cloneTravelWithEntries = async () => {
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
router.push({ name: 'TravelBasicData', params: { id: data.id } }); router.push({ name: 'TravelBasicData', params: { id: data.id } });
} catch (err) { } catch (err) {
console.err('Error cloning travel with entries'); console.error('Error cloning travel with entries');
} }
}; };

View File

@ -147,7 +147,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
<VnImg <VnImg
:id="parseInt(entityId)" :id="parseInt(entityId)"
collection="user" collection="user"
size="160x160" size="520x520"
class="photo" class="photo"
> >
<template #error> <template #error>

View File

@ -7,7 +7,6 @@ describe('EntryMy when is supplier', () => {
cy.stub(win, 'open'); cy.stub(win, 'open');
}, },
}); });
cy.waitForElement('.q-page', 6000);
}); });
it('should open buyLabel when is supplier', () => { it('should open buyLabel when is supplier', () => {

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInCorrective', () => { describe('InvoiceInCorrective', () => {
const createRectificative = '.q-menu > .q-list > :nth-child(4) > .q-item__section'; const createRectificative = '.q-menu > .q-list > :nth-child(6) > .q-item__section';
const rectificativeSection = '.q-drawer-container .q-list > a:nth-child(6)'; const rectificativeSection = '.q-drawer-container .q-list > a:nth-child(6)';
const saveDialog = '.q-card > .q-card__actions > .q-btn--standard '; const saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
@ -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

@ -26,6 +26,6 @@ describe('Route', () => {
cy.get(getRowColumn(1, 4) + getVnSelect).type('{downArrow}{enter}'); cy.get(getRowColumn(1, 4) + getVnSelect).type('{downArrow}{enter}');
cy.get(getRowColumn(1, 5) + getVnSelect).type('{downArrow}{enter}'); cy.get(getRowColumn(1, 5) + getVnSelect).type('{downArrow}{enter}');
cy.get('button[title="Save"]').click(); cy.get('button[title="Save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });
}); });

View File

@ -6,8 +6,6 @@ describe('WorkerList', () => {
}); });
it('should open the worker summary', () => { it('should open the worker summary', () => {
cy.get('.bg-header > :nth-child(2) > .full-width > :nth-child(1) >').type( cy.get('.q-drawer .q-form input[aria-label="Name"]').type('jessica jones{enter}');
'jessica jones{enter}'
);
}); });
}); });

View File

@ -2,7 +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 firstOpt = '[role="listbox"] .q-item:nth-child(1)'; 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');
@ -11,8 +11,8 @@ 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); cy.waitForElement('[role="listbox"]');
cy.get(firstOpt).click(); cy.get(thirdOpt).click();
cy.saveCard(); cy.saveCard();
cy.get(input).invoke('val').should('eq', lockerCode); 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');