Compare commits

..

12 Commits

Author SHA1 Message Date
Jon Elias 271f4cb0f6 feat: refs #8305 added deliveryNote dms test
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-05-05 14:36:05 +02:00
Jon Elias 4abb17911d feat: refs #8305 added basic data e2e
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-05-05 11:24:39 +02:00
Jon Elias b4ec04ac07 Merge branch 'dev' of https: refs #8305//gitea.verdnatura.es/verdnatura/salix-front into 8305-DeliveryNoteModule
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-05-05 10:05:58 +02:00
Jon Elias 2a6b7b02a2 feat: refs #8305 added list e2e
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-30 14:44:17 +02:00
Jon Elias c37bbfbe75 feat: refs #8305 delivery note log
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-04-30 11:24:28 +02:00
Jon Elias 130a1ac26f Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8305-DeliveryNoteModule 2025-04-30 10:01:54 +02:00
Jon Elias 5fc3eaccbd perf: refs #8305 delivery note list
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-04-29 16:14:19 +02:00
Jon Elias 5e7d574204 feat: refs #8305 created deliveryNote log
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-04-29 16:02:07 +02:00
Jon Elias fcc2760f97 feat: refs #8305 list and filter working, basic data and translations
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-04-29 14:00:30 +02:00
Jon Elias cbdfe7b25c feat: refs #8305 added summary, descriptor and dms
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-04-29 09:48:52 +02:00
Jon Elias 1675f912cd feat: refs #8305 rest of structure
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-04-28 16:43:09 +02:00
Jon Elias b8e9471a80 feat: refs #8305 added front structure and show the list data
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-04-28 16:42:10 +02:00
237 changed files with 2125 additions and 5782 deletions

View File

@ -26,7 +26,7 @@ if (branchName) {
const splitedMsg = msg.split(':'); const splitedMsg = msg.split(':');
if (splitedMsg.length > 1) { if (splitedMsg.length > 1) {
const finalMsg = `${splitedMsg[0]}: ${referenceTag}${splitedMsg.slice(1).join(':')}`; const finalMsg = splitedMsg[0] + ': ' + referenceTag + splitedMsg.slice(1).join(':');
writeFileSync(msgPath, finalMsg); writeFileSync(msgPath, finalMsg);
} }
} }

View File

@ -1,9 +1,6 @@
import { defineConfig } from 'cypress'; import { defineConfig } from 'cypress';
let urlHost; let urlHost, reporter, reporterOptions, timeouts;
let reporter;
let reporterOptions;
let timeouts;
if (process.env.CI) { if (process.env.CI) {
urlHost = 'front'; urlHost = 'front';
@ -64,6 +61,5 @@ export default defineConfig({
...timeouts, ...timeouts,
includeShadowDom: true, includeShadowDom: true,
waitForAnimations: true, waitForAnimations: true,
testIsolation: false,
}, },
}); });

View File

@ -1,4 +1,4 @@
<!doctype html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><%= productName %></title> <title><%= productName %></title>
@ -12,12 +12,7 @@
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>"
/> />
<link <link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png" />
rel="icon"
type="image/png"
sizes="128x128"
href="icons/favicon-128x128.png"
/>
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png" /> <link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png" /> <link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png" />

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// https://github.com/michael-ciniawsky/postcss-load-config // https://github.com/michael-ciniawsky/postcss-load-config
import autoprefixer from 'autoprefixer'; import autoprefixer from 'autoprefixer';

View File

