7863-devToTest_2434 #613

Merged
alexm merged 131 commits from 7863-devToTest_2434 into test 2024-08-13 06:58:13 +00:00
40 changed files with 415 additions and 299 deletions
Showing only changes of commit ed110beda6 - Show all commits

View File

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

View File

@ -1,28 +1,11 @@
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 {
mounted: function () {
const vm = getCurrentInstance();
if (vm.type.name === 'QForm') {
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
// AUTOFOCUS
const elementsArray = Array.from(this.$el.elements);
const availableInputs = elementsArray.filter(filterAvailableInput);
const firstInputElement = availableInputs.find(filterAvailableText);
if (firstInputElement) {
firstInputElement.focus();
}
// TODO: AUTOFOCUS IS NOT FOCUSING
const that = this;
this.$el.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') {

View File

@ -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);

View File

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

View File

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

View File

@ -81,7 +81,7 @@ async function fetchViewConfigData() {
return;
}
} 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);
}
} 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
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 }"

View File

@ -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" />

View File

@ -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);
}
@ -209,27 +215,29 @@ input::-webkit-inner-spin-button {
max-width: 100%;
}
/* ===== Scrollbar CSS ===== /
/ Firefox */
.q-table__container {
/* ===== Scrollbar CSS ===== /
/ Firefox */
* {
scrollbar-width: auto;
scrollbar-color: var(--vn-label-color) transparent;
}
* {
scrollbar-width: auto;
scrollbar-color: var(--vn-label-color) transparent;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
*::-webkit-scrollbar-thumb {
background-color: var(--vn-label-color);
border-radius: 10px;
}
*::-webkit-scrollbar-thumb {
background-color: var(--vn-label-color);
border-radius: 10px;
}
*::-webkit-scrollbar-track {
background: transparent;
*::-webkit-scrollbar-track {
background: transparent;
}
}
.q-table {

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

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

View File

@ -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>

View File

@ -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;
@ -207,8 +197,14 @@ async function cloneInvoice() {
const isAdministrative = () => hasAny(['administrative']);
const isAgricultural = () =>
invoiceIn.value?.supplier?.sageWithholdingFk === config.value[0]?.sageWithholdingFk;
const isAgricultural = () => {
console.error(config);
if (!config.value) return false;
return (
invoiceIn.value?.supplier?.sageFarmerWithholdingFk ===
config?.value[0]?.sageWithholdingFk
);
};
function showPdfInvoice() {
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
@ -374,7 +370,7 @@ const createInvoiceInCorrection = async () => {
</template>
</VnLv>
</template>
<template #action="{ entity }">
<template #actions="{ entity }">
<QCardActions>
<QBtn
size="md"
@ -442,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"
@ -452,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"
@ -460,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"
@ -488,6 +484,9 @@ const createInvoiceInCorrection = async () => {
.q-card {
max-width: 45em;
}
.q-field:nth-child(1) {
padding-bottom: 20px;
}
}
@media (max-width: $breakpoint-xs) {

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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>

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>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
import { onMounted, computed, onUnmounted, reactive, ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@ -17,6 +17,7 @@ import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { date } from 'quasar';
import { useState } from 'src/composables/useState';
import axios from 'axios';
const { t } = useI18n();
const route = useRoute();
@ -33,6 +34,7 @@ const itemsBalanceFilter = reactive({
const itemBalances = ref([]);
const warehouseFk = ref(null);
const _showWhatsBeforeInventory = ref(false);
const inventoriedDate = ref(null);
const columns = computed(() => [
{
@ -98,7 +100,7 @@ const showWhatsBeforeInventory = computed({
set: (val) => {
_showWhatsBeforeInventory.value = val;
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;
};
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 = {
entry: {
descriptor: EntryDescriptorProxy,
icon: 'vn:entry',
color: 'green',
},
ticket: {
descriptor: TicketDescriptorProxy,
icon: 'vn:ticket',
color: 'red',
},
order: {
descriptor: OrderDescriptorProxy,
icon: 'vn:basket',
color: 'yellow',
},
};
@ -142,7 +162,10 @@ onMounted(async () => {
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk;
else if (user.value) warehouseFk.value = user.value.warehouseFk;
itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
const { data } = await axios.get('Configs/findOne');
inventoriedDate.value = data.inventoried;
await fetchItemBalances();
await scrollToToday();
});
onUnmounted(() => (stateStore.rightDrawer = false));
@ -215,7 +238,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd>
</template>
<template #body-cell-date="{ row }">
<QTd @click.stop>
<QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
<QBadge
v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none"
@ -237,12 +260,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
>
{{ row.originId }}
</component>
<QIcon
:name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm"
size="sm"
:color="originTypeMap[row.originType]?.color"
/>
<span class="link">
<QIcon
:name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm"
size="xs"
/>
{{ row.originId }}
</span>
</QTd>
@ -264,7 +288,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
>
{{ row.entityId }}
</component>
<span class="link">
<span :class="{ link: row.entityId }">
{{ dashIfEmpty(row.entityName) }}
</span>
</QBadge>

View File

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

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ const cloneTravelWithEntries = async () => {
notify('globals.dataSaved', 'positive');
router.push({ name: 'TravelBasicData', params: { id: data.id } });
} 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
:id="parseInt(entityId)"
collection="user"
size="160x160"
size="520x520"
class="photo"
>
<template #error>

View File

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

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" />
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 saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
@ -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);
});

View File

@ -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);
});
});

View File

@ -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', () => {

View File

@ -26,6 +26,6 @@ describe('Route', () => {
cy.get(getRowColumn(1, 4) + getVnSelect).type('{downArrow}{enter}');
cy.get(getRowColumn(1, 5) + getVnSelect).type('{downArrow}{enter}');
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', () => {
cy.get('.bg-header > :nth-child(2) > .full-width > :nth-child(1) >').type(
'jessica jones{enter}'
);
cy.get('.q-drawer .q-form input[aria-label="Name"]').type('jessica jones{enter}');
});
});

View File

@ -2,7 +2,7 @@ describe('WorkerLocker', () => {
const workerId = 1109;
const lockerCode = '2F';
const input = '.q-card input';
const firstOpt = '[role="listbox"] .q-item:nth-child(1)';
const thirdOpt = '[role="listbox"] .q-item:nth-child(3)';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('productionBoss');
@ -11,8 +11,8 @@ describe('WorkerLocker', () => {
it('should allocates a locker', () => {
cy.get(input).click();
cy.get(input).type(lockerCode);
cy.get(firstOpt).click();
cy.waitForElement('[role="listbox"]');
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':
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);
});
});
});

View File

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