@ -13,7 +13,7 @@ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import path from 'path'; import path from 'path';
const target = `http://${process.env.CI ? 'back' : 'localhost'}:3000`; const target = `http://${process.env.CI ? 'back' : 'localhost'}:3000`;
export default configure((/* ctx */) => { export default configure(function (/* ctx */) {
return { return {
eslint: { eslint: {
// fix: true, // fix: true,

View File

@ -1,6 +1,8 @@
{ {
"@quasar/testing-unit-vitest": { "@quasar/testing-unit-vitest": {
"options": ["scripts"] "options": [
"scripts"
]
}, },
"@quasar/qcalendar": {} "@quasar/qcalendar": {}
} }

View File

@ -1,5 +1,5 @@
{ {
"unit-vitest": { "unit-vitest": {
"runnerCommand": "vitest run" "runnerCommand": "vitest run"
} }
} }

View File

@ -39,7 +39,7 @@ quasar.iconMapFn = (iconName) => {
<template> <template>
<RouterView /> <RouterView />
<VnScroll /> <VnScroll/>
</template> </template>
<style lang="scss"> <style lang="scss">

View File

@ -11,8 +11,8 @@ export default function (component, key, value) {
}; };
break; break;
case 'undefined': case 'undefined':
throw new Error(`unknown prop: ${key}`); throw new Error('unknown prop: ' + key);
default: default:
throw new Error(`unhandled type: ${typeof prop}`); throw new Error('unhandled type: ' + typeof prop);
} }
} }

View File

@ -9,7 +9,7 @@ export default {
const keyBindingMap = routes const keyBindingMap = routes
.filter((route) => route.meta.keyBinding) .filter((route) => route.meta.keyBinding)
.reduce((map, route) => { .reduce((map, route) => {
map[`Key${route.meta.keyBinding.toUpperCase()}`] = route.path; map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
return map; return map;
}, {}); }, {});

View File

@ -1,3 +1,4 @@
/* eslint-disable eslint/export */
export * from './defaults/qTable'; export * from './defaults/qTable';
export * from './defaults/qInput'; export * from './defaults/qInput';
export * from './defaults/qSelect'; export * from './defaults/qSelect';

View File

@ -24,9 +24,12 @@ export default boot(({ app }) => {
switch (response?.status) { switch (response?.status) {
case 422: case 422:
if (error.name == 'ValidationError') if (error.name == 'ValidationError')
message += ` "${responseError.details.context}.${Object.keys( message +=
responseError.details.codes, ' "' +
).join(',')}"`; responseError.details.context +
'.' +
Object.keys(responseError.details.codes).join(',') +
'"';
break; break;
case 500: case 500:
message = 'errors.statusInternalServerError'; message = 'errors.statusInternalServerError';

View File

@ -25,7 +25,7 @@ const autonomiesRef = ref([]);
const onDataSaved = (dataSaved, requestResponse) => { const onDataSaved = (dataSaved, requestResponse) => {
requestResponse.autonomy = autonomiesRef.value.opts.find( requestResponse.autonomy = autonomiesRef.value.opts.find(
(autonomy) => autonomy.id == requestResponse.autonomyFk, (autonomy) => autonomy.id == requestResponse.autonomyFk
); );
emit('onDataSaved', dataSaved, requestResponse); emit('onDataSaved', dataSaved, requestResponse);
}; };

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { computed, ref, useAttrs, watch, nextTick } from 'vue'; import { computed, ref, useAttrs, watch } from 'vue';
import { useRouter, onBeforeRouteLeave } 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';
@ -42,15 +42,7 @@ const $props = defineProps({
}, },
dataRequired: { dataRequired: {
type: Object, type: Object,
default: () => ({}), default: () => {},
},
dataDefault: {
type: Object,
default: () => ({}),
},
insertOnLoad: {
type: Boolean,
default: false,
}, },
defaultSave: { defaultSave: {
type: Boolean, type: Boolean,
@ -95,7 +87,6 @@ const formData = ref();
const saveButtonRef = ref(null); const saveButtonRef = ref(null);
const watchChanges = ref(); const watchChanges = ref();
const formUrl = computed(() => $props.url); const formUrl = computed(() => $props.url);
const rowsContainer = ref(null);
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
@ -131,11 +122,9 @@ async function fetch(data) {
const rows = keyData ? data[keyData] : data; const rows = keyData ? data[keyData] : data;
resetData(rows); resetData(rows);
emit('onFetch', rows); emit('onFetch', rows);
$props.insertOnLoad && await insert();
return rows; return rows;
} }
function resetData(data) { function resetData(data) {
if (!data) return; if (!data) return;
if (data && Array.isArray(data)) { if (data && Array.isArray(data)) {
@ -146,16 +135,9 @@ function resetData(data) {
formData.value = JSON.parse(JSON.stringify(data)); formData.value = JSON.parse(JSON.stringify(data));
if (watchChanges.value) watchChanges.value(); //destroy watcher if (watchChanges.value) watchChanges.value(); //destroy watcher
watchChanges.value = watch(formData, (nVal) => { watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true });
hasChanges.value = false;
const filteredNewData = nVal.filter(row => !isRowEmpty(row) || row[$props.primaryKey]);
const filteredOriginal = originalData.value.filter(row => row[$props.primaryKey]);
const changes = getDifferences(filteredOriginal, filteredNewData);
hasChanges.value = !isEmpty(changes);
}, { deep: true });
} }
async function reset() { async function reset() {
await fetch(originalData.value); await fetch(originalData.value);
hasChanges.value = false; hasChanges.value = false;
@ -183,9 +165,7 @@ async function onSubmit() {
}); });
} }
isLoading.value = true; isLoading.value = true;
await saveChanges($props.saveFn ? formData.value : null); await saveChanges($props.saveFn ? formData.value : null);
} }
async function onSubmitAndGo() { async function onSubmitAndGo() {
@ -194,10 +174,6 @@ async function onSubmitAndGo() {
} }
async function saveChanges(data) { async function saveChanges(data) {
formData.value = formData.value.filter(row =>
row[$props.primaryKey] || !isRowEmpty(row)
);
if ($props.saveFn) { if ($props.saveFn) {
$props.saveFn(data, getChanges); $props.saveFn(data, getChanges);
isLoading.value = false; isLoading.value = false;
@ -227,32 +203,14 @@ async function saveChanges(data) {
}); });
} }
async function insert(pushData = { ...$props.dataRequired, ...$props.dataDefault }) { async function insert(pushData = $props.dataRequired) {
formData.value = formData.value.filter(row => !isRowEmpty(row)); const $index = formData.value.length
? formData.value[formData.value.length - 1].$index + 1
const lastRow = formData.value.at(-1); : 0;
const isLastRowEmpty = lastRow ? isRowEmpty(lastRow) : false; formData.value.push(Object.assign({ $index }, pushData));
hasChanges.value = true;
if (formData.value.length && isLastRowEmpty) return;
const $index = formData.value.length ? formData.value.at(-1).$index + 1 : 0;
const nRow = Object.assign({ $index }, pushData);
formData.value.push(nRow);
const hasChange = Object.keys(nRow).some(key => !isChange(nRow, key));
if (hasChange) hasChanges.value = true;
} }
function isRowEmpty(row) {
return Object.keys(row).every(key => isChange(row, key));
}
function isChange(row,key){
return !row[key] || key == '$index' || Object.hasOwn($props.dataRequired || {}, key);
}
async function remove(data) { async function remove(data) {
if (!data.length) if (!data.length)
return quasar.notify({ return quasar.notify({
@ -269,8 +227,10 @@ async function remove(data) {
newData = newData.filter( newData = newData.filter(
(form) => !preRemove.some((index) => index == form.$index), (form) => !preRemove.some((index) => index == form.$index),
); );
formData.value = newData; const changes = getChanges();
hasChanges.value = JSON.stringify(removeIndexField(formData.value)) !== JSON.stringify(removeIndexField(originalData.value)); if (!changes.creates?.length && !changes.updates?.length)
hasChanges.value = false;
fetch(newData);
} }
if (ids.length) { if (ids.length) {
quasar quasar
@ -288,8 +248,9 @@ async function remove(data) {
newData = newData.filter((form) => !ids.some((id) => id == form[pk])); newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
fetch(newData); fetch(newData);
}); });
} else {
reset();
} }
emit('update:selected', []); emit('update:selected', []);
} }
@ -300,7 +261,7 @@ function getChanges() {
const pk = $props.primaryKey; const pk = $props.primaryKey;
for (const [i, row] of formData.value.entries()) { for (const [i, row] of formData.value.entries()) {
if (!row[pk]) { if (!row[pk]) {
creates.push(Object.assign(row, { ...$props.dataRequired })); creates.push(row);
} else if (originalData.value[i]) { } else if (originalData.value[i]) {
const data = getDifferences(originalData.value[i], row); const data = getDifferences(originalData.value[i], row);
if (!isEmpty(data)) { if (!isEmpty(data)) {
@ -326,33 +287,6 @@ function isEmpty(obj) {
return !Object.keys(obj).length; return !Object.keys(obj).length;
} }
function removeIndexField(data) {
if (Array.isArray(data)) {
return data.map(({ $index, ...rest }) => rest);
} else if (typeof data === 'object' && data !== null) {
const { $index, ...rest } = data;
return rest;
}
}
async function handleTab(event) {
event.preventDefault();
const { shiftKey, target } = event;
const focusableSelector = `tbody tr td:not(:first-child) :is(a, button, input, textarea, select, details):not([disabled])`;
const focusableElements = rowsContainer.value?.querySelectorAll(focusableSelector);
const currentIndex = Array.prototype.indexOf.call(focusableElements, target);
const index = shiftKey ? currentIndex - 1 : currentIndex + 1;
const isLast = target === focusableElements[focusableElements.length - 1];
const isFirst = currentIndex === 0;
if ((shiftKey && !isFirst) || (!shiftKey && !isLast))
focusableElements[index]?.focus();
else if (isLast) {
await insert();
await nextTick();
}
}
async function reload(params) { async function reload(params) {
const data = await vnPaginateRef.value.fetch(params); const data = await vnPaginateRef.value.fetch(params);
fetch(data); fetch(data);
@ -378,14 +312,12 @@ watch(formUrl, async () => {
v-bind="$attrs" v-bind="$attrs"
> >
<template #body v-if="formData"> <template #body v-if="formData">
<div ref="rowsContainer" @keydown.tab="handleTab"> <slot
<slot name="body"
name="body" :rows="formData"
:rows="formData" :validate="validate"
:validate="validate" :filter="filter"
:filter="filter" ></slot>
></slot>
</div>
</template> </template>
</VnPaginate> </VnPaginate>
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar"> <Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar">
@ -415,16 +347,8 @@ watch(formUrl, async () => {
<QBtnDropdown <QBtnDropdown
v-if="$props.goTo && $props.defaultSave" v-if="$props.goTo && $props.defaultSave"
@click="onSubmitAndGo" @click="onSubmitAndGo"
:label=" :label="tMobile('globals.saveAndContinue')"
tMobile('globals.saveAndContinue') + :title="t('globals.saveAndContinue')"
' ' +
t('globals.' + $props.goTo.split('/').pop())
"
:title="
t('globals.saveAndContinue') +
' ' +
t('globals.' + $props.goTo.split('/').pop())
"
:disable="!hasChanges" :disable="!hasChanges"
color="primary" color="primary"
icon="save" icon="save"

View File

@ -8,8 +8,10 @@ import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
import { useWeekdayStore } from 'src/stores/useWeekdayStore'; import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import useWeekdaysOrder from 'src/composables/getWeekdays'; import useWeekdaysOrder from 'src/composables/getWeekdays';
const formatDate = (dateToFormat, format = 'YYYY-MM-DD') => const formatDate = (dateToFormat, format = 'YYYY-MM-DD') => (
date.formatDate(dateToFormat, format); date.formatDate(dateToFormat, format)
);
const props = defineProps({ const props = defineProps({
year: { year: {
@ -65,7 +67,7 @@ const handleDateClick = (timestamp) => {
emit('onDateSelected', { emit('onDateSelected', {
date, date,
isNewMode: !event, isNewMode: !event,
event: event?.[0] || null, event: event?.[0] || null
}); });
}; };
@ -105,11 +107,7 @@ defineExpose({ getEventByTimestamp, handleDateClick });
mini-mode mini-mode
> >
<template #day="{ scope: { timestamp } }"> <template #day="{ scope: { timestamp } }">
<slot <slot name="day" :timestamp="timestamp" :getEventAttrs="getEventAttrs">
name="day"
:timestamp="timestamp"
:getEventAttrs="getEventAttrs"
>
<QBtn <QBtn
v-if="getEventByTimestamp(timestamp)" v-if="getEventByTimestamp(timestamp)"
v-bind="{ ...getEventAttrs(timestamp) }" v-bind="{ ...getEventAttrs(timestamp) }"

View File

@ -5,18 +5,18 @@ import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
const props = defineProps({ const props = defineProps({
dataKey: { dataKey: {
type: String, type: String,
required: true, required: true,
}, },
calendarComponent: { calendarComponent: {
type: Object, type: Object,
required: true, required: true,
}, },
additionalProps: { additionalProps: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, }
}); });
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -28,99 +28,99 @@ const lastDay = ref(Date.vnNew());
const months = ref([]); const months = ref([]);
const arrayData = useArrayData(props.dataKey); const arrayData = useArrayData(props.dataKey);
onMounted(async () => { onMounted(async () => {
const initialDate = Date.vnNew(); const initialDate = Date.vnNew();
initialDate.setDate(1); initialDate.setDate(1);
initialDate.setHours(0, 0, 0, 0); initialDate.setHours(0, 0, 0, 0);
date.value = initialDate; date.value = initialDate;
await nextTick(); await nextTick();
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
onUnmounted(() => arrayData.destroy()); onUnmounted(() => arrayData.destroy());
const emit = defineEmits([ const emit = defineEmits([
'update:firstDay', 'update:firstDay',
'update:lastDay', 'update:lastDay',
'update:events', 'update:events',
'onDateSelected', 'onDateSelected',
]); ]);
const date = computed({ const date = computed({
get: () => _date.value, get: () => _date.value,
set: (value) => { set: (value) => {
if (!(value instanceof Date)) return; if (!(value instanceof Date)) return;
_date.value = value; _date.value = value;
const stamp = value.getTime(); const stamp = value.getTime();
firstDay.value = new Date(stamp); firstDay.value = new Date(stamp);
firstDay.value.setDate(1); firstDay.value.setDate(1);
lastDay.value = new Date(stamp); lastDay.value = new Date(stamp);
lastDay.value.setMonth(lastDay.value.getMonth() + nMonths.value); lastDay.value.setMonth(lastDay.value.getMonth() + nMonths.value);
lastDay.value.setDate(0); lastDay.value.setDate(0);
months.value = []; months.value = [];
for (let i = 0; i < nMonths.value; i++) { for (let i = 0; i < nMonths.value; i++) {
const monthDate = new Date(stamp); const monthDate = new Date(stamp);
monthDate.setMonth(value.getMonth() + i); monthDate.setMonth(value.getMonth() + i);
months.value.push(monthDate); months.value.push(monthDate);
} }
emit('update:firstDay', firstDay.value); emit('update:firstDay', firstDay.value);
emit('update:lastDay', lastDay.value); emit('update:lastDay', lastDay.value);
emit('refresh-events'); emit('refresh-events');
}, },
}); });
const headerTitle = computed(() => { const headerTitle = computed(() => {
if (!months.value?.length) return ''; if (!months.value?.length) return '';
const getMonthName = (date) => const getMonthName = date =>
`${weekdayStore.getLocaleMonths[date.getMonth()].locale} ${date.getFullYear()}`; `${weekdayStore.getLocaleMonths[date.getMonth()].locale} ${date.getFullYear()}`;
return `${getMonthName(months.value[0])} - ${getMonthName(months.value[months.value.length - 1])}`; return `${getMonthName(months.value[0])} - ${getMonthName(months.value[months.value.length - 1])}`;
}); });
const step = (direction) => { const step = (direction) => {
const newDate = new Date(date.value); const newDate = new Date(date.value);
newDate.setMonth(newDate.getMonth() + nMonths.value * direction); newDate.setMonth(newDate.getMonth() + nMonths.value * direction);
date.value = newDate; date.value = newDate;
}; };
defineExpose({ defineExpose({
firstDay, firstDay,
lastDay, lastDay
}); });
</script> </script>
<template> <template>
<QCard style="height: max-content"> <QCard style="height: max-content">
<div class="calendars-header"> <div class="calendars-header">
<QBtn <QBtn
icon="arrow_left" icon="arrow_left"
size="sm" size="sm"
flat flat
class="full-height" class="full-height"
@click="step(-1)" @click="step(-1)"
/> />
<span>{{ headerTitle }}</span> <span>{{ headerTitle }}</span>
<QBtn <QBtn
icon="arrow_right" icon="arrow_right"
size="sm" size="sm"
flat flat
class="full-height" class="full-height"
@click="step(1)" @click="step(1)"
/> />
</div> </div>
<div class="calendars-container"> <div class="calendars-container">
<component <component
:is="calendarComponent" :is="calendarComponent"
v-for="(month, index) in months" v-for="(month, index) in months"
:key="index" :key="index"
:month="month.getMonth() + 1" :month="month.getMonth() + 1"
:year="month.getFullYear()" :year="month.getFullYear()"
:month-date="month" :month-date="month"
v-bind="additionalProps" v-bind="additionalProps"
@on-date-selected="(data) => emit('onDateSelected', data)" @on-date-selected="data => emit('onDateSelected', data)"
/> />
</div> </div>
</QCard> </QCard>
</template> </template>

View File

@ -380,16 +380,8 @@ defineExpose({
data-cy="saveAndContinueDefaultBtn" data-cy="saveAndContinueDefaultBtn"
v-if="$props.goTo" v-if="$props.goTo"
@click="saveAndGo" @click="saveAndGo"
:label=" :label="tMobile('globals.saveAndContinue')"
tMobile('globals.saveAndContinue') + :title="t('globals.saveAndContinue')"
' ' +
t('globals.' + $props.goTo.split('/').pop())
"
:title="
t('globals.saveAndContinue') +
' ' +
t('globals.' + $props.goTo.split('/').pop())
"
:disable="!hasChanges" :disable="!hasChanges"
color="primary" color="primary"
icon="save" icon="save"

View File

@ -26,7 +26,7 @@ async function redirect() {
if (route?.params?.id) if (route?.params?.id)
return (window.location.href = await getUrl( return (window.location.href = await getUrl(
`${section}/${route.params.id}/summary`, `${section}/${route.params.id}/summary`
)); ));
return (window.location.href = await getUrl(section + '/index')); return (window.location.href = await getUrl(section + '/index'));
} }

View File

@ -55,7 +55,7 @@ const refund = async () => {
(data) => ( (data) => (
(rectificativeTypeOptions = data), (rectificativeTypeOptions = data),
(invoiceParams.cplusRectificationTypeFk = data.filter( (invoiceParams.cplusRectificationTypeFk = data.filter(
(type) => type.description == 'I Por diferencias', (type) => type.description == 'I Por diferencias'
)[0].id) )[0].id)
) )
" "
@ -68,7 +68,7 @@ const refund = async () => {
(data) => ( (data) => (
(siiTypeInvoiceOutsOptions = data), (siiTypeInvoiceOutsOptions = data),
(invoiceParams.siiTypeInvoiceOutFk = data.filter( (invoiceParams.siiTypeInvoiceOutFk = data.filter(
(type) => type.code == 'R4', (type) => type.code == 'R4'
)[0].id) )[0].id)
) )
" "

View File

@ -52,7 +52,7 @@ watch(
} else filter.value.where = {}; } else filter.value.where = {};
await provincesFetchDataRef.value.fetch({}); await provincesFetchDataRef.value.fetch({});
emit('onProvinceFetched', provincesOptions.value); emit('onProvinceFetched', provincesOptions.value);
}, }
); );
</script> </script>

View File

@ -35,7 +35,6 @@ import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue'; import RightMenu from '../common/RightMenu.vue';
import VnScroll from '../common/VnScroll.vue'; import VnScroll from '../common/VnScroll.vue';
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue'; import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
import VnCheckbox from '../common/VnCheckbox.vue';
const arrayData = useArrayData(useAttrs()['data-key']); const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({ const $props = defineProps({
@ -333,7 +332,6 @@ function stopEventPropagation(event) {
function reload(params) { function reload(params) {
selected.value = []; selected.value = [];
selectAll.value = false;
CrudModelRef.value.reload(params); CrudModelRef.value.reload(params);
} }
@ -647,7 +645,7 @@ const rowCtrlClickFunction = computed(() => {
return () => {}; return () => {};
}); });
const handleHeaderSelection = (evt, data) => { const handleHeaderSelection = (evt, data) => {
if (evt === 'updateSelected' && selectAll.value) { if (evt === 'selected' && data) {
selected.value = tableRef.value.rows; selected.value = tableRef.value.rows;
} else if (evt === 'selectAll') { } else if (evt === 'selectAll') {
selected.value = data; selected.value = data;
@ -682,15 +680,7 @@ const handleHeaderSelection = (evt, data) => {
:class="$attrs['class'] ?? 'q-px-md'" :class="$attrs['class'] ?? 'q-px-md'"
:limit="$attrs['limit'] ?? 100" :limit="$attrs['limit'] ?? 100"
ref="CrudModelRef" ref="CrudModelRef"
@on-fetch=" @on-fetch="(...args) => emit('onFetch', ...args)"
(...args) => {
if ($props.multiCheck.expand) {
selectAll = false;
selected = [];
}
emit('onFetch', ...args);
}
"
:search-url="searchUrl" :search-url="searchUrl"
:disable-infinite-scroll="isTableMode" :disable-infinite-scroll="isTableMode"
:before-save-fn="removeTextValue" :before-save-fn="removeTextValue"
@ -728,23 +718,14 @@ const handleHeaderSelection = (evt, data) => {
:data-cy :data-cy
> >
<template #header-selection> <template #header-selection>
<div class="flex items-center no-wrap" style="display: flex"> <VnCheckboxMenu
<VnCheckbox :searchUrl="searchUrl"
v-model="selectAll" :expand="$props.multiCheck.expand"
@click="handleHeaderSelection('updateSelected', $event)" v-model="selectAll"
/> :url="$attrs['url']"
@update:selected="handleHeaderSelection('selected', $event)"
<VnCheckboxMenu @select:all="handleHeaderSelection('selectAll', $event)"
v-if="selectAll && $props.multiCheck.expand" />
:searchUrl="searchUrl"
v-model="selectAll"
:url="$attrs['url']"
@update:selected="
handleHeaderSelection('updateSelected', $event)
"
@select:all="handleHeaderSelection('selectAll', $event)"
/>
</div>
</template> </template>
<template #top-left v-if="!$props.withoutHeader"> <template #top-left v-if="!$props.withoutHeader">

View File

@ -6,7 +6,7 @@ export default function (initialFooter, data) {
}); });
return acc; return acc;
}, },
{ ...initialFooter }, { ...initialFooter }
); );
return footer; return footer;
} }

View File

@ -193,11 +193,11 @@ describe('CrudModel', () => {
}); });
it('should set originalData and formatData with data and generate watchChanges', async () => { it('should set originalData and formatData with data and generate watchChanges', async () => {
data = [{ data = {
name: 'Tony', name: 'Tony',
lastName: 'Stark', lastName: 'Stark',
age: 42, age: 42,
}]; };
vm.resetData(data); vm.resetData(data);
@ -241,7 +241,7 @@ describe('CrudModel', () => {
await vm.saveChanges(data); await vm.saveChanges(data);
expect(postMock).toHaveBeenCalledWith(`${vm.url}/crud`, data); expect(postMock).toHaveBeenCalledWith(vm.url + '/crud', data);
expect(vm.isLoading).toBe(false); expect(vm.isLoading).toBe(false);
expect(vm.hasChanges).toBe(false); expect(vm.hasChanges).toBe(false);
expect(vm.originalData).toEqual(JSON.parse(JSON.stringify(vm.formData))); expect(vm.originalData).toEqual(JSON.parse(JSON.stringify(vm.formData)));

View File

@ -142,14 +142,14 @@ describe('getRoutes', () => {
const fn = (props) => getRoutes(props, getMethodA, getMethodB); const fn = (props) => getRoutes(props, getMethodA, getMethodB);
it('should call getMethodB when source is card', () => { it('should call getMethodB when source is card', () => {
const props = { source: 'methodB' }; let props = { source: 'methodB' };
fn(props); fn(props);
expect(getMethodB).toHaveBeenCalled(); expect(getMethodB).toHaveBeenCalled();
expect(getMethodA).not.toHaveBeenCalled(); expect(getMethodA).not.toHaveBeenCalled();
}); });
it('should call getMethodA when source is main', () => { it('should call getMethodA when source is main', () => {
const props = { source: 'methodA' }; let props = { source: 'methodA' };
fn(props); fn(props);
expect(getMethodA).toHaveBeenCalled(); expect(getMethodA).toHaveBeenCalled();
@ -157,7 +157,7 @@ describe('getRoutes', () => {
}); });
it('should call getMethodA when source is not exists or undefined', () => { it('should call getMethodA when source is not exists or undefined', () => {
const props = { source: 'methodC' }; let props = { source: 'methodC' };
expect(() => fn(props)).toThrowError('Method not defined'); expect(() => fn(props)).toThrowError('Method not defined');
expect(getMethodA).not.toHaveBeenCalled(); expect(getMethodA).not.toHaveBeenCalled();

View File

@ -72,7 +72,7 @@ const getBankEntities = (data) => {
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]" :acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:options="bankEntities" :options="bankEntities"
hide-selected hide-selected
option-label="bic" option-label="name"
option-value="id" option-value="id"
v-model="bankEntityFk" v-model="bankEntityFk"
@update:model-value="$emit('updateBic', { iban, bankEntityFk })" @update:model-value="$emit('updateBic', { iban, bankEntityFk })"

View File

@ -15,7 +15,7 @@ let root = ref(null);
watchEffect(() => { watchEffect(() => {
matched.value = currentRoute.value.matched.filter( matched.value = currentRoute.value.matched.filter(
(matched) => !!matched?.meta?.title || !!matched?.meta?.icon, (matched) => !!matched?.meta?.title || !!matched?.meta?.icon
); );
breadcrumbs.value.length = 0; breadcrumbs.value.length = 0;
if (!matched.value[0]) return; if (!matched.value[0]) return;

View File

@ -9,6 +9,10 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const model = defineModel({ type: [Boolean] }); const model = defineModel({ type: [Boolean] });
const props = defineProps({ const props = defineProps({
expand: {
type: Boolean,
default: false,
},
url: { url: {
type: String, type: String,
required: true, required: true,
@ -18,26 +22,29 @@ const props = defineProps({
default: 'table', default: 'table',
}, },
}); });
const value = ref(false);
const menuRef = ref(null); const menuRef = ref(null);
const errorMessage = ref(null); const errorMessage = ref(null);
const rows = ref(0); const rows = ref(0);
const onClick = async () => { const onClick = async () => {
errorMessage.value = null; errorMessage.value = null;
const { filter } = JSON.parse(route.query[props.searchUrl]); if (value.value) {
filter.limit = 0; const { filter } = JSON.parse(route.query[props.searchUrl]);
const params = { filter.limit = 0;
params: { filter: JSON.stringify(filter) }, const params = {
}; params: { filter: JSON.stringify(filter) },
try { };
const { data } = await axios.get(props.url, params); try {
rows.value = data; const { data } = await axios.get(props.url, params);
} catch (error) { rows.value = data;
const response = error.response; } catch (error) {
if (response.data.error.name === 'UserError') { const response = error.response;
errorMessage.value = t('tooManyResults'); if (response.data.error.name === 'UserError') {
} else { errorMessage.value = t('tooManyResults');
errorMessage.value = response.data.error.message; } else {
errorMessage.value = response.data.error.message;
}
} }
} }
}; };
@ -45,53 +52,57 @@ defineEmits(['update:selected', 'select:all']);
</script> </script>
<template> <template>
<QIcon <div class="flex items-center no-wrap" style="display: flex">
style="margin-left: -10px" <VnCheckbox v-model="value" @click="$emit('update:selected', value)" />
data-cy="btnMultiCheck" <QIcon
name="expand_more" style="margin-left: -10px"
@click="onClick" data-cy="btnMultiCheck"
class="cursor-pointer" v-if="value && $props.expand"
color="primary" name="expand_more"
size="xs" @click="onClick"
> class="cursor-pointer"
<QMenu color="primary"
fit size="xs"
anchor="bottom start"
self="top left"
ref="menuRef"
data-cy="menuMultiCheck"
> >
<QList separator> <QMenu
<QItem fit
data-cy="selectAll" anchor="bottom start"
v-ripple self="top left"
clickable ref="menuRef"
@click=" data-cy="menuMultiCheck"
$refs.menuRef.hide(); >
$emit('select:all', toRaw(rows)); <QList separator>
" <QItem
> data-cy="selectAll"
<QItemSection> v-ripple
<QItemLabel> clickable
<span v-text="t('Select all')" /> @click="
</QItemLabel> $refs.menuRef.hide();
<QItemLabel overline caption> $emit('select:all', toRaw(rows));
<span "
v-if="errorMessage" >
class="text-negative" <QItemSection>
v-text="errorMessage" <QItemLabel>
/> <span v-text="t('Select all')" />
<span </QItemLabel>
v-else <QItemLabel overline caption>
v-text="t('records', { rows: rows?.length ?? 0 })" <span
/> v-if="errorMessage"
</QItemLabel> class="text-negative"
</QItemSection> v-text="errorMessage"
</QItem> />
<slot name="more-options"></slot> <span
</QList> v-else
</QMenu> v-text="t('records', { rows: rows.length })"
</QIcon> />
</QItemLabel>
</QItemSection>
</QItem>
<slot name="more-options"></slot>
</QList>
</QMenu>
</QIcon>
</div>
</template> </template>
<i18n lang="yml"> <i18n lang="yml">
en: en:

View File

@ -21,7 +21,7 @@ watch(
(newValue) => { (newValue) => {
if (!modelValue.value) return; if (!modelValue.value) return;
modelValue.value = formatLocation(newValue) ?? null; modelValue.value = formatLocation(newValue) ?? null;
}, }
); );
const mixinRules = [requiredFieldRule]; const mixinRules = [requiredFieldRule];
@ -45,7 +45,7 @@ const formatLocation = (obj, properties = locationProperties) => {
}); });
const filteredParts = parts.filter( const filteredParts = parts.filter(
(part) => part !== null && part !== undefined && part !== '', (part) => part !== null && part !== undefined && part !== ''
); );
return filteredParts.join(', '); return filteredParts.join(', ');

View File

@ -2,7 +2,7 @@
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue'; import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue';
const props = defineProps({ const props = defineProps({
scrollTarget: { type: [String, Object], default: 'window' }, scrollTarget: { type: [String, Object], default: 'window' }
}); });
const scrollPosition = ref(0); const scrollPosition = ref(0);
@ -28,18 +28,18 @@ const scrollToTop = () => {
}; };
const updateScrollContainer = (container) => { const updateScrollContainer = (container) => {
if (container) { if (container) {
if (scrollContainer) { if (scrollContainer) {
scrollContainer.removeEventListener('scroll', onScroll); scrollContainer.removeEventListener('scroll', onScroll);
}
scrollContainer = container;
scrollContainer.addEventListener('scroll', onScroll);
onScroll();
} }
scrollContainer = container;
scrollContainer.addEventListener('scroll', onScroll);
onScroll();
}
}; };
defineExpose({ defineExpose({
updateScrollContainer, updateScrollContainer
}); });
const initScrollContainer = async () => { const initScrollContainer = async () => {
@ -51,10 +51,11 @@ const initScrollContainer = async () => {
scrollContainer = window; scrollContainer = window;
} }
if (!scrollContainer) return; if (!scrollContainer) return
scrollContainer.addEventListener('scroll', onScroll); scrollContainer.addEventListener('scroll', onScroll);
}; };
onMounted(() => { onMounted(() => {
initScrollContainer(); initScrollContainer();
}); });
@ -81,18 +82,19 @@ onUnmounted(() => {
<style scoped> <style scoped>
.scroll-to-top { .scroll-to-top {
position: fixed; position: fixed;
top: 70px; top: 70px;
font-size: 65px; font-size: 65px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 1000; z-index: 1000;
transition: transform 0.2s ease-in-out; transition: transform 0.2s ease-in-out;
} }
.scroll-to-top:hover { .scroll-to-top:hover {
transform: translateX(-50%) scale(1.2); transform: translateX(-50%) scale(1.2);
cursor: pointer; cursor: pointer;
filter: brightness(0.8); filter: brightness(0.8);
} }
</style> </style>

View File

@ -40,11 +40,4 @@ describe('VnBankDetail Component', () => {
await vm.autofillBic('ES1234567891324567891234'); await vm.autofillBic('ES1234567891324567891234');
expect(vm.bankEntityFk).toBe(null); expect(vm.bankEntityFk).toBe(null);
}); });
it('should not update bankEntityFk if IBAN country is not ES', async () => {
vm.bankEntities = bankEntities;
await vm.autofillBic('FR1420041010050500013M02606');
expect(vm.bankEntityFk).toBe(null);
});
}); });

View File

@ -35,7 +35,7 @@ describe('VnSmsDialog', () => {
expect.objectContaining({ expect.objectContaining({
message: 'You must enter a new password', message: 'You must enter a new password',
type: 'negative', type: 'negative',
}), })
); );
}); });
@ -47,7 +47,7 @@ describe('VnSmsDialog', () => {
expect.objectContaining({ expect.objectContaining({
message: `Passwords don't match`, message: `Passwords don't match`,
type: 'negative', type: 'negative',
}), })
); );
}); });

View File

@ -25,9 +25,6 @@ describe('VnDmsList', () => {
deleteModel: 'WorkerDms', deleteModel: 'WorkerDms',
downloadModel: 'WorkerDms', downloadModel: 'WorkerDms',
}, },
global: {
stubs: ['VnUserLink'],
},
}).vm; }).vm;
}); });

View File

@ -6,8 +6,8 @@ function buildComponent(data) {
return createWrapper(VnLocation, { return createWrapper(VnLocation, {
global: { global: {
props: { props: {
location: data, location: data
}, }
}, },
}).vm; }).vm;
} }
@ -24,7 +24,7 @@ describe('formatLocation', () => {
postcode: '46680', postcode: '46680',
city: 'Algemesi', city: 'Algemesi',
province: { name: 'Valencia' }, province: { name: 'Valencia' },
country: { name: 'Spain' }, country: { name: 'Spain' }
}; };
}); });
@ -47,12 +47,7 @@ describe('formatLocation', () => {
}); });
it('should return the country', () => { it('should return the country', () => {
const location = { const location = { ...locationBase, postcode: undefined, city: undefined, province: undefined };
...locationBase,
postcode: undefined,
city: undefined,
province: undefined,
};
const vm = buildComponent(location); const vm = buildComponent(location);
expect(vm.formatLocation(location)).toEqual('Spain'); expect(vm.formatLocation(location)).toEqual('Spain');
}); });
@ -66,7 +61,7 @@ describe('showLabel', () => {
code: '46680', code: '46680',
town: 'Algemesi', town: 'Algemesi',
province: 'Valencia', province: 'Valencia',
country: 'Spain', country: 'Spain'
}; };
}); });
@ -89,12 +84,7 @@ describe('showLabel', () => {
}); });
it('should show the label with country', () => { it('should show the label with country', () => {
const location = { const location = { ...locationBase, code: undefined, town: undefined, province: undefined };
...locationBase,
code: undefined,
town: undefined,
province: undefined,
};
const vm = buildComponent(location); const vm = buildComponent(location);
expect(vm.showLabel(location)).toEqual('Spain'); expect(vm.showLabel(location)).toEqual('Spain');
}); });

View File

@ -90,7 +90,7 @@ describe('VnLog', () => {
vm = createWrapper(VnLog, { vm = createWrapper(VnLog, {
global: { global: {
stubs: ['FetchData', 'vue-i18n', 'VnUserLink'], stubs: ['FetchData', 'vue-i18n'],
mocks: { mocks: {
fetch: vi.fn(), fetch: vi.fn(),
}, },

View File

@ -2,14 +2,13 @@ import { createWrapper } from 'app/test/vitest/helper';
import VnSmsDialog from 'components/common/VnSmsDialog.vue'; import VnSmsDialog from 'components/common/VnSmsDialog.vue';
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest'; import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
describe('VnSmsDialog', () => { describe('VnSmsDialog', () => {
let vm; let vm;
const orderId = 1; const orderId = 1;
const shipped = new Date(); const shipped = new Date();
const phone = '012345678'; const phone = '012345678';
const promise = (response) => { const promise = (response) => {return response;};
return response;
};
const template = 'minAmount'; const template = 'minAmount';
const locale = 'en'; const locale = 'en';
@ -18,13 +17,13 @@ describe('VnSmsDialog', () => {
propsData: { propsData: {
data: { data: {
orderId, orderId,
shipped, shipped
}, },
template, template,
locale, locale,
phone, phone,
promise, promise
}, }
}).vm; }).vm;
}); });
@ -36,9 +35,7 @@ describe('VnSmsDialog', () => {
it('should update the message value with the correct template and parameters', () => { it('should update the message value with the correct template and parameters', () => {
vm.updateMessage(); vm.updateMessage();
expect(vm.message).toEqual( expect(vm.message).toEqual(`A minimum amount of 50€ (VAT excluded) is required for your order ${orderId} of ${shipped} to receive it without additional shipping costs.`);
`A minimum amount of 50€ (VAT excluded) is required for your order ${orderId} of ${shipped} to receive it without additional shipping costs.`,
);
}); });
}); });
@ -50,7 +47,7 @@ describe('VnSmsDialog', () => {
orderId, orderId,
shipped, shipped,
destination: phone, destination: phone,
message: vm.message, message: vm.message
}; };
await vm.send(); await vm.send();

View File

@ -132,7 +132,8 @@ const card = toRef(props, 'item');
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
white-space: nowrap;
width: 192px;
p { p {
margin-bottom: 0; margin-bottom: 0;
} }

View File

@ -17,7 +17,7 @@ const token = getTokenMultimedia();
const { t } = useI18n(); const { t } = useI18n();
const src = computed( const src = computed(
() => `/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`, () => `/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`
); );
const title = computed(() => $props.title?.toUpperCase() || t('globals.system')); const title = computed(() => $props.title?.toUpperCase() || t('globals.system'));
const showLetter = ref(false); const showLetter = ref(false);

View File

@ -13,7 +13,7 @@ const src = computed({
get() { get() {
return new URL( return new URL(
`../../assets/${$props.logo}${Dark.isActive ? '_dark' : ''}.svg`, `../../assets/${$props.logo}${Dark.isActive ? '_dark' : ''}.svg`,
import.meta.url, import.meta.url
).href; ).href;
}, },
}); });

View File

@ -1,11 +1,10 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { ref, reactive, useAttrs, computed, onMounted, nextTick } from 'vue'; import { ref, reactive, useAttrs, computed } from 'vue';
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router'; import { onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useStateStore } from 'stores/useStateStore';
import { tMobile } from 'src/composables/tMobile';
import { toDateHourMin } from 'src/filters'; import { toDateHourMin } from 'src/filters';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
@ -34,47 +33,20 @@ const $props = defineProps({
addNote: { type: Boolean, default: false }, addNote: { type: Boolean, default: false },
selectType: { type: Boolean, default: false }, selectType: { type: Boolean, default: false },
justInput: { type: Boolean, default: false }, justInput: { type: Boolean, default: false },
goTo: { type: String, default: '' },
useUserRelation: { type: Boolean, default: true },
}); });
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
const stateStore = useStateStore();
const router = useRouter();
const route = useRoute();
const componentIsRendered = ref(false);
const newNote = reactive({ text: null, observationTypeFk: null }); const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]); const observationTypes = ref([]);
const vnPaginateRef = ref(); const vnPaginateRef = ref();
const defaultObservationType = computed( const defaultObservationType = computed(() =>
() => observationTypes.value.find((ot) => ot.code === 'salesPerson')?.id, observationTypes.value.find(ot => ot.code === 'salesPerson')?.id
); );
let savedNote = false;
let originalText; let originalText;
onBeforeRouteLeave((to, from, next) => {
if (
(newNote.text && !$props.justInput) ||
(newNote.text !== originalText && $props.justInput)
)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
onMounted(() => {
nextTick(() => (componentIsRendered.value = true));
});
function handleClick(e) { function handleClick(e) {
if (e.shiftKey && e.key === 'Enter') return; if (e.shiftKey && e.key === 'Enter') return;
if ($props.justInput) confirmAndUpdate(); if ($props.justInput) confirmAndUpdate();
@ -96,7 +68,6 @@ async function insert() {
}; };
await axios.post($props.url, newBody); await axios.post($props.url, newBody);
await vnPaginateRef.value.fetch(); await vnPaginateRef.value.fetch();
savedNote = true;
} }
function confirmAndUpdate() { function confirmAndUpdate() {
@ -129,6 +100,22 @@ async function update() {
); );
} }
onBeforeRouteLeave((to, from, next) => {
if (
(newNote.text && !$props.justInput) ||
(newNote.text !== originalText && $props.justInput)
)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
function fetchData([data]) { function fetchData([data]) {
newNote.text = data?.notes; newNote.text = data?.notes;
originalText = data?.notes; originalText = data?.notes;
@ -137,71 +124,13 @@ function fetchData([data]) {
const handleObservationTypes = (data) => { const handleObservationTypes = (data) => {
observationTypes.value = data; observationTypes.value = data;
if (defaultObservationType.value) { if(defaultObservationType.value) {
newNote.observationTypeFk = defaultObservationType.value; newNote.observationTypeFk = defaultObservationType.value;
} }
}; };
async function saveAndGo() {
savedNote = false;
await insert();
router.push({ path: $props.goTo });
}
function getUserFilter() {
const newUserFilter = $props.userFilter ?? {};
const userInclude = {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
},
};
if (newUserFilter.include) {
if (Array.isArray(newUserFilter.include)) {
newUserFilter.include.push(userInclude);
} else {
newUserFilter.include = [userInclude, newUserFilter.include];
}
} else {
newUserFilter.include = userInclude;
}
if ($props.useUserRelation) {
return {
...newUserFilter,
...$props.userFilter,
};
}
return $props.filter;
}
</script> </script>
<template> <template>
<Teleport
to="#st-actions"
v-if="
stateStore?.isSubToolbarShown() &&
componentIsRendered &&
$props.goTo &&
!route.path.includes('summary')
"
>
<QBtn
:label="
tMobile('globals.saveAndContinue') +
' ' +
t('globals.' + $props.goTo.split('/').pop())
"
:title="
t('globals.saveAndContinue') +
' ' +
t('globals.' + $props.goTo.split('/').pop())
"
color="primary"
icon="save"
@click="saveAndGo"
data-cy="saveContinueNoteButton"
/>
</Teleport>
<FetchData <FetchData
v-if="selectType" v-if="selectType"
url="ObservationTypes" url="ObservationTypes"
@ -247,7 +176,7 @@ function getUserFilter() {
:required="'required' in originalAttrs" :required="'required' in originalAttrs"
clearable clearable
> >
<template #append v-if="!$props.goTo"> <template #append>
<QBtn <QBtn
:title="t('Save (Enter)')" :title="t('Save (Enter)')"
icon="save" icon="save"
@ -269,14 +198,16 @@ function getUserFilter() {
:url="$props.url" :url="$props.url"
order="created DESC" order="created DESC"
:limit="0" :limit="0"
:user-filter="getUserFilter()" :user-filter="userFilter"
:filter="filter" :filter="filter"
auto-load auto-load
ref="vnPaginateRef" ref="vnPaginateRef"
class="show" class="show"
v-bind="$attrs" v-bind="$attrs"
:search-url="false" :search-url="false"
@on-fetch="newNote.text = ''" @on-fetch="
newNote.text = '';
"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<TransitionGroup name="list" tag="div" class="column items-center full-width"> <TransitionGroup name="list" tag="div" class="column items-center full-width">
@ -288,15 +219,15 @@ function getUserFilter() {
<QCardSection horizontal> <QCardSection horizontal>
<VnAvatar <VnAvatar
:descriptor="false" :descriptor="false"
:worker-id="note.user?.id" :worker-id="note.workerFk"
size="md" size="md"
:title="note.user?.nickname" :title="note.worker?.user.nickname"
/> />
<div class="full-width row justify-between q-pa-xs"> <div class="full-width row justify-between q-pa-xs">
<div> <div>
<VnUserLink <VnUserLink
:name="`${note.user?.name}`" :name="`${note.worker.user.name}`"
:worker-id="note.user?.id" :worker-id="note.worker.id"
/> />
<QBadge <QBadge
class="q-ml-xs" class="q-ml-xs"

View File

@ -87,7 +87,7 @@ function formatNumber(number) {
<QItemLabel caption>{{ <QItemLabel caption>{{
date.formatDate( date.formatDate(
row.sms.created, row.sms.created,
'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss'
) )
}}</QItemLabel> }}</QItemLabel>
<QItemLabel class="row center"> <QItemLabel class="row center">

View File

@ -37,7 +37,8 @@ onBeforeUnmount(() => stateStore.toggleSubToolbar() && hasSubToolbar);
class="justify-end sticky" class="justify-end sticky"
> >
<slot name="st-data"> <slot name="st-data">
<div id="st-data" :class="{ 'full-width': !actionsChildCount() }"></div> <div id="st-data" :class="{ 'full-width': !actionsChildCount() }">
</div>
</slot> </slot>
<QSpace /> <QSpace />
<slot name="st-actions"> <slot name="st-actions">

View File

@ -1,39 +1,18 @@
<script setup> <script setup>
import AccountDescriptorProxy from 'src/pages/Account/Card/AccountDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { ref, onMounted } from 'vue';
import axios from 'axios'; defineProps({
const $props = defineProps({
name: { type: String, default: null }, name: { type: String, default: null },
tag: { type: String, default: null }, tag: { type: String, default: null },
workerId: { type: Number, default: null }, workerId: { type: Number, default: null },
defaultName: { type: Boolean, default: false }, defaultName: { type: Boolean, default: false },
}); });
const isWorker = ref(false);
onMounted(async () => {
if (!$props.workerId) return;
try {
const {
data: { exists },
} = await axios(`/Workers/${$props.workerId}/exists`);
isWorker.value = exists;
} catch (error) {
if (error.status === 403) return;
throw error;
}
});
</script> </script>
<template> <template>
<slot name="link"> <slot name="link">
<span :class="{ link: workerId }"> <span :class="{ link: workerId }">
{{ defaultName ? (name ?? $t('globals.system')) : name }} {{ defaultName ? name ?? $t('globals.system') : name }}
</span> </span>
</slot> </slot>
<WorkerDescriptorProxy <WorkerDescriptorProxy v-if="workerId" :id="workerId" />
v-if="isWorker"
:id="workerId"
@on-fetch="(data) => (isWorker = data?.workerId !== undefined)"
/>
<AccountDescriptorProxy v-else :id="workerId" />
</template> </template>

View File

@ -12,16 +12,16 @@ function generateWrapper(storage = 'images') {
id: 123, id: 123,
zoomResolution: '400x400', zoomResolution: '400x400',
storage, storage,
}, }
}); });
wrapper = wrapper.wrapper; wrapper = wrapper.wrapper;
vm = wrapper.vm; vm = wrapper.vm;
vm.timeStamp = 'timestamp'; vm.timeStamp = 'timestamp';
} };
vi.mock('src/composables/useSession', () => ({ vi.mock('src/composables/useSession', () => ({
useSession: () => ({ useSession: () => ({
getTokenMultimedia: () => 'token', getTokenMultimedia: () => 'token',
}), }),
})); }));
@ -31,6 +31,7 @@ vi.mock('src/composables/useRole', () => ({
}), }),
})); }));
describe('VnImg', () => { describe('VnImg', () => {
beforeEach(() => { beforeEach(() => {
isEmployeeMock.mockReset(); isEmployeeMock.mockReset();
@ -62,9 +63,7 @@ describe('VnImg', () => {
generateWrapper(); generateWrapper();
await vm.$nextTick(); await vm.$nextTick();
const url = vm.getUrl(); const url = vm.getUrl();
expect(url).toBe( expect(url).toBe('/api/images/catalog/200x200/123/download?access_token=token&timestamp');
'/api/images/catalog/200x200/123/download?access_token=token&timestamp',
);
}); });
it('should return /api/{storage}/{collection}/{curResolution}/{id}/download?access_token={token}&{timeStamp} when zoom is true and role is employee and storage is not dms', async () => { it('should return /api/{storage}/{collection}/{curResolution}/{id}/download?access_token={token}&{timeStamp} when zoom is true and role is employee and storage is not dms', async () => {
@ -72,9 +71,7 @@ describe('VnImg', () => {
generateWrapper(); generateWrapper();
await vm.$nextTick(); await vm.$nextTick();
const url = vm.getUrl(true); const url = vm.getUrl(true);
expect(url).toBe( expect(url).toBe('/api/images/catalog/400x400/123/download?access_token=token&timestamp');
'/api/images/catalog/400x400/123/download?access_token=token&timestamp',
);
}); });
}); });

View File

@ -53,26 +53,26 @@ describe('useAcl', () => {
expect( expect(
acl.hasAny([ acl.hasAny([
{ model: 'Worker', props: 'updateAttributes', accessType: 'WRITE' }, { model: 'Worker', props: 'updateAttributes', accessType: 'WRITE' },
]), ])
).toBeFalsy(); ).toBeFalsy();
}); });
it('should return false if no roles matched', async () => { it('should return false if no roles matched', async () => {
expect( expect(
acl.hasAny([{ model: 'Worker', props: 'holidays', accessType: 'READ' }]), acl.hasAny([{ model: 'Worker', props: 'holidays', accessType: 'READ' }])
).toBeTruthy(); ).toBeTruthy();
}); });
describe('*', () => { describe('*', () => {
it('should return true if an acl matched', async () => { it('should return true if an acl matched', async () => {
expect( expect(
acl.hasAny([{ model: 'Address', props: '*', accessType: 'WRITE' }]), acl.hasAny([{ model: 'Address', props: '*', accessType: 'WRITE' }])
).toBeTruthy(); ).toBeTruthy();
}); });
it('should return false if no acls matched', async () => { it('should return false if no acls matched', async () => {
expect( expect(
acl.hasAny([{ model: 'Worker', props: '*', accessType: 'READ' }]), acl.hasAny([{ model: 'Worker', props: '*', accessType: 'READ' }])
).toBeFalsy(); ).toBeFalsy();
}); });
}); });
@ -80,15 +80,13 @@ describe('useAcl', () => {
describe('$authenticated', () => { describe('$authenticated', () => {
it('should return false if no acls matched', async () => { it('should return false if no acls matched', async () => {
expect( expect(
acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: '*' }]), acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: '*' }])
).toBeFalsy(); ).toBeFalsy();
}); });
it('should return true if an acl matched', async () => { it('should return true if an acl matched', async () => {
expect( expect(
acl.hasAny([ acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: 'READ' }])
{ model: 'Url', props: 'getByUser', accessType: 'READ' },
]),
).toBeTruthy(); ).toBeTruthy();
}); });
}); });
@ -98,7 +96,7 @@ describe('useAcl', () => {
expect( expect(
acl.hasAny([ acl.hasAny([
{ model: 'TpvTransaction', props: 'start', accessType: 'READ' }, { model: 'TpvTransaction', props: 'start', accessType: 'READ' },
]), ])
).toBeFalsy(); ).toBeFalsy();
}); });
@ -106,7 +104,7 @@ describe('useAcl', () => {
expect( expect(
acl.hasAny([ acl.hasAny([
{ model: 'TpvTransaction', props: 'start', accessType: 'WRITE' }, { model: 'TpvTransaction', props: 'start', accessType: 'WRITE' },
]), ])
).toBeTruthy(); ).toBeTruthy();
}); });
}); });

View File

@ -18,7 +18,7 @@ export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile',
export async function downloadDocuware(url, params) { export async function downloadDocuware(url, params) {
const appUrl = await getAppUrl(); const appUrl = await getAppUrl();
const response = await axios.get(`${appUrl}/api/${url}`, { const response = await axios.get(`${appUrl}/api/` + url, {
responseType: 'blob', responseType: 'blob',
params, params,
}); });

View File

@ -20,5 +20,5 @@ export function getColAlign(col) {
if (/^is[A-Z]/.test(col.name) || /^has[A-Z]/.test(col.name)) align = 'center'; if (/^is[A-Z]/.test(col.name) || /^has[A-Z]/.test(col.name)) align = 'center';
return `text-${align ?? 'center'}`; return 'text-' + (align ?? 'center');
} }

View File

@ -1,10 +1,10 @@
export function getDateQBadgeColor(date) { export function getDateQBadgeColor(date) {
const today = Date.vnNew(); let today = Date.vnNew();
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
const timeTicket = new Date(date); let timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0); timeTicket.setHours(0, 0, 0, 0);
const comparation = today - timeTicket; let comparation = today - timeTicket;
if (comparation == 0) return 'warning'; if (comparation == 0) return 'warning';
if (comparation < 0) return 'success'; if (comparation < 0) return 'success';

View File

@ -2,8 +2,9 @@ import { ref } from 'vue';
import moment from 'moment'; import moment from 'moment';
export default function useWeekdaysOrder() { export default function useWeekdaysOrder() {
const firstDay = moment().weekday(1).day();
const weekdays = [...Array(7).keys()].map((i) => (i + firstDay) % 7);
return ref(weekdays); const firstDay = moment().weekday(1).day();
const weekdays = [...Array(7).keys()].map(i => (i + firstDay) % 7);
return ref(weekdays);
} }

View File

@ -7,7 +7,7 @@ export async function beforeSave(data, getChanges, modelOrigin) {
const patchPromises = []; const patchPromises = [];
for (const change of changes) { for (const change of changes) {
const patchData = {}; let patchData = {};
if ('hasMinPrice' in change.data) { if ('hasMinPrice' in change.data) {
patchData.hasMinPrice = change.data?.hasMinPrice; patchData.hasMinPrice = change.data?.hasMinPrice;

View File

@ -1,6 +1,7 @@
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
export default function () { export default function() {
const quasar = useQuasar(); const quasar = useQuasar();
return quasar.screen.gt.xs ? 'q-pa-md' : 'q-pa-xs'; return quasar.screen.gt.xs ? 'q-pa-md': 'q-pa-xs';
} }

View File

@ -6,7 +6,7 @@ export function djb2a(string) {
} }
export function useColor(value) { export function useColor(value) {
return `#${colors[djb2a(value || '') % colors.length]}`; return '#' + colors[djb2a(value || '') % colors.length];
} }
const colors = [ const colors = [

View File

@ -15,16 +15,18 @@ export function usePrintService() {
message: t('globals.notificationSent'), message: t('globals.notificationSent'),
type: 'positive', type: 'positive',
icon: 'check', icon: 'check',
}), })
); );
} }
function openReport(path, params, isNewTab = '_self') { function openReport(path, params, isNewTab = '_self') {
if (typeof params === 'string') params = JSON.parse(params); if (typeof params === 'string') params = JSON.parse(params);
params = { params = Object.assign(
access_token: getTokenMultimedia(), {
...params, access_token: getTokenMultimedia(),
}; },
params
);
const query = new URLSearchParams(params).toString(); const query = new URLSearchParams(params).toString();
window.open(`api/${path}?${query}`, isNewTab); window.open(`api/${path}?${query}`, isNewTab);

View File

@ -17,7 +17,7 @@ export function useSession() {
let intervalId = null; let intervalId = null;
function setSession(data) { function setSession(data) {
const keepLogin = data.keepLogin; let keepLogin = data.keepLogin;
const storage = keepLogin ? localStorage : sessionStorage; const storage = keepLogin ? localStorage : sessionStorage;
storage.setItem(TOKEN, data.token); storage.setItem(TOKEN, data.token);
storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia); storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);

View File

@ -8,7 +8,7 @@ export function useVnConfirm() {
message, message,
promise, promise,
successFn, successFn,
customHTML = {}, customHTML = {}
) => { ) => {
const { component, props } = customHTML; const { component, props } = customHTML;
Dialog.create({ Dialog.create({
@ -19,7 +19,7 @@ export function useVnConfirm() {
message: message, message: message,
promise: promise, promise: promise,
}, },
{ customHTML: () => h(component, props) }, { customHTML: () => h(component, props) }
), ),
}).onOk(async () => { }).onOk(async () => {
if (successFn) successFn(); if (successFn) successFn();

File diff suppressed because one or more lines are too long

View File

@ -1,455 +1,453 @@
@font-face { @font-face {
font-family: 'icon'; font-family: 'icon';
src: url('fonts/icon.eot?uocffs'); src: url('fonts/icon.eot?uocffs');
src: src: url('fonts/icon.eot?uocffs#iefix') format('embedded-opentype'),
url('fonts/icon.eot?uocffs#iefix') format('embedded-opentype'), url('fonts/icon.ttf?uocffs') format('truetype'),
url('fonts/icon.ttf?uocffs') format('truetype'), url('fonts/icon.woff?uocffs') format('woff'),
url('fonts/icon.woff?uocffs') format('woff'), url('fonts/icon.svg?uocffs#icon') format('svg');
url('fonts/icon.svg?uocffs#icon') format('svg'); font-weight: normal;
font-weight: normal; font-style: normal;
font-style: normal; font-display: block;
font-display: block;
} }
[class^='icon-'], [class^="icon-"], [class*=" icon-"] {
[class*=' icon-'] { /* use !important to prevent issues with browser extensions that change fonts */
/* use !important to prevent issues with browser extensions that change fonts */ font-family: 'icon' !important;
font-family: 'icon' !important; speak: never;
speak: never; font-style: normal;
font-style: normal; font-weight: normal;
font-weight: normal; font-variant: normal;
font-variant: normal; text-transform: none;
text-transform: none; line-height: 1;
line-height: 1;
/* Better Font Rendering =========== */ /* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-inactive-car:before { .icon-inactive-car:before {
content: '\e978'; content: "\e978";
} }
.icon-hasItemLost:before { .icon-hasItemLost:before {
content: '\e957'; content: "\e957";
} }
.icon-hasItemDelay:before { .icon-hasItemDelay:before {
content: '\e96d'; content: "\e96d";
} }
.icon-add_entries:before { .icon-add_entries:before {
content: '\e953'; content: "\e953";
} }
.icon-100:before { .icon-100:before {
content: '\e901'; content: "\e901";
} }
.icon-Client_unpaid:before { .icon-Client_unpaid:before {
content: '\e98c'; content: "\e98c";
} }
.icon-History:before { .icon-History:before {
content: '\e902'; content: "\e902";
} }
.icon-Person:before { .icon-Person:before {
content: '\e903'; content: "\e903";
} }
.icon-accessory:before { .icon-accessory:before {
content: '\e904'; content: "\e904";
} }
.icon-account:before { .icon-account:before {
content: '\e905'; content: "\e905";
} }
.icon-actions:before { .icon-actions:before {
content: '\e907'; content: "\e907";
} }
.icon-addperson:before { .icon-addperson:before {
content: '\e908'; content: "\e908";
} }
.icon-agencia_tributaria:before { .icon-agencia_tributaria:before {
content: '\e948'; content: "\e948";
} }
.icon-agency:before { .icon-agency:before {
content: '\e92a'; content: "\e92a";
} }
.icon-agency-term:before { .icon-agency-term:before {
content: '\e909'; content: "\e909";
} }
.icon-albaran:before { .icon-albaran:before {
content: '\e92c'; content: "\e92c";
} }
.icon-anonymous:before { .icon-anonymous:before {
content: '\e90b'; content: "\e90b";
} }
.icon-apps:before { .icon-apps:before {
content: '\e90c'; content: "\e90c";
} }
.icon-artificial:before { .icon-artificial:before {
content: '\e90d'; content: "\e90d";
} }
.icon-attach:before { .icon-attach:before {
content: '\e90e'; content: "\e90e";
} }
.icon-barcode:before { .icon-barcode:before {
content: '\e90f'; content: "\e90f";
} }
.icon-basket:before { .icon-basket:before {
content: '\e910'; content: "\e910";
} }
.icon-basketadd:before { .icon-basketadd:before {
content: '\e911'; content: "\e911";
} }
.icon-bin:before { .icon-bin:before {
content: '\e913'; content: "\e913";
} }
.icon-botanical:before { .icon-botanical:before {
content: '\e914'; content: "\e914";
} }
.icon-bucket:before { .icon-bucket:before {
content: '\e915'; content: "\e915";
} }
.icon-buscaman:before { .icon-buscaman:before {
content: '\e916'; content: "\e916";
} }
.icon-buyrequest:before { .icon-buyrequest:before {
content: '\e917'; content: "\e917";
} }
.icon-calc_volum .path1:before { .icon-calc_volum .path1:before {
content: '\e918'; content: "\e918";
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
} }
.icon-calc_volum .path2:before { .icon-calc_volum .path2:before {
content: '\e919'; content: "\e919";
margin-left: -1em; margin-left: -1em;
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
} }
.icon-calc_volum .path3:before { .icon-calc_volum .path3:before {
content: '\e91c'; content: "\e91c";
margin-left: -1em; margin-left: -1em;
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
} }
.icon-calc_volum .path4:before { .icon-calc_volum .path4:before {
content: '\e91d'; content: "\e91d";
margin-left: -1em; margin-left: -1em;
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
} }
.icon-calc_volum .path5:before { .icon-calc_volum .path5:before {
content: '\e91e'; content: "\e91e";
margin-left: -1em; margin-left: -1em;
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
} }
.icon-calc_volum .path6:before { .icon-calc_volum .path6:before {
content: '\e91f'; content: "\e91f";
margin-left: -1em; margin-left: -1em;
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
} }
.icon-calendar:before { .icon-calendar:before {
content: '\e920'; content: "\e920";
} }
.icon-catalog:before { .icon-catalog:before {
content: '\e921'; content: "\e921";
} }
.icon-claims:before { .icon-claims:before {
content: '\e922'; content: "\e922";
} }
.icon-client:before { .icon-client:before {
content: '\e923'; content: "\e923";
} }
.icon-clone:before { .icon-clone:before {
content: '\e924'; content: "\e924";
} }
.icon-columnadd:before { .icon-columnadd:before {
content: '\e925'; content: "\e925";
} }
.icon-columndelete:before { .icon-columndelete:before {
content: '\e926'; content: "\e926";
} }
.icon-components:before { .icon-components:before {
content: '\e927'; content: "\e927";
} }
.icon-consignatarios:before { .icon-consignatarios:before {
content: '\e928'; content: "\e928";
} }
.icon-control:before { .icon-control:before {
content: '\e929'; content: "\e929";
} }
.icon-credit:before { .icon-credit:before {
content: '\e92b'; content: "\e92b";
} }
.icon-defaulter:before { .icon-defaulter:before {
content: '\e92d'; content: "\e92d";
} }
.icon-deletedTicket:before { .icon-deletedTicket:before {
content: '\e92e'; content: "\e92e";
} }
.icon-deleteline:before { .icon-deleteline:before {
content: '\e92f'; content: "\e92f";
} }
.icon-delivery:before { .icon-delivery:before {
content: '\e930'; content: "\e930";
} }
.icon-deliveryprices:before { .icon-deliveryprices:before {
content: '\e932'; content: "\e932";
} }
.icon-details:before { .icon-details:before {
content: '\e933'; content: "\e933";
} }
.icon-dfiscales:before { .icon-dfiscales:before {
content: '\e934'; content: "\e934";
} }
.icon-disabled:before { .icon-disabled:before {
content: '\e935'; content: "\e935";
} }
.icon-doc:before { .icon-doc:before {
content: '\e936'; content: "\e936";
} }
.icon-entry:before { .icon-entry:before {
content: '\e937'; content: "\e937";
} }
.icon-entry_lastbuys:before { .icon-entry_lastbuys:before {
content: '\e91a'; content: "\e91a";
} }
.icon-exit:before { .icon-exit:before {
content: '\e938'; content: "\e938";
} }
.icon-eye:before { .icon-eye:before {
content: '\e939'; content: "\e939";
} }
.icon-fixedPrice:before { .icon-fixedPrice:before {
content: '\e93a'; content: "\e93a";
} }
.icon-flower:before { .icon-flower:before {
content: '\e93b'; content: "\e93b";
} }
.icon-frozen:before { .icon-frozen:before {
content: '\e93c'; content: "\e93c";
} }
.icon-fruit:before { .icon-fruit:before {
content: '\e93d'; content: "\e93d";
} }
.icon-funeral:before { .icon-funeral:before {
content: '\e93e'; content: "\e93e";
} }
.icon-grafana:before { .icon-grafana:before {
content: '\e906'; content: "\e906";
} }
.icon-greenery:before { .icon-greenery:before {
content: '\e93f'; content: "\e93f";
} }
.icon-greuge:before { .icon-greuge:before {
content: '\e940'; content: "\e940";
} }
.icon-grid:before { .icon-grid:before {
content: '\e941'; content: "\e941";
} }
.icon-handmade:before { .icon-handmade:before {
content: '\e942'; content: "\e942";
} }
.icon-handmadeArtificial:before { .icon-handmadeArtificial:before {
content: '\e943'; content: "\e943";
} }
.icon-headercol:before { .icon-headercol:before {
content: '\e945'; content: "\e945";
} }
.icon-info:before { .icon-info:before {
content: '\e946'; content: "\e946";
} }
.icon-inventory:before { .icon-inventory:before {
content: '\e947'; content: "\e947";
} }
.icon-invoice:before { .icon-invoice:before {
content: '\e968'; content: "\e968";
color: #5f5f5f; color: #5f5f5f;
} }
.icon-invoice-in:before { .icon-invoice-in:before {
content: '\e949'; content: "\e949";
} }
.icon-invoice-in-create:before { .icon-invoice-in-create:before {
content: '\e94a'; content: "\e94a";
} }
.icon-invoice-out:before { .icon-invoice-out:before {
content: '\e94b'; content: "\e94b";
} }
.icon-isTooLittle:before { .icon-isTooLittle:before {
content: '\e94c'; content: "\e94c";
} }
.icon-item:before { .icon-item:before {
content: '\e94d'; content: "\e94d";
} }
.icon-languaje:before { .icon-languaje:before {
content: '\e970'; content: "\e970";
} }
.icon-lines:before { .icon-lines:before {
content: '\e94e'; content: "\e94e";
} }
.icon-linesprepaired:before { .icon-linesprepaired:before {
content: '\e94f'; content: "\e94f";
} }
.icon-link-to-corrected:before { .icon-link-to-corrected:before {
content: '\e931'; content: "\e931";
} }
.icon-link-to-correcting:before { .icon-link-to-correcting:before {
content: '\e944'; content: "\e944";
} }
.icon-logout:before { .icon-logout:before {
content: '\e973'; content: "\e973";
} }
.icon-mana:before { .icon-mana:before {
content: '\e950'; content: "\e950";
} }
.icon-mandatory:before { .icon-mandatory:before {
content: '\e951'; content: "\e951";
} }
.icon-net:before { .icon-net:before {
content: '\e952'; content: "\e952";
} }
.icon-newalbaran:before { .icon-newalbaran:before {
content: '\e954'; content: "\e954";
} }
.icon-niche:before { .icon-niche:before {
content: '\e955'; content: "\e955";
} }
.icon-no036:before { .icon-no036:before {
content: '\e956'; content: "\e956";
} }
.icon-noPayMethod:before { .icon-noPayMethod:before {
content: '\e958'; content: "\e958";
} }
.icon-notes:before { .icon-notes:before {
content: '\e959'; content: "\e959";
} }
.icon-noweb:before { .icon-noweb:before {
content: '\e95a'; content: "\e95a";
} }
.icon-onlinepayment:before { .icon-onlinepayment:before {
content: '\e95b'; content: "\e95b";
} }
.icon-package:before { .icon-package:before {
content: '\e95c'; content: "\e95c";
} }
.icon-payment:before { .icon-payment:before {
content: '\e95d'; content: "\e95d";
} }
.icon-pbx:before { .icon-pbx:before {
content: '\e95e'; content: "\e95e";
} }
.icon-pets:before { .icon-pets:before {
content: '\e95f'; content: "\e95f";
} }
.icon-photo:before { .icon-photo:before {
content: '\e960'; content: "\e960";
} }
.icon-plant:before { .icon-plant:before {
content: '\e961'; content: "\e961";
} }
.icon-polizon:before { .icon-polizon:before {
content: '\e962'; content: "\e962";
} }
.icon-preserved:before { .icon-preserved:before {
content: '\e963'; content: "\e963";
} }
.icon-recovery:before { .icon-recovery:before {
content: '\e964'; content: "\e964";
} }
.icon-regentry:before { .icon-regentry:before {
content: '\e965'; content: "\e965";
} }
.icon-reserva:before { .icon-reserva:before {
content: '\e966'; content: "\e966";
} }
.icon-revision:before { .icon-revision:before {
content: '\e967'; content: "\e967";
} }
.icon-risk:before { .icon-risk:before {
content: '\e969'; content: "\e969";
} }
.icon-saysimple:before { .icon-saysimple:before {
content: '\e912'; content: "\e912";
} }
.icon-services:before { .icon-services:before {
content: '\e96a'; content: "\e96a";
} }
.icon-settings:before { .icon-settings:before {
content: '\e96b'; content: "\e96b";
} }
.icon-shipment:before { .icon-shipment:before {
content: '\e96c'; content: "\e96c";
} }
.icon-sign:before { .icon-sign:before {
content: '\e90a'; content: "\e90a";
} }
.icon-sms:before { .icon-sms:before {
content: '\e96e'; content: "\e96e";
} }
.icon-solclaim:before { .icon-solclaim:before {
content: '\e96f'; content: "\e96f";
} }
.icon-solunion:before { .icon-solunion:before {
content: '\e971'; content: "\e971";
} }
.icon-splitline:before { .icon-splitline:before {
content: '\e972'; content: "\e972";
} }
.icon-splur:before { .icon-splur:before {
content: '\e974'; content: "\e974";
} }
.icon-stowaway:before { .icon-stowaway:before {
content: '\e975'; content: "\e975";
} }
.icon-supplier:before { .icon-supplier:before {
content: '\e976'; content: "\e976";
} }
.icon-supplierfalse:before { .icon-supplierfalse:before {
content: '\e977'; content: "\e977";
} }
.icon-tags:before { .icon-tags:before {
content: '\e979'; content: "\e979";
} }
.icon-tax:before { .icon-tax:before {
content: '\e97a'; content: "\e97a";
} }
.icon-thermometer:before { .icon-thermometer:before {
content: '\e97b'; content: "\e97b";
} }
.icon-ticket:before { .icon-ticket:before {
content: '\e97c'; content: "\e97c";
} }
.icon-ticketAdd:before { .icon-ticketAdd:before {
content: '\e97e'; content: "\e97e";
} }
.icon-traceability:before { .icon-traceability:before {
content: '\e97f'; content: "\e97f";
} }
.icon-transaction:before { .icon-transaction:before {
content: '\e91b'; content: "\e91b";
} }
.icon-treatments:before { .icon-treatments:before {
content: '\e980'; content: "\e980";
} }
.icon-trolley:before { .icon-trolley:before {
content: '\e900'; content: "\e900";
} }
.icon-troncales:before { .icon-troncales:before {
content: '\e982'; content: "\e982";
} }
.icon-unavailable:before { .icon-unavailable:before {
content: '\e983'; content: "\e983";
} }
.icon-visible_columns:before { .icon-visible_columns:before {
content: '\e984'; content: "\e984";
} }
.icon-volume:before { .icon-volume:before {
content: '\e985'; content: "\e985";
} }
.icon-wand:before { .icon-wand:before {
content: '\e986'; content: "\e986";
} }
.icon-web:before { .icon-web:before {
content: '\e987'; content: "\e987";
} }
.icon-wiki:before { .icon-wiki:before {
content: '\e989'; content: "\e989";
} }
.icon-worker:before { .icon-worker:before {
content: '\e98a'; content: "\e98a";
} }
.icon-zone:before { .icon-zone:before {
content: '\e98b'; content: "\e98b";
} }

View File

@ -30,12 +30,10 @@ export function isValidDate(date) {
export function toDateFormat(date, locale = 'es-ES', opts = {}) { export function toDateFormat(date, locale = 'es-ES', opts = {}) {
if (!isValidDate(date)) return ''; if (!isValidDate(date)) return '';
const format = { const format = Object.assign(
year: 'numeric', { year: 'numeric', month: '2-digit', day: '2-digit' },
month: '2-digit', opts
day: '2-digit', );
...opts,
};
return new Date(date).toLocaleDateString(locale, format); return new Date(date).toLocaleDateString(locale, format);
} }
@ -106,17 +104,17 @@ export function secondsToHoursMinutes(seconds, includeHSuffix = true) {
const hours = Math.floor(seconds / 3600); const hours = Math.floor(seconds / 3600);
const remainingMinutes = seconds % 3600; const remainingMinutes = seconds % 3600;
const minutes = Math.floor(remainingMinutes / 60); const minutes = Math.floor(remainingMinutes / 60);
const formattedHours = hours < 10 ? `0${hours}` : hours; const formattedHours = hours < 10 ? '0' + hours : hours;
const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes; const formattedMinutes = minutes < 10 ? '0' + minutes : minutes;
// Append "h." if includeHSuffix is true // Append "h." if includeHSuffix is true
const suffix = includeHSuffix ? ' h.' : ''; const suffix = includeHSuffix ? ' h.' : '';
// Return formatted string // Return formatted string
return `${formattedHours}:${formattedMinutes}${suffix}`; return formattedHours + ':' + formattedMinutes + suffix;
} }
export function getTimeDifferenceWithToday(date) { export function getTimeDifferenceWithToday(date) {
const today = Date.vnNew(); let today = Date.vnNew();
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
date = new Date(date); date = new Date(date);

View File

@ -5,12 +5,12 @@
* @return {Object} The fields as object * @return {Object} The fields as object
*/ */
function fieldsToObject(fields) { function fieldsToObject(fields) {
const fieldsObj = {}; let fieldsObj = {};
if (Array.isArray(fields)) { if (Array.isArray(fields)) {
for (const field of fields) fieldsObj[field] = true; for (let field of fields) fieldsObj[field] = true;
} else if (typeof fields == 'object') { } else if (typeof fields == 'object') {
for (const field in fields) { for (let field in fields) {
if (fields[field]) fieldsObj[field] = true; if (fields[field]) fieldsObj[field] = true;
} }
} }
@ -26,7 +26,7 @@ function fieldsToObject(fields) {
* @return {Array} The merged fields as an array * @return {Array} The merged fields as an array
*/ */
function mergeFields(src, dst) { function mergeFields(src, dst) {
const fields = {}; let fields = {};
Object.assign(fields, fieldsToObject(src), fieldsToObject(dst)); Object.assign(fields, fieldsToObject(src), fieldsToObject(dst));
return Object.keys(fields); return Object.keys(fields);
} }
@ -39,7 +39,7 @@ function mergeFields(src, dst) {
* @return {Array} The merged wheres * @return {Array} The merged wheres
*/ */
function mergeWhere(src, dst) { function mergeWhere(src, dst) {
const and = []; let and = [];
if (src) and.push(src); if (src) and.push(src);
if (dst) and.push(dst); if (dst) and.push(dst);
return simplifyOperation(and, 'and'); return simplifyOperation(and, 'and');
@ -53,7 +53,7 @@ function mergeWhere(src, dst) {
* @return {Object} The result filter * @return {Object} The result filter
*/ */
function mergeFilters(src, dst) { function mergeFilters(src, dst) {
const res = { ...dst }; let res = Object.assign({}, dst);
if (!src) return res; if (!src) return res;
@ -80,12 +80,12 @@ function simplifyOperation(operation, operator) {
} }
function buildFilter(params, builderFunc) { function buildFilter(params, builderFunc) {
const and = []; let and = [];
for (const param in params) { for (let param in params) {
const value = params[param]; let value = params[param];
if (value == null) continue; if (value == null) continue;
const expr = builderFunc(param, value); let expr = builderFunc(param, value);
if (expr) and.push(expr); if (expr) and.push(expr);
} }
return simplifyOperation(and, 'and'); return simplifyOperation(and, 'and');

View File

@ -1,14 +1,14 @@
export default function getDifferences(obj1, obj2) { export default function getDifferences(obj1, obj2) {
const diff = {}; let diff = {};
delete obj1.$index; delete obj1.$index;
delete obj2.$index; delete obj2.$index;
for (const key in obj1) { for (let key in obj1) {
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) { if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
diff[key] = obj2[key]; diff[key] = obj2[key];
} }
} }
for (const key in obj2) { for (let key in obj2) {
if ( if (
obj1[key] === undefined || obj1[key] === undefined ||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key]) JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])

View File

@ -1,10 +1,10 @@
export default function toDateString(date) { export default function toDateString(date) {
let day = date.getDate(); let day = date.getDate();
let month = date.getMonth() + 1; let month = date.getMonth() + 1;
const year = date.getFullYear(); let year = date.getFullYear();
if (day < 10) day = `0${day}`; if (day < 10) day = `0${day}`;
if (month < 10) month = `0${month}`; if (month < 10) month = `0${month}`;
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`
} }

View File

@ -1,5 +1,5 @@
export default function toLowerCamel(value) { export default function toLowerCamel(value) {
if (!value) return; if (!value) return;
if (typeof value !== 'string') return value; if (typeof (value) !== 'string') return value;
return value.charAt(0).toLowerCase() + value.slice(1); return value.charAt(0).toLowerCase() + value.slice(1);
} }

View File

@ -9,7 +9,7 @@ export default function formatDate(dateVal) {
const dateZeroTime = new Date(dateVal); const dateZeroTime = new Date(dateVal);
dateZeroTime.setHours(0, 0, 0, 0); dateZeroTime.setHours(0, 0, 0, 0);
const diff = Math.trunc( const diff = Math.trunc(
(today.getTime() - dateZeroTime.getTime()) / (1000 * 3600 * 24), (today.getTime() - dateZeroTime.getTime()) / (1000 * 3600 * 24)
); );
let format; let format;
if (diff === 0) format = t('globals.today'); if (diff === 0) format = t('globals.today');

View File

@ -11,14 +11,14 @@ for (const file in files) {
translations[lang] = g.default; translations[lang] = g.default;
}) })
.finally(() => { .finally(() => {
const actualLang = `${lang}.yml`; const actualLang = lang + '.yml';
for (const module in modules) { for (const module in modules) {
if (!module.endsWith(actualLang)) continue; if (!module.endsWith(actualLang)) continue;
modules[module]().then((t) => { modules[module]().then((t) => {
Object.assign(translations[lang], t.default); Object.assign(translations[lang], t.default);
}); })
} }
}); });
} }
export const localeEquivalence = { export const localeEquivalence = {

View File

@ -24,14 +24,13 @@ globals:
dataDeleted: Data deleted dataDeleted: Data deleted
delete: Delete delete: Delete
search: Search search: Search
lines: Lines
changes: Changes changes: Changes
dataCreated: Data created dataCreated: Data created
add: Add add: Add
create: Create create: Create
edit: Edit edit: Edit
save: Save save: Save
saveAndContinue: Save and go to saveAndContinue: Save and continue
remove: Remove remove: Remove
reset: Reset reset: Reset
close: Close close: Close
@ -108,8 +107,6 @@ globals:
from: From from: From
to: To to: To
notes: Notes notes: Notes
photos: Photos
due-day: Due day
refresh: Refresh refresh: Refresh
item: Item item: Item
ticket: Ticket ticket: Ticket
@ -352,6 +349,7 @@ globals:
vehicle: Vehicle vehicle: Vehicle
entryPreAccount: Pre-account entryPreAccount: Pre-account
management: Worker management management: Worker management
deliveryNotes: Delivery notes
unsavedPopup: unsavedPopup:
title: Unsaved changes will be lost title: Unsaved changes will be lost
subtitle: Are you sure exit without saving? subtitle: Are you sure exit without saving?
@ -400,7 +398,6 @@ errors:
updateUserConfig: Error updating user config updateUserConfig: Error updating user config
tokenConfig: Error fetching token config tokenConfig: Error fetching token config
writeRequest: The requested operation could not be completed writeRequest: The requested operation could not be completed
claimBeginningQuantity: Cannot import a line with a claimed quantity of 0
login: login:
title: Login title: Login
username: Username username: Username

View File

@ -25,13 +25,12 @@ globals:
openDetail: Ver detalle openDetail: Ver detalle
delete: Eliminar delete: Eliminar
search: Buscar search: Buscar
lines: Lineas
changes: Cambios changes: Cambios
add: Añadir add: Añadir
create: Crear create: Crear
edit: Modificar edit: Modificar
save: Guardar save: Guardar
saveAndContinue: Guardar e ir a saveAndContinue: Guardar y continuar
remove: Eliminar remove: Eliminar
reset: Restaurar reset: Restaurar
close: Cerrar close: Cerrar
@ -112,8 +111,6 @@ globals:
from: Desde from: Desde
to: Hasta to: Hasta
notes: Notas notes: Notas
photos: Fotos
due-day: Vencimiento
refresh: Actualizar refresh: Actualizar
item: Artículo item: Artículo
ticket: Ticket ticket: Ticket
@ -355,6 +352,7 @@ globals:
vehicle: Vehículo vehicle: Vehículo
entryPreAccount: Precontabilizar entryPreAccount: Precontabilizar
management: Gestión de trabajadores management: Gestión de trabajadores
deliveryNotes: Albaranes
unsavedPopup: unsavedPopup:
title: Los cambios que no haya guardado se perderán title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar? subtitle: ¿Seguro que quiere salir sin guardar?
@ -396,7 +394,6 @@ errors:
updateUserConfig: Error al actualizar la configuración de usuario updateUserConfig: Error al actualizar la configuración de usuario
tokenConfig: Error al obtener configuración de token tokenConfig: Error al obtener configuración de token
writeRequest: No se pudo completar la operación solicitada writeRequest: No se pudo completar la operación solicitada
claimBeginningQuantity: No se puede importar una linea sin una cantidad reclamada
login: login:
title: Inicio de sesión title: Inicio de sesión
username: Nombre de usuario username: Nombre de usuario

View File

@ -80,7 +80,7 @@ const killSession = async ({ userId, created }) => {
openConfirmationModal( openConfirmationModal(
t('Session will be killed'), t('Session will be killed'),
t('Are you sure you want to continue?'), t('Are you sure you want to continue?'),
() => killSession(row), () => killSession(row)
) )
" "
outline outline

View File

@ -149,12 +149,12 @@ const columns = computed(() => [
:right-search="false" :right-search="false"
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnInputPassword <VnInputPassword
:label="t('Password')" :label="t('Password')"
v-model="data.password" v-model="data.password"
:required="true" :required="true"
autocomplete="new-password" autocomplete="new-password"
/> />
</template> </template>
</VnTable> </VnTable>
</template> </template>

View File

@ -57,7 +57,7 @@ watch(
store.url = urlPath.value; store.url = urlPath.value;
store.filter = filter; store.filter = filter;
fetchAliases(); fetchAliases();
}, }
); );
const fetchAliases = () => paginateRef.value.fetch(); const fetchAliases = () => paginateRef.value.fetch();
@ -91,7 +91,7 @@ const fetchAliases = () => paginateRef.value.fetch();
openConfirmationModal( openConfirmationModal(
t('User will be removed from alias'), t('User will be removed from alias'),
t('Are you sure you want to continue?'), t('Are you sure you want to continue?'),
() => deleteAlias(row), () => deleteAlias(row)
) )
" "
> >

View File

@ -28,7 +28,7 @@ const loading = ref(false);
const hasDataChanged = computed( const hasDataChanged = computed(
() => () =>
formData.value.forwardTo !== initialData.value.forwardTo || formData.value.forwardTo !== initialData.value.forwardTo ||
initialData.value.hasData !== hasData.value, initialData.value.hasData !== hasData.value
); );
const fetchMailForwards = async () => { const fetchMailForwards = async () => {
@ -77,7 +77,7 @@ const setInitialData = async () => {
watch( watch(
() => route.params.id, () => route.params.id,
() => setInitialData(), () => setInitialData()
); );
onMounted(async () => await setInitialData()); onMounted(async () => await setInitialData());

View File

@ -14,7 +14,7 @@ const rolesOptions = ref([]);
const formModelRef = ref(); const formModelRef = ref();
watch( watch(
() => route.params.id, () => route.params.id,
() => formModelRef.value.reset(), () => formModelRef.value.reset()
); );
</script> </script>
<template> <template>

View File

@ -44,7 +44,7 @@ watch(
store.filter = filter.value; store.filter = filter.value;
store.limit = 0; store.limit = 0;
fetchSubRoles(); fetchSubRoles();
}, }
); );
const fetchSubRoles = () => paginateRef.value.fetch(); const fetchSubRoles = () => paginateRef.value.fetch();

View File

@ -43,7 +43,7 @@ watch(
store.url = urlPath.value; store.url = urlPath.value;
store.filter = filter.value; store.filter = filter.value;
fetchSubRoles(); fetchSubRoles();
}, }
); );
const fetchSubRoles = () => paginateRef.value.fetch(); const fetchSubRoles = () => paginateRef.value.fetch();

View File

@ -13,10 +13,8 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import useNotify from 'src/composables/useNotify.js';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify();
const quasar = useQuasar(); const quasar = useQuasar();
const route = useRoute(); const route = useRoute();
const claim = ref(null); const claim = ref(null);
@ -178,17 +176,12 @@ async function save(data) {
} }
async function importToNewRefundTicket() { async function importToNewRefundTicket() {
try { await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`); await claimActionsForm.value.reload();
await claimActionsForm.value.reload(); quasar.notify({
quasar.notify({ message: t('globals.dataSaved'),
message: t('globals.dataSaved'), type: 'positive',
type: 'positive', });
});
} catch (error) {
const errorMessage = error.response?.data?.error?.message;
notify(t(errorMessage), 'negative');
}
} }
async function post(query, params) { async function post(query, params) {

View File

@ -33,7 +33,6 @@ function onBeforeSave(formData, originalData) {
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load /> <FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
<FormModel <FormModel
model="Claim" model="Claim"
:go-to="`/claim/${route.params.id}/notes`"
:url-update="`Claims/updateClaim/${route.params.id}`" :url-update="`Claims/updateClaim/${route.params.id}`"
:mapper="onBeforeSave" :mapper="onBeforeSave"
auto-load auto-load

View File

@ -138,7 +138,6 @@ const columns = computed(() => [
:filter="developmentsFilter" :filter="developmentsFilter"
ref="claimDevelopmentForm" ref="claimDevelopmentForm"
:data-required="{ claimFk: route.params.id }" :data-required="{ claimFk: route.params.id }"
:insert-on-load="true"
v-model:selected="selected" v-model:selected="selected"
@save-changes="$router.push(`/claim/${route.params.id}/action`)" @save-changes="$router.push(`/claim/${route.params.id}/action`)"
:default-save="false" :default-save="false"
@ -239,9 +238,7 @@ const columns = computed(() => [
<style lang="scss" scoped> <style lang="scss" scoped>
.grid-style-transition { .grid-style-transition {
transition: transition: transform 0.28s, background-color 0.28s;
transform 0.28s,
background-color 0.28s;
} }
</style> </style>

View File

@ -78,8 +78,6 @@ const columns = computed(() => [
label: t('Quantity'), label: t('Quantity'),
field: ({ sale }) => sale.quantity, field: ({ sale }) => sale.quantity,
sortable: true, sortable: true,
style: 'padding-right: 2%;',
headerStyle: 'padding-right: 2%;',
}, },
{ {
name: 'claimed', name: 'claimed',
@ -112,8 +110,6 @@ const columns = computed(() => [
field: ({ sale }) => totalRow(sale), field: ({ sale }) => totalRow(sale),
format: (value) => toCurrency(value), format: (value) => toCurrency(value),
sortable: true, sortable: true,
style: 'padding-right: 2%;',
headerStyle: 'padding-right: 2%;',
}, },
]); ]);
@ -156,29 +152,10 @@ function showImportDialog() {
.onOk(() => claimLinesForm.value.reload()); .onOk(() => claimLinesForm.value.reload());
} }
function fillClaimedQuantities() { async function saveWhenHasChanges() {
const formData = claimLinesForm.value.formData; if (claimLinesForm.value.getChanges().updates) {
let hasChanges = false; await claimLinesForm.value.onSubmit();
onFetch(claimLinesForm.value.formData);
const selectedRows = formData.filter((row) => selected.value.includes(row));
for (const row of selectedRows) {
if (row.quantity === 0 || row.quantity === null) {
row.quantity = row.sale.quantity;
hasChanges = true;
}
}
if (hasChanges) {
quasar.notify({
message: t('Quantities filled automatically'),
type: 'positive',
});
} else {
quasar.notify({
message: t('No quantities to fill'),
type: 'info',
});
} }
} }
</script> </script>
@ -209,14 +186,14 @@ function fillClaimedQuantities() {
/> />
<div class="q-pa-md"> <div class="q-pa-md">
<CrudModel <CrudModel
data-key="claimLines" data-key="ClaimLines"
ref="claimLinesForm" ref="claimLinesForm"
:go-to="`photos`"
:url="`Claims/${route.params.id}/lines`" :url="`Claims/${route.params.id}/lines`"
save-url="ClaimBeginnings/crud" save-url="ClaimBeginnings/crud"
:user-filter="linesFilter" :user-filter="linesFilter"
@on-fetch="onFetch" @on-fetch="onFetch"
v-model:selected="selected" v-model:selected="selected"
:default-save="false"
:default-reset="false" :default-reset="false"
auto-load auto-load
:limit="0" :limit="0"
@ -233,7 +210,13 @@ function fillClaimedQuantities() {
> >
<template #body-cell-claimed="{ row }"> <template #body-cell-claimed="{ row }">
<QTd auto-width align="right" class="text-primary shrink"> <QTd auto-width align="right" class="text-primary shrink">
<QInput v-model.number="row.quantity" type="number" dense /> <QInput
v-model.number="row.quantity"
type="number"
dense
@keyup.enter="saveWhenHasChanges()"
@blur="saveWhenHasChanges()"
/>
</QTd> </QTd>
</template> </template>
<template #body-cell-description="{ row, value }"> <template #body-cell-description="{ row, value }">
@ -289,6 +272,10 @@ function fillClaimedQuantities() {
type="number" type="number"
dense dense
autofocus autofocus
@keyup.enter="
saveWhenHasChanges()
"
@blur="saveWhenHasChanges()"
/> />
</QItemLabel> </QItemLabel>
</template> </template>
@ -326,18 +313,6 @@ function fillClaimedQuantities() {
</template> </template>
</QTable> </QTable>
</template> </template>
<template #moreBeforeActions>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:label="t('Rellenar cantidades')"
:title="t('Rellenar cantidades')"
icon="auto_fix_high"
:disabled="!selected.length"
@click="fillClaimedQuantities"
/>
</template>
</CrudModel> </CrudModel>
</div> </div>
@ -383,8 +358,6 @@ es:
Delete claimed sales: Eliminar ventas reclamadas Delete claimed sales: Eliminar ventas reclamadas
Discount updated: Descuento actualizado Discount updated: Descuento actualizado
Claimed quantity: Cantidad reclamada Claimed quantity: Cantidad reclamada
Quantities filled automatically: Cantidades rellenadas automáticamente
No quantities to fill: No hay cantidades para rellenar
You are about to remove {count} rows: ' You are about to remove {count} rows: '
Vas a eliminar <strong>{count}</strong> línea | Vas a eliminar <strong>{count}</strong> línea |
Vas a eliminar <strong>{count}</strong> líneas' Vas a eliminar <strong>{count}</strong> líneas'

View File

@ -1,9 +1,12 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue'; import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute(); const route = useRoute();
const state = useState();
const user = state.getUser();
const $props = defineProps({ const $props = defineProps({
id: { type: [Number, String], default: null }, id: { type: [Number, String], default: null },
@ -12,26 +15,33 @@ const $props = defineProps({
const claimId = computed(() => $props.id || route.params.id); const claimId = computed(() => $props.id || route.params.id);
const claimFilter = { const claimFilter = {
fields: ['id', 'created', 'userFk', 'text'], fields: ['id', 'created', 'workerFk', 'text'],
include: { include: {
relation: 'user', relation: 'worker',
scope: { scope: {
fields: ['id', 'nickname', 'name'], fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
},
},
}, },
}, },
}; };
</script>
const body = {
claimFk: claimId.value,
workerFk: user.value.id,
};
</script>
<template> <template>
<VnNotes <VnNotes
url="claimObservations" url="claimObservations"
:go-to="`/claim/${route.params.id}/lines`"
:add-note="$props.addNote" :add-note="$props.addNote"
:user-filter="claimFilter" :user-filter="claimFilter"
:filter="{ where: { claimFk: claimId } }" :filter="{ where: { claimFk: claimId } }"
:body="{ :body="body"
claimFk: claimId,
}"
v-bind="$attrs" v-bind="$attrs"
style="overflow-y: auto" style="overflow-y: auto"
/> />

View File

@ -210,7 +210,7 @@ function onDrag() {
class="all-pointer-events absolute delete-button zindex" class="all-pointer-events absolute delete-button zindex"
@click.stop="viewDeleteDms(index)" @click.stop="viewDeleteDms(index)"
round round
:data-cy="`delete-button-${index + 1}`" :data-cy="`delete-button-${index+1}`"
/> />
<QIcon <QIcon
name="play_circle" name="play_circle"
@ -228,7 +228,7 @@ function onDrag() {
class="rounded-borders cursor-pointer fit" class="rounded-borders cursor-pointer fit"
@click="openDialog(media.dmsFk)" @click="openDialog(media.dmsFk)"
v-if="!media.isVideo" v-if="!media.isVideo"
:data-cy="`file-${index + 1}`" :data-cy="`file-${index+1}`"
> >
</QImg> </QImg>
<video <video
@ -237,7 +237,7 @@ function onDrag() {
muted="muted" muted="muted"
v-if="media.isVideo" v-if="media.isVideo"
@click="openDialog(media.dmsFk)" @click="openDialog(media.dmsFk)"
:data-cy="`file-${index + 1}`" :data-cy="`file-${index+1}`"
/> />
</QCard> </QCard>
</div> </div>

View File

@ -54,7 +54,7 @@ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
label: 'claim.item', label: 'claim.item',
field: (row) => dashIfEmpty(row.sale.itemFk), field: (row) => row.sale.itemFk,
sortable: true, sortable: true,
}, },
{ {
@ -67,13 +67,13 @@ const detailsColumns = ref([
{ {
name: 'quantity', name: 'quantity',
label: 'claim.quantity', label: 'claim.quantity',
field: (row) => dashIfEmpty(row.sale.quantity), field: (row) => row.sale.quantity,
sortable: true, sortable: true,
}, },
{ {
name: 'claimed', name: 'claimed',
label: 'claim.claimed', label: 'claim.claimed',
field: (row) => dashIfEmpty(row.quantity), field: (row) => row.quantity,
sortable: true, sortable: true,
}, },
{ {
@ -84,7 +84,7 @@ const detailsColumns = ref([
{ {
name: 'price', name: 'price',
label: 'claim.price', label: 'claim.price',
field: (row) => dashIfEmpty(row.sale.price), field: (row) => row.sale.price,
sortable: true, sortable: true,
}, },
{ {
@ -337,16 +337,23 @@ function claimUrl(section) {
</QTh> </QTh>
</QTr> </QTr>
</template> </template>
<template #body-cell-description="props"> <template #body="props">
<QTd :props="props"> <QTr :props="props">
<span class="link"> <QTd v-for="col in props.cols" :key="col.name" :props="props">
{{ props.value }} <template v-if="col.name === 'description'">
</span> <span class="link">{{
<ItemDescriptorProxy dashIfEmpty(col.field(props.row))
:id="props.row.sale.itemFk" }}</span>
:sale-fk="props.row.saleFk" <ItemDescriptorProxy
/> :id="props.row.sale.itemFk"
</QTd> :sale-fk="props.row.saleFk"
/>
</template>
<template v-else>
{{ dashIfEmpty(col.field(props.row)) }}
</template>
</QTd>
</QTr>
</template> </template>
</QTable> </QTable>
</QCard> </QCard>

View File

@ -27,7 +27,7 @@ describe('ClaimDescriptorMenu', () => {
await vm.remove(); await vm.remove();
expect(vm.quasar.notify).toHaveBeenCalledWith( expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({ type: 'positive' }), expect.objectContaining({ type: 'positive' })
); );
}); });
}); });

View File

@ -17,7 +17,6 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
const arrayData = useArrayData('Customer'); const arrayData = useArrayData('Customer');
const { t } = useI18n(); const { t } = useI18n();
@ -51,7 +50,7 @@ const columns = computed(() => [
label: t('globals.ticket'), label: t('globals.ticket'),
cardVisible: true, cardVisible: true,
columnFilter: { columnFilter: {
name: 'ticketId', inWhere: true,
}, },
}, },
{ {
@ -85,19 +84,25 @@ const columns = computed(() => [
label: t('globals.description'), label: t('globals.description'),
columnClass: 'expand', columnClass: 'expand',
columnFilter: { columnFilter: {
name: 'description', inWhere: true,
}, },
}, },
{ {
name: 'quantity', name: 'quantity',
label: t('globals.quantity'), label: t('globals.quantity'),
cardVisible: true, cardVisible: true,
visible: true, visible: true,
columnFilter: false columnFilter: {
inWhere: true,
},
},
{
name: 'grouped',
label: t('Group by items'),
component: 'checkbox',
visible: false,
orderBy: false,
}, },
]); ]);
onBeforeMount(async () => { onBeforeMount(async () => {
@ -165,6 +170,7 @@ const updateDateParams = (value, params) => {
v-if="campaignList" v-if="campaignList"
data-key="CustomerConsumption" data-key="CustomerConsumption"
url="Clients/consumption" url="Clients/consumption"
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
:filter="{ where: { clientFk: route.params.id } }" :filter="{ where: { clientFk: route.params.id } }"
:columns="columns" :columns="columns"
search-url="consumption" search-url="consumption"
@ -212,9 +218,9 @@ const updateDateParams = (value, params) => {
<div v-if="row.subName" class="subName"> <div v-if="row.subName" class="subName">
{{ row.subName }} {{ row.subName }}
</div> </div>
<FetchedTags :item="row" :columns="6"/> <FetchedTags :item="row" />
</template> </template>
<template #moreFilterPanel="{ params, searchFn}"> <template #moreFilterPanel="{ params }">
<div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl"> <div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl">
<VnSelect <VnSelect
:filled="true" :filled="true"
@ -284,13 +290,6 @@ const updateDateParams = (value, params) => {
class="q-px-xs q-pt-none fit" class="q-px-xs q-pt-none fit"
dense dense
/> />
<VnCheckbox
v-model="params.grouped"
:label="t('Group by items')"
class="q-px-xs q-pt-none fit"
dense
@update:modelValue="() => searchFn()"
/>
</div> </div>
</template> </template>
</VnTable> </VnTable>

View File

@ -2,13 +2,12 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue'; import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
import CustomerCreditContractsCreate from '../components/CustomerCreditContractsCreate.vue'; import { toDate } from 'src/filters';
import VnLv from 'src/components/ui/VnLv.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -17,7 +16,6 @@ const quasar = useQuasar();
const vnPaginateRef = ref(null); const vnPaginateRef = ref(null);
const showQPageSticky = ref(true); const showQPageSticky = ref(true);
const showForm = ref();
const filter = { const filter = {
order: 'finished ASC, started DESC', order: 'finished ASC, started DESC',
@ -38,21 +36,25 @@ const fetch = (data) => {
data.forEach((element) => { data.forEach((element) => {
if (!element.finished) { if (!element.finished) {
showQPageSticky.value = false; showQPageSticky.value = false;
return;
} }
}); });
}; };
const toCustomerCreditContractsCreate = () => {
router.push({ name: 'CustomerCreditContractsCreate' });
};
const openDialog = (item) => { const openDialog = (item) => {
quasar.dialog({ quasar.dialog({
component: ModalCloseContract, component: ModalCloseContract,
componentProps: { componentProps: {
id: item.id, id: item.id,
promise: async () => { promise: updateData,
await updateData();
showQPageSticky.value = true;
},
}, },
}); });
updateData();
showQPageSticky.value = true;
}; };
const openViewCredit = (credit) => { const openViewCredit = (credit) => {
@ -64,14 +66,14 @@ const openViewCredit = (credit) => {
}); });
}; };
const updateData = async () => { const updateData = () => {
await vnPaginateRef.value?.fetch(); vnPaginateRef.value?.fetch();
}; };
</script> </script>
<template> <template>
<section class="row justify-center"> <div class="full-width flex justify-center">
<QCard class="q-pa-lg" style="width: 70%"> <QCard class="card-width q-pa-lg">
<VnPaginate <VnPaginate
:user-filter="filter" :user-filter="filter"
@on-fetch="fetch" @on-fetch="fetch"
@ -82,84 +84,100 @@ const updateData = async () => {
url="CreditClassifications" url="CreditClassifications"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div v-if="rows.length" class="q-gutter-y-md"> <div v-if="rows.length">
<QCard <QCard
v-for="(item, index) in rows" v-for="(item, index) in rows"
:key="index" :key="index"
:class="{ disabled: item.finished }" :class="{
'customer-card': true,
'q-mb-md': index < rows.length - 1,
'is-active': !item.finished,
}"
> >
<QCardSection <QCardSection
class="full-width" class="full-width flex justify-between q-py-none"
:class="{ 'row justify-between': $q.screen.gt.md }"
> >
<div class="width-state row no-wrap"> <div class="width-state flex">
<QIcon <div
:style="{ class="flex items-center cursor-pointer q-mr-md"
visibility: item.finished v-if="!item.finished"
? 'hidden'
: 'visible',
}"
@click.stop="openDialog(item)"
color="primary"
name="lock"
data-cy="closeBtn"
size="md"
class="fill-icon q-px-md"
> >
<QTooltip>{{ t('Close contract') }}</QTooltip> <QIcon
</QIcon> @click.stop="openDialog(item)"
color="primary"
name="lock"
size="md"
class="fill-icon"
>
<QTooltip>{{ t('Close contract') }}</QTooltip>
</QIcon>
</div>
<div class="column"> <div>
<VnLv <div class="flex q-mb-xs">
:label="t('Since')" <div class="q-mr-sm color-vn-label">
:value="toDate(item.started)" {{ t('Since') }}:
/> </div>
<VnLv <div class="text-weight-bold">
:label="t('To')" {{ toDate(item.started) }}
:value="toDate(item.finished)" </div>
/> </div>
<div class="flex">
<div class="q-mr-sm color-vn-label">
{{ t('To') }}:
</div>
<div class="text-weight-bold">
{{ toDate(item.finished) }}
</div>
</div>
</div> </div>
</div> </div>
<QSeparator vertical /> <QSeparator vertical />
<div class="column width-data"> <div class="width-data flex">
<div <div
class="column" class="full-width flex justify-between items-center"
v-if="item?.insurances.length" v-if="item?.insurances.length"
v-for="insurance in item.insurances"
:key="insurance.id"
> >
<div <div class="flex">
:class="{ <div class="color-vn-label q-mr-xs">
'row q-gutter-x-md': $q.screen.gt.sm, {{ t('Credit') }}:
}" </div>
class="q-mb-sm" <div class="text-weight-bold">
> {{ item.insurances[0].credit }}
<VnLv </div>
:label="t('Credit')" </div>
:value="toCurrency(insurance.credit)" <div class="flex">
/> <div class="color-vn-label q-mr-xs">
<VnLv {{ t('Grade') }}:
:label="t('Grade')" </div>
:value="dashIfEmpty(insurance.grade)" <div class="text-weight-bold">
/> {{ item.insurances[0].grade || '-' }}
<VnLv </div>
:label="t('Date')" </div>
:value="toDate(insurance.created)" <div class="flex">
/> <div class="color-vn-label q-mr-xs">
{{ t('Date') }}:
</div>
<div class="text-weight-bold">
{{ toDate(item.insurances[0].created) }}
</div>
</div>
<div class="flex items-center cursor-pointer">
<QIcon
@click.stop="openViewCredit(item)"
color="primary"
name="preview"
size="md"
>
<QTooltip>{{
t('View credits')
}}</QTooltip>
</QIcon>
</div> </div>
</div> </div>
</div> </div>
<QBtn
@click.stop="openViewCredit(item)"
icon="preview"
size="md"
:title="t('View credits')"
data-cy="viewBtn"
color="primary"
flat
/>
</QCardSection> </QCardSection>
</QCard> </QCard>
</div> </div>
@ -169,12 +187,11 @@ const updateData = async () => {
</template> </template>
</VnPaginate> </VnPaginate>
</QCard> </QCard>
</section> </div>
<QPageSticky :offset="[18, 18]" v-if="showQPageSticky"> <QPageSticky :offset="[18, 18]" v-if="showQPageSticky">
<QBtn <QBtn
data-cy="createBtn" @click.stop="toCustomerCreditContractsCreate()"
@click.stop="showForm = !showForm"
color="primary" color="primary"
fab fab
icon="add" icon="add"
@ -184,25 +201,24 @@ const updateData = async () => {
{{ t('New contract') }} {{ t('New contract') }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
<QDialog v-model="showForm">
<CustomerCreditContractsCreate @on-data-saved="updateData()" />
</QDialog>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.customer-card {
border: 2px solid var(--vn-light-gray);
border-radius: 10px;
padding: 10px;
display: flex;
justify-content: space-between;
}
.is-active {
background-color: var(--vn-light-gray);
}
.width-state { .width-state {
width: 30%; width: 30%;
} }
.width-data { .width-data {
width: 50%; width: 65%;
}
::v-deep(.label) {
margin-right: 5px;
}
::v-deep(.label)::after {
content: ':';
color: var(--vn-label-color);
} }
</style> </style>

View File

@ -1,93 +0,0 @@
<script setup>
import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { toCurrency, toDate } from 'src/filters';
import VnTable from 'src/components/VnTable/VnTable.vue';
import axios from 'axios';
const { t } = useI18n();
const route = useRoute();
const create = ref(null);
const tableRef = ref();
const columns = computed(() => [
{
align: 'left',
field: 'created',
format: ({ created }) => toDate(created),
label: t('Created'),
name: 'created',
create: true,
columnCreate: {
component: 'date',
},
},
{
align: 'left',
field: 'grade',
label: t('Grade'),
name: 'grade',
create: true,
},
{
align: 'left',
format: ({ credit }) => toCurrency(credit),
label: t('Credit'),
name: 'credit',
create: true,
},
]);
onBeforeMount(async () => {
const query = `CreditClassifications/findOne?filter=${encodeURIComponent(
JSON.stringify({
fields: ['finished'],
where: { id: route.params.creditId },
}),
)}`;
const { data } = await axios(query);
create.value = data.finished
? false
: {
urlCreate: 'CreditInsurances',
title: t('Create Insurance'),
onDataSaved: () => tableRef.value.reload(),
formInitialData: {
created: Date.vnNew(),
creditClassificationFk: route.params.creditId,
},
};
});
</script>
<template>
<VnTable
v-if="create != null"
url="CreditInsurances"
ref="tableRef"
data-key="creditInsurances"
:filter="{
where: {
creditClassificationFk: `${route.params.creditId}`,
},
order: 'created DESC',
}"
:columns="columns"
:right-search="false"
:is-editable="false"
:use-model="true"
:column-search="false"
:disable-option="{ card: true }"
:create
auto-load
/>
</template>
<i18n>
es:
Created: Fecha creación
Grade: Grade
Credit: Crédito
</i18n>

View File

@ -99,13 +99,7 @@ async function acceptPropagate({ isEqualizated }) {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput <VnInput :label="t('Street')" clearable v-model="data.street" required />
:label="t('Street')"
clearable
v-model="data.street"
:uppercase="true"
required
/>
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -117,6 +111,8 @@ async function acceptPropagate({ isEqualizated }) {
option-value="id" option-value="id"
v-model="data.sageTaxTypeFk" v-model="data.sageTaxTypeFk"
data-cy="sageTaxTypeFk" data-cy="sageTaxTypeFk"
:required="data.isTaxDataChecked"
:rules="[(val) => validations.required(data.isTaxDataChecked, val)]"
/> />
<VnSelect <VnSelect
:label="t('Sage transaction type')" :label="t('Sage transaction type')"
@ -126,6 +122,10 @@ async function acceptPropagate({ isEqualizated }) {
option-value="id" option-value="id"
data-cy="sageTransactionTypeFk" data-cy="sageTransactionTypeFk"
v-model="data.sageTransactionTypeFk" v-model="data.sageTransactionTypeFk"
:required="data.isTaxDataChecked"
:rules="[
(val) => validations.required(data.sageTransactionTypeFk, val),
]"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">

View File

@ -1,15 +1,12 @@
<script setup> <script setup>
import VnNotes from 'src/components/ui/VnNotes.vue'; import VnNotes from 'src/components/ui/VnNotes.vue';
import { useState } from 'src/composables/useState';
const state = useState();
const user = state.getUser();
</script> </script>
<template> <template>
<VnNotes <VnNotes
url="clientObservations" url="clientObservations"
:add-note="true" :add-note="true"
:filter="{ where: { clientFk: $route.params.id } }" :filter="{ where: { clientFk: $route.params.id } }"
:body="{ clientFk: $route.params.id, userFk: user.id }" :body="{ clientFk: $route.params.id }"
style="overflow-y: auto" style="overflow-y: auto"
:select-type="true" :select-type="true"
required required

View File

@ -50,11 +50,8 @@ const filterClientFindOne = {
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<QCheckbox <QCheckbox :label="t('Unpaid client')" v-model="data.unpaid"
:label="t('Unpaid client')" data-cy="UnpaidCheckBox" />
v-model="data.unpaid"
data-cy="UnpaidCheckBox"
/>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid"> <VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid">

View File

@ -76,7 +76,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'userFk', name: 'workerFk',
label: t('Author'), label: t('Author'),
tooltip: t('Worker who made the last observation'), tooltip: t('Worker who made the last observation'),
columnFilter: { columnFilter: {
@ -155,7 +155,7 @@ function exprBuilder(param, value) {
return { [`c.${param}`]: value }; return { [`c.${param}`]: value };
case 'payMethod': case 'payMethod':
return { [`c.payMethodFk`]: value }; return { [`c.payMethodFk`]: value };
case 'userFk': case 'workerFk':
return { [`co.${param}`]: value }; return { [`co.${param}`]: value };
case 'departmentFk': case 'departmentFk':
return { [`c.${param}`]: value }; return { [`c.${param}`]: value };
@ -229,10 +229,10 @@ function exprBuilder(param, value) {
<DepartmentDescriptorProxy :id="row.departmentFk" /> <DepartmentDescriptorProxy :id="row.departmentFk" />
</span> </span>
</template> </template>
<template #column-userFk="{ row }"> <template #column-workerFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.workerName }} {{ row.workerName }}
<WorkerDescriptorProxy :id="row.userFk" /> <WorkerDescriptorProxy :id="row.workerFk" />
</span> </span>
</template> </template>
</VnTable> </VnTable>

View File

@ -26,7 +26,6 @@ const columns = computed(() => [
url: 'Clients', url: 'Clients',
fields: ['id', 'socialName'], fields: ['id', 'socialName'],
optionLabel: 'socialName', optionLabel: 'socialName',
optionValue: 'socialName',
}, },
}, },
columnClass: 'expand', columnClass: 'expand',
@ -38,11 +37,8 @@ const columns = computed(() => [
name: 'city', name: 'city',
columnFilter: { columnFilter: {
component: 'select', component: 'select',
inWhere: true,
attrs: { attrs: {
url: 'Towns', url: 'Towns',
optionValue: 'name',
optionLabel: 'name',
}, },
}, },
cardVisible: true, cardVisible: true,
@ -98,7 +94,7 @@ const columns = computed(() => [
</VnSubToolbar> </VnSubToolbar>
<VnTable <VnTable
:data-key="dataKey" :data-key="dataKey"
url="Clients/extendedListFilter" url="Clients/filter"
:table="{ :table="{
'row-key': 'id', 'row-key': 'id',
selection: 'multiple', selection: 'multiple',

View File

@ -3,29 +3,44 @@ import { reactive, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
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';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const routeId = computed(() => route.params.id); const routeId = computed(() => route.params.id);
const router = useRouter();
const initialData = reactive({ const initialData = reactive({
started: Date.vnNew(), started: Date.vnNew(),
clientFk: routeId.value, clientFk: routeId.value,
}); });
const toCustomerCreditContracts = () => {
router.push({ name: 'CustomerCreditContracts' });
};
</script> </script>
<template> <template>
<FormModelPopup <FormModel
v-on="$attrs"
:form-initial-data="initialData" :form-initial-data="initialData"
:observe-form-changes="false" :observe-form-changes="false"
url-create="creditClassifications/createWithInsurance" url-create="creditClassifications/createWithInsurance"
@on-data-saved="toCustomerCreditContracts()"
> >
<template #form-inputs="{ data }"> <template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerCreditContracts"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }">
<VnRow> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
@ -48,7 +63,7 @@ const initialData = reactive({
</div> </div>
</VnRow> </VnRow>
</template> </template>
</FormModelPopup> </FormModel>
</template> </template>
<i18n> <i18n>

View File

@ -0,0 +1,63 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { toCurrency, toDate } from 'src/filters';
import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n();
const route = useRoute();
const filter = {
where: {
creditClassificationFk: `${route.params.creditId}`,
},
limit: 20,
};
const columns = computed(() => [
{
align: 'left',
field: 'created',
format: ({ created }) => toDate(created),
label: t('Created'),
name: 'created',
},
{
align: 'left',
field: 'grade',
label: t('Grade'),
name: 'grade',
},
{
align: 'left',
format: ({ credit }) => toCurrency(credit),
label: t('Credit'),
name: 'credit',
},
]);
</script>
<template>
<VnTable
url="CreditInsurances"
ref="tableRef"
data-key="creditInsurances"
:filter="filter"
:columns="columns"
:right-search="false"
:is-editable="false"
:use-model="true"
:column-search="false"
:disable-option="{ card: true }"
auto-load
></VnTable>
</template>
<i18n>
es:
Created: Fecha creación
Grade: Grade
Credit: Crédito
</i18n>

View File

@ -224,7 +224,7 @@ const toCustomerFileManagement = () => {
<QTooltip max-width="30rem"> <QTooltip max-width="30rem">
{{ {{
`${t( `${t(
'Allowed content types', 'Allowed content types'
)}: ${allowedContentTypes.join(', ')}` )}: ${allowedContentTypes.join(', ')}`
}} }}
</QTooltip> </QTooltip>

View File

@ -200,7 +200,7 @@ const toCustomerFileManagement = () => {
<QTooltip max-width="30rem"> <QTooltip max-width="30rem">
{{ {{
`${t( `${t(
'Allowed content types', 'Allowed content types'
)}: ${allowedContentTypes.join(', ')}` )}: ${allowedContentTypes.join(', ')}`
}} }}
</QTooltip> </QTooltip>

View File

@ -130,22 +130,20 @@ async function onDataSaved(formData, { id }) {
} }
} }
async function getSupplierClientReferences(data) { async function getSupplierClientReferences(value) {
if (!data) return (initialData.description = ''); if (!value) return (initialData.description = '');
const params = { bankAccount: data.compensationAccount }; const params = { bankAccount: value };
const { data: reference } = await axios(`Clients/getClientOrSupplierReference`, { const { data } = await axios(`Clients/getClientOrSupplierReference`, { params });
params, if (!data.clientId) {
}); initialData.description = t('Supplier Compensation Reference', {
if (reference.supplierId) { supplierId: data.supplierId,
data.description = t('Supplier Compensation Reference', { supplierName: data.supplierName,
supplierId: reference.supplierId,
supplierName: reference.supplierName,
}); });
return; return;
} }
data.description = t('Client Compensation Reference', { initialData.description = t('Client Compensation Reference', {
clientId: reference.clientId, clientId: data.clientId,
clientName: reference.clientName, clientName: data.clientName,
}); });
} }
@ -224,7 +222,6 @@ async function getAmountPaid() {
clearable clearable
v-model.number="data.amountPaid" v-model.number="data.amountPaid"
data-cy="paymentAmount" data-cy="paymentAmount"
:positive="false"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -254,7 +251,7 @@ async function getAmountPaid() {
:label="t('Compensation account')" :label="t('Compensation account')"
clearable clearable
v-model="data.compensationAccount" v-model="data.compensationAccount"
@blur="getSupplierClientReferences(data)" @blur="getSupplierClientReferences(data.compensationAccount)"
/> />
</VnRow> </VnRow>
</div> </div>
@ -290,9 +287,6 @@ async function getAmountPaid() {
</template> </template>
<i18n> <i18n>
en:
Supplier Compensation Reference: ({supplierId}) Ntro Proveedor {supplierName}
Client Compensation Reference: ({clientId}) Ntro Cliente {clientName}
es: es:
New payment: Añadir pago New payment: Añadir pago
Date: Fecha Date: Fecha

View File

@ -15,7 +15,7 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue'; import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import { getItemPackagingType } from '../composables/getItemPackagingType.js';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -161,6 +161,23 @@ const setShippedColor = (date) => {
}; };
const rowClick = ({ id }) => const rowClick = ({ id }) =>
window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank'); window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank');
const getItemPackagingType = (ticketSales) => {
if (!ticketSales?.length) return '-';
const packagingTypes = ticketSales.reduce((types, sale) => {
const { itemPackingTypeFk } = sale.item;
if (
!types.includes(itemPackingTypeFk) &&
(itemPackingTypeFk === 'H' || itemPackingTypeFk === 'V')
) {
types.push(itemPackingTypeFk);
}
return types;
}, []);
return dashIfEmpty(packagingTypes.join(', ') || '-');
};
</script> </script>
<template> <template>

View File

@ -1,36 +0,0 @@
import { describe, it, expect } from 'vitest';
import { getItemPackagingType } from '../getItemPackagingType';
describe('getItemPackagingType', () => {
it('should return "-" if ticketSales is null or undefined', () => {
expect(getItemPackagingType(null)).toBe('-');
expect(getItemPackagingType(undefined)).toBe('-');
});
it('should return "-" if ticketSales does not have a length property', () => {
const ticketSales = { someKey: 'someValue' }; // No tiene propiedad length
expect(getItemPackagingType(ticketSales)).toBe('-');
});
it('should return unique packaging types as a comma-separated string', () => {
const ticketSales = [
{ item: { itemPackingTypeFk: 'H' } },
{ item: { itemPackingTypeFk: 'V' } },
{ item: { itemPackingTypeFk: 'H' } },
];
expect(getItemPackagingType(ticketSales)).toBe('H, V');
});
it('should return unique packaging types as a comma-separated string', () => {
const ticketSales = [
{ item: { itemPackingTypeFk: 'H' } },
{ item: { itemPackingTypeFk: 'V' } },
{ item: { itemPackingTypeFk: 'H' } },
{ item: { itemPackingTypeFk: 'A' } },
];
expect(getItemPackagingType(ticketSales)).toBe('H, V, A');
});
it('should return "-" if ticketSales is an empty array', () => {
expect(getItemPackagingType([])).toBe('-');
});
});

View File

@ -13,4 +13,4 @@ export async function getClient(clientId, _filter = {}) {
}; };
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
return await axios.get('Clients', { params }); return await axios.get('Clients', { params });
} };

View File

@ -1,11 +0,0 @@
import { dashIfEmpty } from 'src/filters';
export function getItemPackagingType(ticketSales) {
if (!ticketSales?.length) return '-';
const packagingTypes = Array.from(
new Set(ticketSales.map(({ item: { itemPackingTypeFk } }) => itemPackingTypeFk)),
);
return dashIfEmpty(packagingTypes.join(', '));
}

View File

@ -123,4 +123,3 @@ customer:
ticketFk: Ticket Id ticketFk: Ticket Id
description: Description description: Description
quantity: Quantity quantity: Quantity
ticketId: Ticket

View File

@ -123,4 +123,3 @@ customer:
ticketFk: Id Ticket ticketFk: Id Ticket
description: Descripción description: Descripción
quantity: Cantidad quantity: Cantidad
ticketId: Ticket

View File

@ -0,0 +1,155 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
const { t } = useI18n();
const route = useRoute();
const defaultState = ref();
const states = ref();
const companies = ref([]);
const companiesRef = ref();
const warehouses = ref([]);
const warehousesRef = ref();
const deliveryNoteRef = ref({});
function setDefaultState(data) {
states.value = data;
defaultState.value = data.find((d) => d.state === 'RECIBIDO');
}
</script>
<template>
<FetchData
ref="companiesRef"
url="Companies"
:filter="{ fields: ['id', 'code'] }"
sort-by="code"
@on-fetch="(data) => (companies = data)"
auto-load
/>
<FetchData
ref="warehousesRef"
url="Warehouses"
:filter="{ fields: ['id', 'name'] }"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<FetchData
url="DeliveryNoteStates"
:filter="{ fields: ['id', 'state'] }"
@on-fetch="(data) => setDefaultState(data)"
auto-load
/>
<FormModel
ref="deliveryNoteRef"
model="DeliveryNote"
:url-update="`DeliveryNotes/${route.params.id}`"
auto-load
>
<template #form="{ data }">
<VnRow>
<VnSelectSupplier
:label="t('globals.supplier')"
v-model="data.supplierFk"
/>
<!-- v-model="defaultState" -->
<VnSelect
:label="t('globals.state')"
v-model="data.stateFk"
:options="states"
option-label="state"
option-value="id"
/>
</VnRow>
<VnRow>
<VnInput :label="t('globals.reference')" v-model="data.ref" clearable />
<VnInput
clearable
clear-icon="close"
:label="t('globals.amount')"
v-model="data.amount"
data-cy="deliveryNote-amount"
/>
</VnRow>
<VnRow>
<VnInputDate :label="t('globals.shipped')" v-model="data.shipped" />
<VnInputDate :label="t('globals.landed')" v-model="data.landed" />
</VnRow>
<VnRow>
<VnSelectWorker
:label="t('deliveryNote.supervisor')"
v-model="data.supervisorFk"
/>
<VnSelect
:label="t('globals.department')"
v-model="data.departmentFk"
url="Departments"
option-label="name"
option-value="id"
/>
</VnRow>
<VnRow>
<VnSelect
:label="t('globals.warehouse')"
v-model="data.warehouseFk"
:options="warehouses"
option-label="name"
option-value="id"
/>
<VnSelect
:label="t('globals.company')"
v-model="data.companyFk"
:options="companies"
option-label="code"
option-value="id"
/>
</VnRow>
<VnRow>
<VnInput
:label="t('deliveryNote.note')"
type="textarea"
v-model="data.note"
fill-input
/>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
en:
supplierFk: Supplier
es:
supplierFk: Proveedor
Expedition date: Fecha expedición
Operation date: Fecha operación
Document: Documento
Download file: Descargar archivo
Entry date: Fecha asiento
Accounted date: Fecha contable
Currency: Moneda
Company: Empresa
Edit document: Editar documento
Reference: Referencia
Type: Tipo
Description: Descripción
Generate identifier for original file: Generar identificador para archivo original
File: Fichero
Create document: Crear documento
Allowed content types: Tipos de archivo permitidos
The company can't be empty: La empresa no puede estar vacía
The warehouse can't be empty: El almacén no puede estar vacío
The DMS Type can't be empty: El dms no puede estar vacío
The description can't be empty: La descripción no puede estar vacía
The files can't be empty: Los archivos no pueden estar vacíos
</i18n>

Some files were not shown because too many files have changed in this diff Show More