0
0
Fork 0

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

This commit is contained in:
Alex Moreno 2024-08-14 10:49:11 +02:00
commit dae71dacfc
86 changed files with 1044 additions and 729 deletions

View File

@ -7,7 +7,7 @@ import { useQuasar } from 'quasar';
import PinnedModules from './PinnedModules.vue'; import PinnedModules from './PinnedModules.vue';
import UserPanel from 'components/UserPanel.vue'; import UserPanel from 'components/UserPanel.vue';
import VnBreadcrumbs from './common/VnBreadcrumbs.vue'; import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnAvatar from './ui/VnAvatar.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -72,22 +72,13 @@ const pinnedModulesRef = ref();
</QTooltip> </QTooltip>
<PinnedModules ref="pinnedModulesRef" /> <PinnedModules ref="pinnedModulesRef" />
</QBtn> </QBtn>
<QBtn <QBtn class="q-pa-none" rounded dense flat no-wrap id="user">
:class="{ 'q-pa-none': quasar.platform.is.mobile }" <VnAvatar
rounded :worker-id="user.id"
dense :title="user.name"
flat size="lg"
no-wrap color="transparent"
id="user" />
>
<QAvatar size="lg">
<VnImg
:id="user.id"
collection="user"
size="160x160"
:zoom-size="null"
/>
</QAvatar>
<QTooltip bottom> <QTooltip bottom>
{{ t('globals.userPanel') }} {{ t('globals.userPanel') }}
</QTooltip> </QTooltip>

View File

@ -11,8 +11,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { useClipboard } from 'src/composables/useClipboard'; import { useClipboard } from 'src/composables/useClipboard';
import VnImg from 'src/components/ui/VnImg.vue';
import { useRole } from 'src/composables/useRole'; import { useRole } from 'src/composables/useRole';
import VnAvatar from './ui/VnAvatar.vue';
const state = useState(); const state = useState();
const session = useSession(); const session = useSession();
@ -136,7 +136,7 @@ const isEmployee = computed(() => useRole().isEmployee());
@update:model-value="saveLanguage" @update:model-value="saveLanguage"
:label="t(`globals.lang['${userLocale}']`)" :label="t(`globals.lang['${userLocale}']`)"
icon="public" icon="public"
color="orange" color="primary"
false-value="es" false-value="es"
true-value="en" true-value="en"
/> />
@ -145,7 +145,7 @@ const isEmployee = computed(() => useRole().isEmployee());
@update:model-value="saveDarkMode" @update:model-value="saveDarkMode"
:label="t(`globals.darkMode`)" :label="t(`globals.darkMode`)"
checked-icon="dark_mode" checked-icon="dark_mode"
color="orange" color="primary"
unchecked-icon="light_mode" unchecked-icon="light_mode"
/> />
</div> </div>
@ -153,10 +153,20 @@ const isEmployee = computed(() => useRole().isEmployee());
<QSeparator vertical inset class="q-mx-lg" /> <QSeparator vertical inset class="q-mx-lg" />
<div class="col column items-center q-mb-sm"> <div class="col column items-center q-mb-sm">
<QAvatar size="80px"> <VnAvatar
<VnImg :id="user.id" collection="user" size="160x160" /> :worker-id="user.id"
</QAvatar> :title="user.name"
size="xxl"
color="transparent"
/>
<QBtn
v-if="isEmployee"
class="q-mt-sm q-px-md"
:to="`/worker/${user.id}`"
color="primary"
:label="t('My account')"
dense
/>
<div class="text-subtitle1 q-mt-md"> <div class="text-subtitle1 q-mt-md">
<strong>{{ user.nickname }}</strong> <strong>{{ user.nickname }}</strong>
</div> </div>
@ -168,7 +178,7 @@ const isEmployee = computed(() => useRole().isEmployee());
</div> </div>
<QBtn <QBtn
id="logout" id="logout"
color="orange" color="primary"
flat flat
:label="t('globals.logOut')" :label="t('globals.logOut')"
size="sm" size="sm"
@ -260,3 +270,7 @@ const isEmployee = computed(() => useRole().isEmployee());
} }
} }
</style> </style>
<i18n>
es:
My account: Mi cuenta
</i18n>

View File

@ -151,7 +151,7 @@ const col = computed(() => {
}; };
} }
if ( if (
(newColumn.name.startsWith('is') || newColumn.name.startsWith('has')) && (/^is[A-Z]/.test(newColumn.name) || /^has[A-Z]/.test(newColumn.name)) &&
newColumn.component == null newColumn.component == null
) )
newColumn.component = 'checkbox'; newColumn.component = 'checkbox';

View File

@ -108,6 +108,8 @@ const CrudModelRef = ref({});
const showForm = ref(false); const showForm = ref(false);
const splittedColumns = ref({ columns: [] }); const splittedColumns = ref({ columns: [] });
const columnsVisibilitySkiped = ref(); const columnsVisibilitySkiped = ref();
const createForm = ref();
const tableModes = [ const tableModes = [
{ {
icon: 'view_column', icon: 'view_column',
@ -139,6 +141,14 @@ onMounted(() => {
.map((c) => c.name), .map((c) => c.name),
...['tableActions'], ...['tableActions'],
]; ];
createForm.value = $props.create;
if ($props.create && route?.query?.createForm) {
showForm.value = true;
createForm.value = {
...createForm.value,
...{ formInitialData: JSON.parse(route?.query?.createForm) },
};
}
}); });
watch( watch(
@ -154,16 +164,16 @@ watch(
const isTableMode = computed(() => mode.value == TABLE_MODE); const isTableMode = computed(() => mode.value == TABLE_MODE);
function setUserParams(watchedParams) { function setUserParams(watchedParams, watchedOrder) {
if (!watchedParams) return; if (!watchedParams) return;
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
const filter = const filter =
typeof watchedParams?.filter == 'string' typeof watchedParams?.filter == 'string'
? JSON.parse(watchedParams?.filter) ? JSON.parse(watchedParams?.filter ?? '{}')
: watchedParams?.filter; : watchedParams?.filter;
const where = filter?.where; const where = filter?.where;
const order = filter?.order; const order = watchedOrder ?? filter?.order;
watchedParams = { ...watchedParams, ...where }; watchedParams = { ...watchedParams, ...where };
delete watchedParams.filter; delete watchedParams.filter;
@ -615,14 +625,14 @@ defineExpose({
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2"> <QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" /> <QBtn @click="showForm = !showForm" color="primary" fab icon="add" />
<QTooltip> <QTooltip>
{{ create.title }} {{ createForm.title }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale"> <QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
<FormModelPopup <FormModelPopup
v-bind="create" v-bind="createForm"
:model="$attrs['data-key'] + 'Create'" :model="$attrs['data-key'] + 'Create'"
@on-data-saved="(_, res) => create.onDataSaved(res)" @on-data-saved="(_, res) => createForm.onDataSaved(res)"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<div class="grid-create"> <div class="grid-create">

View File

@ -65,7 +65,7 @@ async function fetchViewConfigData() {
const userConfig = await getConfig('UserConfigViews', { const userConfig = await getConfig('UserConfigViews', {
where: { where: {
...defaultFilter.where, ...defaultFilter.where,
...{ userFk: user.id }, ...{ userFk: user.value.id },
}, },
}); });

View File

@ -1,34 +0,0 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useCapitalize } from 'src/composables/useCapitalize';
import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({
modelValue: { type: [String, Number], default: '' },
});
const { t } = useI18n();
const emit = defineEmits(['update:modelValue']);
const amount = computed({
get() {
return props.modelValue;
},
set(val) {
emit('update:modelValue', val);
},
});
</script>
<template>
<VnInput
v-model="amount"
type="number"
step="any"
:label="useCapitalize(t('amount'))"
/>
</template>
<i18n>
es:
amount: importe
</i18n>

View File

@ -214,7 +214,7 @@ function getLogTree(data) {
} }
nLogs++; nLogs++;
modelLog.logs.push(log); modelLog.logs.push(log);
modelLog.summaryId = modelLog.logs[0].summaryId;
// Changes // Changes
const notDelete = log.action != 'delete'; const notDelete = log.action != 'delete';
const olds = (notDelete ? log.oldInstance : null) || {}; const olds = (notDelete ? log.oldInstance : null) || {};
@ -407,9 +407,12 @@ watch(
@on-fetch=" @on-fetch="
(data) => (data) =>
(actions = data.map((item) => { (actions = data.map((item) => {
const changedModel = item.changedModel;
return { return {
locale: useCapitalize(validations[item.changedModel].locale.name), locale: useCapitalize(
value: item.changedModel, validations[changedModel]?.locale?.name ?? changedModel
),
value: changedModel,
}; };
})) }))
" "
@ -472,12 +475,17 @@ watch(
> >
{{ t(modelLog.modelI18n) }} {{ t(modelLog.modelI18n) }}
</QChip> </QChip>
<span class="model-id" v-if="modelLog.summaryId"
>#{{ modelLog.summaryId }}</span <span
> class="model-id q-mr-xs"
<span class="model-value" :title="modelLog.showValue"> v-if="modelLog.summaryId"
{{ modelLog.showValue }} v-text="`#${modelLog.summaryId}`"
</span> />
<span
class="model-value"
:title="modelLog.showValue"
v-text="modelLog.showValue"
/>
<QBtn <QBtn
flat flat
round round

View File

@ -31,7 +31,7 @@ const dialog = ref(null);
<div class="container order-catalog-item overflow-hidden"> <div class="container order-catalog-item overflow-hidden">
<QCard class="card shadow-6"> <QCard class="card shadow-6">
<div class="img-wrapper"> <div class="img-wrapper">
<VnImg :id="item.id" zoom-size="lg" class="image" /> <VnImg :id="item.id" class="image" />
<div v-if="item.hex && isCatalog" class="item-color-container"> <div v-if="item.hex && isCatalog" class="item-color-container">
<div <div
class="item-color" class="item-color"

View File

@ -1,45 +1,62 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useColor } from 'src/composables/useColor'; import { useColor } from 'src/composables/useColor';
import { getCssVar } from 'quasar';
const $props = defineProps({ const $props = defineProps({
workerId: { type: Number, required: true }, workerId: { type: Number, required: true },
description: { type: String, default: null }, description: { type: String, default: null },
size: { type: String, default: null },
title: { type: String, default: null }, title: { type: String, default: null },
color: { type: String, default: null },
}); });
const { getTokenMultimedia } = useSession(); const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia(); const token = getTokenMultimedia();
const { t } = useI18n(); const { t } = useI18n();
const title = computed(() => $props.title ?? t('globals.system')); const src = computed(
() => `/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`
);
const title = computed(() => $props.title?.toUpperCase() || t('globals.system'));
const showLetter = ref(false); const showLetter = ref(false);
const backgroundColor = computed(() => {
const color = $props.color || useColor(title.value);
return getCssVar(color) || color;
});
watch(src, () => (showLetter.value = false));
</script> </script>
<template> <template>
<div class="avatar-picture column items-center"> <div class="column items-center">
<QAvatar <QAvatar
:style="{ :style="{ backgroundColor }"
backgroundColor: useColor(title), v-bind="$attrs"
}" :title="title || t('globals.system')"
:size="$props.size"
:title="title"
> >
<template v-if="showLetter">{{ title.charAt(0) }}</template> <template v-if="showLetter">
<QImg {{ title.charAt(0) }}
v-else </template>
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`" <QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
spinner-color="white"
@error="showLetter = true"
/>
</QAvatar> </QAvatar>
<div class="description"> <div class="description">
<slot name="description" v-if="$props.description"> <slot name="description" v-if="description">
<p> <p v-text="description" />
{{ $props.description }}
</p>
</slot> </slot>
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped>
[size='xxl'] {
.q-avatar,
.q-img {
width: 80px;
height: 80px;
}
.q-img {
object-fit: cover;
}
}
</style>

View File

@ -37,7 +37,7 @@ const $props = defineProps({
}, },
hiddenTags: { hiddenTags: {
type: Array, type: Array,
default: () => ['filter'], default: () => ['filter', 'search', 'or', 'and'],
}, },
customTags: { customTags: {
type: Array, type: Array,
@ -82,23 +82,26 @@ onMounted(() => {
}); });
function setUserParams(watchedParams) { function setUserParams(watchedParams) {
if (!watchedParams) return; if (!watchedParams || Object.keys(watchedParams).length == 0) return;
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
if (typeof watchedParams?.filter == 'string')
watchedParams.filter = JSON.parse(watchedParams.filter);
watchedParams = { ...watchedParams, ...watchedParams.filter?.where }; watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
const order = watchedParams.filter?.order;
delete watchedParams.filter; delete watchedParams.filter;
userParams.value = { ...userParams.value, ...watchedParams }; userParams.value = { ...userParams.value, ...sanitizer(watchedParams) };
emit('setUserParams', userParams.value); emit('setUserParams', userParams.value, order);
} }
watch( watch(
() => route.query[$props.searchUrl], () => [route.query[$props.searchUrl], arrayData.store.userParams],
(val) => setUserParams(val) ([newSearchUrl, newUserParams], [oldSearchUrl, oldUserParams]) => {
); if (newSearchUrl || oldSearchUrl) setUserParams(newSearchUrl);
if (newUserParams || oldUserParams) setUserParams(newUserParams);
watch( }
() => arrayData.store.userParams,
(val) => setUserParams(val)
); );
watch( watch(
@ -195,8 +198,10 @@ function formatValue(value) {
function sanitizer(params) { function sanitizer(params) {
for (const [key, value] of Object.entries(params)) { for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object') if (typeof value == 'object') {
params[key] = Object.values(value)[0].replaceAll('%', ''); const param = Object.values(value)[0];
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
}
} }
return params; return params;
} }

View File

@ -1,6 +1,8 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref } from 'vue';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import noImage from '/no-user.png';
import { useRole } from 'src/composables/useRole';
const $props = defineProps({ const $props = defineProps({
storage: { storage: {
@ -11,14 +13,17 @@ const $props = defineProps({
type: String, type: String,
default: 'catalog', default: 'catalog',
}, },
size: { resolution: {
type: String, type: String,
default: '200x200', default: '200x200',
}, },
zoomSize: { zoomResolution: {
type: String, type: String,
required: false, default: null,
default: 'lg', },
zoom: {
type: Boolean,
default: true,
}, },
id: { id: {
type: Number, type: Number,
@ -28,14 +33,16 @@ const $props = defineProps({
const show = ref(false); const show = ref(false);
const token = useSession().getTokenMultimedia(); const token = useSession().getTokenMultimedia();
const timeStamp = ref(`timestamp=${Date.now()}`); const timeStamp = ref(`timestamp=${Date.now()}`);
import noImage from '/no-user.png'; const isEmployee = useRole().isEmployee();
import { useRole } from 'src/composables/useRole';
const url = computed(() => { const getUrl = (zoom = false) => {
const isEmployee = useRole().isEmployee(); const curResolution = zoom
? $props.zoomResolution || $props.resolution
: $props.resolution;
return isEmployee return isEmployee
? `/api/${$props.storage}/${$props.collection}/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}` ? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
: noImage; : noImage;
}); };
const reload = () => { const reload = () => {
timeStamp.value = `timestamp=${Date.now()}`; timeStamp.value = `timestamp=${Date.now()}`;
}; };
@ -45,23 +52,21 @@ defineExpose({
</script> </script>
<template> <template>
<QImg <QImg
:class="{ zoomIn: $props.zoomSize }" :class="{ zoomIn: zoom }"
:src="url" :src="getUrl()"
v-bind="$attrs" v-bind="$attrs"
@click="show = !show" @click.stop="show = $props.zoom ? true : false"
spinner-color="primary" spinner-color="primary"
/> />
<QDialog v-model="show" v-if="$props.zoomSize"> <QDialog v-if="$props.zoom" v-model="show">
<QImg <QImg
:src="url" :src="getUrl(true)"
size="full"
class="img_zoom"
v-bind="$attrs" v-bind="$attrs"
spinner-color="primary" spinner-color="primary"
class="img_zoom"
/> />
</QDialog> </QDialog>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.q-img { .q-img {
&.zoomIn { &.zoomIn {

View File

@ -0,0 +1,32 @@
<script setup>
const emit = defineEmits(['submit']);
defineProps({
icon: { type: String, required: false, default: 'phonelink_lock' },
title: { type: String, required: true },
});
</script>
<template>
<QForm @submit="emit('submit')" class="q-gutter-y-md q-pa-lg formCard">
<div class="column items-center">
<QIcon v-if="icon != false" :name="icon" size="xl" color="primary" />
<h5 class="text-center q-my-md">
{{ title }}
</h5>
</div>
<slot></slot>
<div class="q-mt-lg">
<slot name="buttons"></slot>
</div>
</QForm>
</template>
<style lang="scss" scoped>
.formCard {
max-width: 350px;
min-width: 300px;
}
@media (max-width: $breakpoint-xs-max) {
.formCard {
min-width: 100%;
}
}
</style>

View File

@ -221,7 +221,7 @@ defineExpose({ fetch, addFilter, paginate });
> >
<slot name="body" :rows="store.data"></slot> <slot name="body" :rows="store.data"></slot>
<div v-if="isLoading" class="info-row q-pa-md text-center"> <div v-if="isLoading" class="info-row q-pa-md text-center">
<QSpinner color="orange" size="md" /> <QSpinner color="primary" size="md" />
</div> </div>
</QInfiniteScroll> </QInfiniteScroll>
</template> </template>

View File

@ -1,15 +1,12 @@
<script setup>
defineProps({ wrap: { type: Boolean, default: false } });
</script>
<template> <template>
<div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }"> <div class="vn-row q-gutter-md q-mb-md">
<slot></slot> <slot />
</div> </div>
</template> </template>
<style lang="scss" scopped> <style lang="scss" scoped>
.vn-row { .vn-row {
display: flex; display: flex;
> * { > :deep(*) {
flex: 1; flex: 1;
} }
} }

View File

@ -251,6 +251,9 @@ globals:
privileges: Privileges privileges: Privileges
ldap: LDAP ldap: LDAP
samba: Samba samba: Samba
twoFactor: Two factor
recoverPassword: Recover password
resetPassword: Reset password
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now
@ -262,6 +265,7 @@ globals:
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?
createInvoiceIn: Create invoice in
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred
@ -287,14 +291,17 @@ twoFactor:
explanation: >- explanation: >-
Please, enter the verification code that we have sent to your email in the Please, enter the verification code that we have sent to your email in the
next 5 minutes next 5 minutes
pageTitles:
twoFactor: Two-Factor
verifyEmail: verifyEmail:
pageTitles: pageTitles:
verifyEmail: Email verification verifyEmail: Email verification
dashboard: recoverPassword:
pageTitles: userOrEmail: User or recovery email
explanation: >-
We will sent you an email to recover your password
resetPassword:
repeatPassword: Repeat password
passwordNotMatch: Passwords don't match
passwordChanged: Password changed
customer: customer:
list: list:
phone: Phone phone: Phone

View File

@ -253,6 +253,9 @@ globals:
packages: Bultos packages: Bultos
ldap: LDAP ldap: LDAP
samba: Samba samba: Samba
twoFactor: Doble factor
recoverPassword: Recuperar contraseña
resetPassword: Restablecer contraseña
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora
@ -264,6 +267,8 @@ globals:
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?
createInvoiceIn: Crear factura recibida
errors: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor
@ -287,14 +292,17 @@ twoFactor:
validate: Validar validate: Validar
insert: Introduce el código de verificación insert: Introduce el código de verificación
explanation: Por favor introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos explanation: Por favor introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos
pageTitles:
twoFactor: Doble factor
verifyEmail: verifyEmail:
pageTitles: pageTitles:
verifyEmail: Verificación de correo verifyEmail: Verificación de correo
dashboard: recoverPassword:
pageTitles: userOrEmail: Usuario o correo de recuperación
explanation: >-
Te enviaremos un correo para restablecer tu contraseña
resetPassword:
repeatPassword: Repetir contraseña
passwordNotMatch: Las contraseñas no coinciden
passwordChanged: Contraseña cambiada
customer: customer:
list: list:
phone: Teléfono phone: Teléfono
@ -874,7 +882,7 @@ worker:
card: card:
workerId: ID Trabajador workerId: ID Trabajador
name: Nombre name: Nombre
email: Email email: Correo personal
phone: Teléfono phone: Teléfono
mobile: Móvil mobile: Móvil
active: Activo active: Activo

View File

@ -41,14 +41,12 @@ const columns = computed(() => [
name: 'id', name: 'id',
label: t('id'), label: t('id'),
isId: true, isId: true,
field: 'id',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
name: 'model', name: 'model',
label: t('model'), label: t('model'),
field: 'model',
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -56,15 +54,19 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'principalId', name: 'principalId',
label: t('principalId'), label: t('principalId'),
field: 'principalId',
cardVisible: true, cardVisible: true,
component: 'select',
attrs: {
url: 'VnRoles',
optionLabel: 'name',
optionValue: 'name',
},
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'property', name: 'property',
label: t('property'), label: t('property'),
field: 'property',
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -72,7 +74,10 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'accessType', name: 'accessType',
label: t('accessType'), label: t('accessType'),
field: 'accessType', component: 'select',
attrs: {
options: ['READ', 'WRITE', '*'],
},
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -118,13 +123,6 @@ const deleteAcl = async ({ id }) => {
</script> </script>
<template> <template>
<FetchData
url="VnRoles"
:filter="{ fields: ['name'], order: 'name ASC' }"
@on-fetch="(data) => (rolesOptions = data)"
auto-load
/>
<VnSearchbar <VnSearchbar
data-key="AccountAcls" data-key="AccountAcls"
url="ACLs" url="ACLs"
@ -147,7 +145,6 @@ const deleteAcl = async ({ id }) => {
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
:right-search="true" :right-search="true"
:is-editable="true" :is-editable="true"
:use-model="true" :use-model="true"
@ -162,4 +159,15 @@ es:
Are you sure you want to continue?: ¿Seguro que quieres continuar? Are you sure you want to continue?: ¿Seguro que quieres continuar?
Remove ACL: Eliminar Acl Remove ACL: Eliminar Acl
Do you want to remove this ACL?: ¿Quieres eliminar este ACL? Do you want to remove this ACL?: ¿Quieres eliminar este ACL?
principalId: Rol
model: Modelo
en:
New ACL: New ACL
ACL removed: ACL removed
ACL will be removed: ACL will be removed
Are you sure you want to continue?: Are you sure you want to continue?
Remove ACL: Remove ACL
Do you want to remove this ACL?: Do you want to remove this ACL?
principalId: Rol
model: Models
</i18n> </i18n>

View File

@ -60,7 +60,7 @@ const columns = computed(() => [
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountAliasList" data-key="AccountAliasList"
:url="`MailAliases`" url="MailAliases"
:create="{ :create="{
urlCreate: 'MailAliases', urlCreate: 'MailAliases',
title: 'Create MailAlias', title: 'Create MailAlias',
@ -70,7 +70,6 @@ const columns = computed(() => [
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
redirect="account/alias" redirect="account/alias"
:is-editable="true" :is-editable="true"
:use-model="true" :use-model="true"

View File

@ -48,6 +48,14 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'left',
name: 'email',
label: t('email'),
component: 'input',
create: true,
visible: false,
},
{ {
align: 'right', align: 'right',
label: '', label: '',
@ -83,9 +91,9 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
:label="t('account.search')"
data-key="AccountUsers" data-key="AccountUsers"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('account.search')"
:info="t('account.searchInfo')" :info="t('account.searchInfo')"
/> />
@ -96,7 +104,6 @@ const exprBuilder = (param, value) => {
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
redirect="account" redirect="account"
:use-model="true" :use-model="true"
/> />

View File

@ -1,22 +1,8 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import AliasDescriptor from './AliasDescriptor.vue'; import AliasDescriptor from './AliasDescriptor.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => {
return routeName.value;
});
const searchBarDataKeys = {
AliasBasicData: 'AliasBasicData',
AliasUsers: 'AliasUsers',
};
</script> </script>
<template> <template>
@ -24,12 +10,12 @@ const searchBarDataKeys = {
data-key="Alias" data-key="Alias"
base-url="MailAliases" base-url="MailAliases"
:descriptor="AliasDescriptor" :descriptor="AliasDescriptor"
:search-data-key="searchBarDataKeys[routeName]" search-data-key="AccountAliasList"
:searchbarProps="{ :searchbar-props="{
redirect: !!customRouteRedirectName, url: 'MailAliases',
customRouteRedirectName,
info: t('mailAlias.searchInfo'), info: t('mailAlias.searchInfo'),
label: t('mailAlias.search'), label: t('mailAlias.search'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -37,9 +37,11 @@ watch(
<VnInput v-model="data.nickname" :label="t('account.card.alias')" /> <VnInput v-model="data.nickname" :label="t('account.card.alias')" />
<VnInput v-model="data.email" :label="t('account.card.email')" /> <VnInput v-model="data.email" :label="t('account.card.email')" />
<VnSelect <VnSelect
url="Languages"
v-model="data.lang" v-model="data.lang"
:options="['es', 'en']"
:label="t('account.card.lang')" :label="t('account.card.lang')"
option-value="code"
option-label="code"
/> />
</div> </div>
</template> </template>

View File

@ -1,36 +1,21 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import AccountDescriptor from './AccountDescriptor.vue'; import AccountDescriptor from './AccountDescriptor.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => routeName.value);
const searchBarDataKeys = {
AccountSummary: 'AccountSummary',
AccountInheritedRoles: 'AccountInheritedRoles',
AccountMailForwarding: 'AccountMailForwarding',
AccountMailAlias: 'AccountMailAlias',
AccountPrivileges: 'AccountPrivileges',
AccountLog: 'AccountLog',
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Account" data-key="Account"
:descriptor="AccountDescriptor" :descriptor="AccountDescriptor"
:search-data-key="searchBarDataKeys[routeName]" search-data-key="AccountUsers"
:searchbarProps="{ :searchbar-props="{
redirect: !!customRouteRedirectName, url: 'VnUsers/preview',
customRouteRedirectName,
label: t('account.search'), label: t('account.search'),
info: t('account.searchInfo'), info: t('account.searchInfo'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -54,7 +54,7 @@ const hasAccount = ref(false);
</template> </template>
<template #before> <template #before>
<!-- falla id :id="entityId.value" collection="user" size="160x160" --> <!-- falla id :id="entityId.value" collection="user" size="160x160" -->
<VnImg :id="entityId" collection="user" size="160x160" class="photo"> <VnImg :id="entityId" collection="user" resolution="160x160" class="photo">
<template #error> <template #error>
<div <div
class="absolute-full picture text-center q-pa-md flex flex-center" class="absolute-full picture text-center q-pa-md flex flex-center"

View File

@ -82,6 +82,54 @@ const removeAccount = async () => {
}; };
</script> </script>
<template> <template>
<VnConfirm
v-model="showSyncDialog"
:message="t('account.card.actions.sync.message')"
:title="t('account.card.actions.sync.title')"
:promise="sync"
>
<template #customHTML>
{{ shouldSyncPassword }}
<QCheckbox
:label="t('account.card.actions.sync.checkbox')"
v-model="shouldSyncPassword"
class="full-width"
clearable
clear-icon="close"
>
<QIcon style="padding-left: 10px" color="primary" name="info" size="sm">
<QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip>
</QIcon></QCheckbox
>
<QInput
v-if="shouldSyncPassword"
:label="t('login.password')"
v-model="syncPassword"
class="full-width"
clearable
clear-icon="close"
type="password"
/>
</template>
</VnConfirm>
<!-- <QItem v-ripple clickable @click="setPassword">
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
</QItem>
<QItem
v-if="!account.hasAccount"
v-ripple
clickable
@click="
openConfirmationModal(
t('account.card.actions.enableAccount.title'),
t('account.card.actions.enableAccount.subtitle'),
() => updateStatusAccount(true)
)
"
>
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
</QItem> -->
<QItem <QItem
v-if="account.hasAccount" v-if="account.hasAccount"
v-ripple v-ripple

View File

@ -14,16 +14,11 @@ const rolesOptions = ref([]);
const formModelRef = ref(); const formModelRef = ref();
</script> </script>
<template> <template>
<FetchData <FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
url="VnRoles"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (rolesOptions = data)"
/>
<FormModel <FormModel
ref="formModelRef" ref="formModelRef"
model="AccountPrivileges" model="AccountPrivileges"
:url="`VnUsers/${route.params.id}`" :url="`VnUsers/${route.params.id}/privileges`"
:url-create="`VnUsers/${route.params.id}/privileges`" :url-create="`VnUsers/${route.params.id}/privileges`"
auto-load auto-load
@on-data-saved="formModelRef.fetch()" @on-data-saved="formModelRef.fetch()"

View File

@ -5,6 +5,8 @@ import VnTable from 'components/VnTable/VnTable.vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RoleSummary from './Card/RoleSummary.vue';
const route = useRoute(); const route = useRoute();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -16,7 +18,7 @@ const $props = defineProps({
}); });
const tableRef = ref(); const tableRef = ref();
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const { viewSummary } = useSummaryDialog();
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -42,6 +44,18 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('View Summary'),
icon: 'preview',
action: (row) => viewSummary(row.id, RoleSummary),
},
],
},
]); ]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -62,16 +76,12 @@ const exprBuilder = (param, value) => {
</script> </script>
<template> <template>
<template v-if="stateStore.isHeaderMounted()"> <VnSearchbar
<Teleport to="#searchbar"> data-key="Roles"
<VnSearchbar :expr-builder="exprBuilder"
data-key="Roles" :label="t('role.searchRoles')"
:expr-builder="exprBuilder" :info="t('role.searchInfo')"
:label="t('role.searchRoles')" />
:info="t('role.searchInfo')"
/>
</Teleport>
</template>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Roles" data-key="Roles"
@ -87,8 +97,6 @@ const exprBuilder = (param, value) => {
order="id ASC" order="id ASC"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
auto-load
redirect="account/role" redirect="account/role"
:is-editable="true"
/> />
</template> </template>

View File

@ -23,11 +23,6 @@ const { t } = useI18n();
/> />
</div> </div>
</VnRow> </VnRow>
<VnRow>
<div class="col">
<QCheckbox :label="t('mailAlias.isPublic')" v-model="data.isPublic" />
</div>
</VnRow>
</template> </template>
</FormModel> </FormModel>
</template> </template>

View File

@ -1,33 +1,20 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import RoleDescriptor from './RoleDescriptor.vue'; import RoleDescriptor from './RoleDescriptor.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const routeName = computed(() => route.name);
const customRouteRedirectName = computed(() => routeName.value);
const searchBarDataKeys = {
RoleSummary: 'RoleSummary',
RoleBasicData: 'RoleBasicData',
SubRoles: 'SubRoles',
InheritedRoles: 'InheritedRoles',
RoleLog: 'RoleLog',
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Role" data-key="Role"
:descriptor="RoleDescriptor" :descriptor="RoleDescriptor"
:search-data-key="searchBarDataKeys[routeName]" search-data-key="AccountRoles"
:searchbarProps="{ :searchbar-props="{
redirect: !!customRouteRedirectName, url: 'VnRoles',
customRouteRedirectName,
label: t('role.searchRoles'), label: t('role.searchRoles'),
info: t('role.searchInfo'), info: t('role.searchInfo'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -10,13 +10,10 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios'; import axios from 'axios';
// import { useSession } from 'src/composables/useSession'; import VnAvatar from 'src/components/ui/VnAvatar.vue';
import VnImg from 'src/components/ui/VnImg.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
// const { getTokenMultimedia } = useSession();
// const token = getTokenMultimedia();
const claimStates = ref([]); const claimStates = ref([]);
const claimStatesCopy = ref([]); const claimStatesCopy = ref([]);
@ -94,15 +91,14 @@ const statesFilter = {
:rules="validate('claim.claimStateFk')" :rules="validate('claim.claimStateFk')"
> >
<template #before> <template #before>
<QAvatar color="orange"> <VnAvatar
<VnImg :worker-id="data.workerFk"
v-if="data.workerFk" size="md"
:size="'160x160'" :title="
:id="data.workerFk" workersOptions.find(({ id }) => id == data.workerFk)?.name
collection="user" "
spinner-color="white" color="primary"
/> />
</QAvatar>
</template> </template>
</VnSelect> </VnSelect>
<QSelect <QSelect

View File

@ -12,7 +12,7 @@ import filter from './ClaimFilter.js';
:filter-panel="ClaimFilter" :filter-panel="ClaimFilter"
search-data-key="ClaimList" search-data-key="ClaimList"
:filter="filter" :filter="filter"
:searchbarProps="{ :searchbar-props="{
url: 'Claims/filter', url: 'Claims/filter',
label: 'Search claim', label: 'Search claim',
info: 'You can search by claim id or customer name', info: 'You can search by claim id or customer name',

View File

@ -7,14 +7,15 @@ import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnImg from 'src/components/ui/VnImg.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const businessTypes = ref([]); const businessTypes = ref([]);
const contactChannels = ref([]); const contactChannels = ref([]);
const title = ref();
</script> </script>
<template> <template>
<FetchData <FetchData
@ -95,16 +96,15 @@ const contactChannels = ref([]);
:label="t('customer.basicData.salesPerson')" :label="t('customer.basicData.salesPerson')"
:rules="validate('client.salesPersonFk')" :rules="validate('client.salesPersonFk')"
:use-like="false" :use-like="false"
:emit-value="false"
@update:model-value="(val) => (title = val?.nickname)"
> >
<template #prepend> <template #prepend>
<QAvatar color="orange"> <VnAvatar
<VnImg :worker-id="data.salesPersonFk"
v-if="data.salesPersonFk" color="primary"
:id="data.salesPersonFk" :title="title"
collection="user" />
spinner-color="white"
/>
</QAvatar>
</template> </template>
</VnSelect> </VnSelect>
<QSelect <QSelect

View File

@ -10,7 +10,7 @@ import CustomerFilter from '../CustomerFilter.vue';
:descriptor="CustomerDescriptor" :descriptor="CustomerDescriptor"
:filter-panel="CustomerFilter" :filter-panel="CustomerFilter"
search-data-key="CustomerList" search-data-key="CustomerList"
:searchbarProps="{ :searchbar-props="{
url: 'Clients/extendedListFilter', url: 'Clients/extendedListFilter',
label: 'Search customer', label: 'Search customer',
info: 'You can search by customer id or name', info: 'You can search by customer id or name',

View File

@ -139,7 +139,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'TicketList', name: 'TicketList',
query: { params: JSON.stringify({ clientFk: entity.id }) }, query: { table: JSON.stringify({ clientFk: entity.id }) },
}" }"
size="md" size="md"
icon="vn:ticket" icon="vn:ticket"
@ -150,7 +150,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'InvoiceOutList', name: 'InvoiceOutList',
query: { params: JSON.stringify({ clientFk: entity.id }) }, query: { table: JSON.stringify({ clientFk: entity.id }) },
}" }"
size="md" size="md"
icon="vn:invoice-out" icon="vn:invoice-out"
@ -161,7 +161,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
<QBtn <QBtn
:to="{ :to="{
name: 'OrderCreate', name: 'OrderCreate',
query: { clientFk: entity.id }, query: { clientId: entity.id },
}" }"
size="md" size="md"
icon="vn:basketadd" icon="vn:basketadd"
@ -169,8 +169,19 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
> >
<QTooltip>{{ t('New order') }}</QTooltip> <QTooltip>{{ t('New order') }}</QTooltip>
</QBtn> </QBtn>
<QBtn size="md" icon="face" color="primary"> <QBtn
<!-- TODO:: Redirigir a la vista de usuario cuando exista --> :to="{
name: 'AccountList',
query: {
table: JSON.stringify({
filter: { where: { id: entity.id } },
}),
},
}"
size="md"
icon="face"
color="primary"
>
<QTooltip>{{ t('Go to user') }}</QTooltip> <QTooltip>{{ t('Go to user') }}</QTooltip>
</QBtn> </QBtn>
</QCardActions> </QCardActions>

View File

@ -3,7 +3,7 @@ import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -47,7 +47,11 @@ const props = defineProps({
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnCurrency v-model="params.amount" is-outlined /> <VnInputNumber
:label="t('Amount')"
v-model="params.amount"
is-outlined
/>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>

View File

@ -10,7 +10,7 @@ import EntryFilter from '../EntryFilter.vue';
:descriptor="EntryDescriptor" :descriptor="EntryDescriptor"
:filter-panel="EntryFilter" :filter-panel="EntryFilter"
search-data-key="EntryList" search-data-key="EntryList"
:searchbarProps="{ :searchbar-props="{
url: 'Entries/filter', url: 'Entries/filter',
label: 'Search entries', label: 'Search entries',
info: 'You can search by entry reference', info: 'You can search by entry reference',

View File

@ -130,8 +130,6 @@ onBeforeMount(async () => {
}); });
onBeforeRouteUpdate(async (to, from) => { onBeforeRouteUpdate(async (to, from) => {
invoiceInCorrection.correcting.length = 0;
invoiceInCorrection.corrected = null;
if (to.params.id !== from.params.id) { if (to.params.id !== from.params.id) {
await setInvoiceCorrection(to.params.id); await setInvoiceCorrection(to.params.id);
const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`); const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`);
@ -140,6 +138,8 @@ onBeforeRouteUpdate(async (to, from) => {
}); });
async function setInvoiceCorrection(id) { async function setInvoiceCorrection(id) {
invoiceInCorrection.correcting.length = 0;
invoiceInCorrection.corrected = null;
const { data: correctingData } = await axios.get('InvoiceInCorrections', { const { data: correctingData } = await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctingFk: id } } }, params: { filter: { where: { correctingFk: id } } },
}); });
@ -198,7 +198,6 @@ async function cloneInvoice() {
const isAdministrative = () => hasAny(['administrative']); const isAdministrative = () => hasAny(['administrative']);
const isAgricultural = () => { const isAgricultural = () => {
console.error(config);
if (!config.value) return false; if (!config.value) return false;
return ( return (
invoiceIn.value?.supplier?.sageFarmerWithholdingFk === invoiceIn.value?.supplier?.sageFarmerWithholdingFk ===

View File

@ -8,9 +8,10 @@ import { useArrayData } from 'src/composables/useArrayData';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const route = useRoute(); const route = useRoute();
const { notify } = useNotify(); const { notify } = useNotify();
@ -22,9 +23,6 @@ const rowsSelected = ref([]);
const banks = ref([]); const banks = ref([]);
const invoiceInFormRef = ref(); const invoiceInFormRef = ref();
const invoiceId = +route.params.id; const invoiceId = +route.params.id;
const placeholder = 'yyyy/mm/dd';
const filter = { where: { invoiceInFk: invoiceId } }; const filter = { where: { invoiceInFk: invoiceId } };
const columns = computed(() => [ const columns = computed(() => [
@ -104,42 +102,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
> >
<template #body-cell-duedate="{ row }"> <template #body-cell-duedate="{ row }">
<QTd> <QTd>
<QInput <VnInputDate v-model="row.dueDated" />
v-model="row.dueDated"
mask="date"
:placeholder="placeholder"
clearable
clear-icon="close"
>
<template #append>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
cover
transition-show="scale"
transition-hide="scale"
>
<QDate v-model="row.dueDated" landscape>
<div
class="row items-center justify-end q-gutter-sm"
>
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
v-close-popup
/>
<QBtn
:label="t('globals.confirm')"
color="primary"
flat
v-close-popup
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</QTd> </QTd>
</template> </template>
<template #body-cell-bank="{ row, col }"> <template #body-cell-bank="{ row, col }">
@ -164,7 +127,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
</template> </template>
<template #body-cell-amount="{ row }"> <template #body-cell-amount="{ row }">
<QTd> <QTd>
<VnCurrency <VnInputNumber
v-model="row.amount" v-model="row.amount"
:is-outlined="false" :is-outlined="false"
clearable clearable
@ -174,7 +137,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
</template> </template>
<template #body-cell-foreignvalue="{ row }"> <template #body-cell-foreignvalue="{ row }">
<QTd> <QTd>
<QInput <VnInputNumber
:class="{ :class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code), 'no-pointer-events': !isNotEuro(invoiceIn.currency.code),
}" }"
@ -207,51 +170,11 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QSeparator /> <QSeparator />
<QList> <QList>
<QItem> <QItem>
<QInput <VnInputDate
class="full-width" class="full-width"
:label="t('Date')" :label="t('Date')"
v-model="props.row.dueDated" v-model="props.row.dueDated"
mask="date" />
:placeholder="placeholder"
clearable
clear-icon="close"
>
<template #append>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
cover
transition-show="scale"
transition-hide="scale"
>
<QDate
v-model="props.row.dueDated"
landscape
>
<div
class="row items-center justify-end q-gutter-sm"
>
<QBtn
:label="
t('globals.cancel')
"
color="primary"
flat
v-close-popup
/>
<QBtn
:label="
t('globals.confirm')
"
color="primary"
flat
v-close-popup
/>
</div>
</QDate>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</QItem> </QItem>
<QItem> <QItem>
<VnSelect <VnSelect
@ -274,16 +197,14 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
</VnSelect> </VnSelect>
</QItem> </QItem>
<QItem> <QItem>
<QInput <VnInputNumber
:label="t('Amount')" :label="t('Amount')"
class="full-width" class="full-width"
v-model="props.row.amount" v-model="props.row.amount"
clearable
clear-icon="close"
/> />
</QItem> </QItem>
<QItem> <QItem>
<QInput <VnInputNumber
:label="t('Foreign value')" :label="t('Foreign value')"
class="full-width" class="full-width"
:class="{ :class="{

View File

@ -7,6 +7,7 @@ import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -115,11 +116,7 @@ const formatOpt = (row, { model, options }, prop) => {
> >
<template #body-cell="{ row, col }"> <template #body-cell="{ row, col }">
<QTd> <QTd>
<QInput <VnInputNumber v-model="row[col.name]" />
v-model="row[col.name]"
clearable
clear-icon="close"
/>
</QTd> </QTd>
</template> </template>
<template #body-cell-code="{ row, col }"> <template #body-cell-code="{ row, col }">
@ -203,7 +200,7 @@ const formatOpt = (row, { model, options }, prop) => {
]" ]"
:key="index" :key="index"
> >
<QInput <VnInputNumber
:label="t(value)" :label="t(value)"
class="full-width" class="full-width"
v-model="props.row[value]" v-model="props.row[value]"

View File

@ -120,7 +120,6 @@ const intrastatColumns = ref([
}, },
sortable: true, sortable: true,
align: 'left', align: 'left',
style: 'width: 10px',
}, },
{ {
name: 'amount', name: 'amount',
@ -128,7 +127,6 @@ const intrastatColumns = ref([
field: (row) => toCurrency(row.amount, currency.value), field: (row) => toCurrency(row.amount, currency.value),
sortable: true, sortable: true,
align: 'left', align: 'left',
style: 'width: 10px',
}, },
{ {
name: 'net', name: 'net',
@ -415,6 +413,11 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QTh> </QTh>
</QTr> </QTr>
</template> </template>
<template #body-cell-code="{ value: codeCell }">
<QTd :title="codeCell" shrink>
{{ codeCell }}
</QTd>
</template>
<template #bottom-row> <template #bottom-row>
<QTr class="bg"> <QTr class="bg">
<QTd></QTd> <QTd></QTd>

View File

@ -9,7 +9,8 @@ import { toCurrency } from 'src/filters';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import CrudModel from 'src/components/CrudModel.vue'; import CrudModel from 'src/components/CrudModel.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
@ -205,7 +206,7 @@ const formatOpt = (row, { model, options }, prop) => {
:grid="$q.screen.lt.sm" :grid="$q.screen.lt.sm"
> >
<template #body-cell-expense="{ row, col }"> <template #body-cell-expense="{ row, col }">
<QTd auto-width> <QTd>
<VnSelect <VnSelect
v-model="row[col.model]" v-model="row[col.model]"
:options="col.options" :options="col.options"
@ -223,6 +224,7 @@ const formatOpt = (row, { model, options }, prop) => {
name="close" name="close"
@click.stop="value = null" @click.stop="value = null"
class="cursor-pointer" class="cursor-pointer"
size="xs"
/> />
<QIcon <QIcon
@click.stop.prevent="newExpenseRef.show()" @click.stop.prevent="newExpenseRef.show()"
@ -240,7 +242,7 @@ const formatOpt = (row, { model, options }, prop) => {
</template> </template>
<template #body-cell-taxablebase="{ row }"> <template #body-cell-taxablebase="{ row }">
<QTd> <QTd>
<VnCurrency <VnInputNumber
:class="{ :class="{
'no-pointer-events': isNotEuro(invoiceIn.currency.code), 'no-pointer-events': isNotEuro(invoiceIn.currency.code),
}" }"
@ -308,7 +310,7 @@ const formatOpt = (row, { model, options }, prop) => {
</template> </template>
<template #body-cell-foreignvalue="{ row }"> <template #body-cell-foreignvalue="{ row }">
<QTd> <QTd>
<QInput <VnInputNumber
:class="{ :class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code), 'no-pointer-events': !isNotEuro(invoiceIn.currency.code),
}" }"
@ -356,7 +358,7 @@ const formatOpt = (row, { model, options }, prop) => {
</VnSelect> </VnSelect>
</QItem> </QItem>
<QItem> <QItem>
<VnCurrency <VnInputNumber
:label="t('Taxable base')" :label="t('Taxable base')"
:class="{ :class="{
'no-pointer-events': isNotEuro( 'no-pointer-events': isNotEuro(
@ -421,7 +423,7 @@ const formatOpt = (row, { model, options }, prop) => {
{{ toCurrency(taxRate(props.row), currency) }} {{ toCurrency(taxRate(props.row), currency) }}
</QItem> </QItem>
<QItem> <QItem>
<QInput <VnInputNumber
:label="t('Foreign value')" :label="t('Foreign value')"
class="full-width" class="full-width"
:class="{ :class="{
@ -453,7 +455,11 @@ const formatOpt = (row, { model, options }, prop) => {
</QCardSection> </QCardSection>
<QCardSection class="q-pt-none"> <QCardSection class="q-pt-none">
<QItem> <QItem>
<QInput :label="`${t('Code')}*`" v-model="newExpense.code" /> <VnInput
:label="`${t('Code')}*`"
v-model="newExpense.code"
:required="true"
/>
<QCheckbox <QCheckbox
dense dense
size="sm" size="sm"
@ -462,7 +468,7 @@ const formatOpt = (row, { model, options }, prop) => {
/> />
</QItem> </QItem>
<QItem> <QItem>
<QInput <VnInput
:label="`${t('Descripction')}*`" :label="`${t('Descripction')}*`"
v-model="newExpense.description" v-model="newExpense.description"
/> />

View File

@ -26,8 +26,7 @@ const newInvoiceIn = reactive({
companyFk: user.value.companyFk || null, companyFk: user.value.companyFk || null,
issued: Date.vnNew(), issued: Date.vnNew(),
}); });
const suppliersOptions = ref([]); const companies = ref([]);
const companiesOptions = ref([]);
const redirectToInvoiceInBasicData = (__, { id }) => { const redirectToInvoiceInBasicData = (__, { id }) => {
router.push({ name: 'InvoiceInBasicData', params: { id } }); router.push({ name: 'InvoiceInBasicData', params: { id } });
@ -35,19 +34,12 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
</script> </script>
<template> <template>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData <FetchData
ref="companiesRef" ref="companiesRef"
url="Companies" url="Companies"
:filter="{ fields: ['id', 'code'] }" :filter="{ fields: ['id', 'code'] }"
order="code" order="code"
@on-fetch="(data) => (companiesOptions = data)" @on-fetch="(data) => (companies = data)"
auto-load auto-load
/> />
<template v-if="stateStore.isHeaderMounted()"> <template v-if="stateStore.isHeaderMounted()">
@ -69,9 +61,10 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnSelect <VnSelect
url="Suppliers"
:fields="['id', 'nickname']"
:label="t('Supplier')" :label="t('Supplier')"
v-model="data.supplierFk" v-model="data.supplierFk"
:options="suppliersOptions"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
hide-selected hide-selected
@ -98,7 +91,7 @@ const redirectToInvoiceInBasicData = (__, { id }) => {
<VnSelect <VnSelect
:label="t('Company')" :label="t('Company')"
v-model="data.companyFk" v-model="data.companyFk"
:options="companiesOptions" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
map-options map-options

View File

@ -6,8 +6,8 @@ import VnSelect from 'components/common/VnSelect.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } }); defineProps({ dataKey: { type: String, required: true } });
@ -28,6 +28,22 @@ const activities = ref([]);
</div> </div>
</template> </template>
<template #body="{ params, searchFn }"> <template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnSelect
v-model="params.supplierFk"
url="Suppliers"
:fields="['id', 'nickname']"
:label="t('params.supplierFk')"
option-value="id"
option-label="nickname"
dense
outlined
rounded
:filter-options="['id', 'name']"
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -50,17 +66,30 @@ const activities = ref([]);
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnInput
v-model="params.supplierFk" :label="t('params.serialNumber')"
url="Suppliers" v-model="params.serialNumber"
:fields="['id', 'nickname']" is-outlined
:label="t('params.supplierFk')" lazy-rules
option-value="id" />
option-label="nickname" </QItemSection>
dense </QItem>
outlined <QItem>
rounded <QItemSection>
:filter-options="['id', 'name']" <VnInput
:label="t('params.serial')"
v-model="params.serial"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('Issued')"
v-model="params.issued"
is-outlined
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -76,39 +105,20 @@ const activities = ref([]);
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnCurrency v-model="params.amount" is-outlined /> <VnInput
</QItemSection> :label="t('params.awb')"
</QItem> v-model="params.awbCode"
<QItem>
<QItemSection>
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('Issued')"
v-model="params.issued"
is-outlined is-outlined
lazy-rules
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnInputNumber
:label="t('params.supplierActivityFk')" :label="t('Amount')"
v-model="params.supplierActivityFk" v-model="params.amount"
dense is-outlined
outlined
rounded
option-value="code"
option-label="name"
:options="activities"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -133,32 +143,16 @@ const activities = ref([]);
<QExpansionItem :label="t('More options')" expand-separator> <QExpansionItem :label="t('More options')" expand-separator>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInputDate
:label="t('params.serialNumber')" :label="t('From')"
v-model="params.serialNumber" v-model="params.from"
is-outlined is-outlined
lazy-rules
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInputDate :label="t('To')" v-model="params.to" is-outlined />
:label="t('params.serial')"
v-model="params.serial"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.awb')"
v-model="params.awbCode"
is-outlined
lazy-rules
/>
</QItemSection> </QItemSection>
</QItem> </QItem>
</QExpansionItem> </QExpansionItem>

View File

@ -1,18 +1,19 @@
<script setup> <script setup>
import { onMounted, onUnmounted } from 'vue'; import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { downloadFile } from 'src/composables/downloadFile'; import { downloadFile } from 'src/composables/downloadFile';
import { toDate, toCurrency } from 'src/filters/index'; import { toDate, toCurrency } from 'src/filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
import InvoiceInFilter from './InvoiceInFilter.vue'; import InvoiceInFilter from './InvoiceInFilter.vue';
import InvoiceInSummary from './Card/InvoiceInSummary.vue'; import InvoiceInSummary from './Card/InvoiceInSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceInSearchbar from 'src/pages/InvoiceIn/InvoiceInSearchbar.vue'; import InvoiceInSearchbar from 'src/pages/InvoiceIn/InvoiceInSearchbar.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -20,8 +21,91 @@ const { t } = useI18n();
onMounted(async () => (stateStore.rightDrawer = true)); onMounted(async () => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
</script>
const tableRef = ref();
const cols = computed(() => [
{
align: 'left',
name: 'id',
label: 'Id',
},
{
align: 'left',
name: 'supplierFk',
label: t('invoiceIn.list.supplier'),
columnFilter: {
component: 'select',
attrs: {
url: 'Suppliers',
fields: ['id', 'name'],
},
},
columnClass: 'expand',
},
{
align: 'left',
name: 'supplierRef',
label: t('invoiceIn.list.supplierRef'),
},
{
align: 'left',
name: 'serialNumber',
label: t('invoiceIn.list.serialNumber'),
},
{
align: 'left',
name: 'serial',
label: t('invoiceIn.list.serial'),
},
{
align: 'left',
label: t('invoiceIn.list.issued'),
name: 'issued',
component: null,
columnFilter: {
component: 'date',
},
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.issued)),
},
{
align: 'left',
name: 'isBooked',
label: t('invoiceIn.list.isBooked'),
columnFilter: false,
},
{
align: 'left',
name: 'awbCode',
label: t('invoiceIn.list.awb'),
},
{
align: 'left',
name: 'amount',
label: t('invoiceIn.list.amount'),
format: ({ amount }) => toCurrency(amount),
},
{
align: 'right',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.openSummary'),
icon: 'preview',
type: 'submit',
action: (row) => viewSummary(row.id, InvoiceInSummary),
},
{
title: t('globals.download'),
icon: 'download',
type: 'submit',
isPrimary: true,
action: (row) => downloadFile(row.dmsFk),
},
],
},
]);
</script>
<template> <template>
<InvoiceInSearchbar /> <InvoiceInSearchbar />
<RightMenu> <RightMenu>
@ -29,92 +113,63 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<InvoiceInFilter data-key="InvoiceInList" /> <InvoiceInFilter data-key="InvoiceInList" />
</template> </template>
</RightMenu> </RightMenu>
<QPage class="column items-center q-pa-md"> <VnTable
<div class="vn-card-list"> ref="tableRef"
<VnPaginate data-key="InvoiceInList"
data-key="InvoiceInList" url="InvoiceIns/filter"
url="InvoiceIns/filter" :order="['issued DESC', 'id DESC']"
order="issued DESC, id DESC" :create="{
auto-load urlCreate: 'InvoiceIns',
title: t('globals.createInvoiceIn'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {},
}"
redirect="invoice-in"
:columns="cols"
:right-search="false"
:disable-option="{ card: true }"
:auto-load="!!$route.query.params"
>
<template #column-supplierFk="{ row }">
<span class="link" @click.stop>
{{ row.supplierName }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
v-model="data.supplierFk"
url="Suppliers"
:fields="['id', 'nickname']"
:label="t('Supplier')"
option-value="id"
option-label="nickname"
:filter-options="['id', 'name']"
:required="true"
> >
<template #body="{ rows }"> <template #option="scope">
<CardList <QItem v-bind="scope.itemProps">
v-for="(row, index) of rows" <QItemSection>
:key="index" <QItemLabel>{{ scope.opt?.nickname }}</QItemLabel>
:title="row.supplierRef" <QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
@click="$router.push({ path: `/invoice-in/${row.id}` })" </QItemSection>
:id="row.id" </QItem>
>
<template #list-items>
<VnLv
:label="t('invoiceIn.list.supplierRef')"
:value="row.supplierRef"
/>
<VnLv
:label="t('invoiceIn.list.supplier')"
:value="row.supplierName"
@click.stop
>
<template #value>
<span class="link">
{{ row.supplierName }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
</VnLv>
<VnLv
:label="t('invoiceIn.list.serialNumber')"
:value="row.serialNumber"
/>
<VnLv
:label="t('invoiceIn.list.serial')"
:value="row.serial"
/>
<VnLv
:label="t('invoiceIn.list.issued')"
:value="toDate(row.issued)"
/>
<VnLv :label="t('invoiceIn.list.awb')" :value="row.awbCode" />
<VnLv
:label="t('invoiceIn.list.amount')"
:value="toCurrency(row.amount)"
/>
<VnLv
:label="t('invoiceIn.list.isBooked')"
:value="!!row.isBooked"
/>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="
$router.push({ path: `/invoice-in/${row.id}` })
"
outline
type="reset"
/>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, InvoiceInSummary)"
color="primary"
type="submit"
class="q-mt-sm"
/>
<QBtn
:label="t('globals.download')"
class="q-mt-sm"
@click.stop="downloadFile(row.dmsFk)"
type="submit"
color="primary"
/>
</template>
</CardList>
</template> </template>
</VnPaginate> </VnSelect>
</div> <VnInput
</QPage> :label="t('invoiceIn.summary.supplierRef')"
<QPageSticky position="bottom-right" :offset="[20, 20]"> v-model="data.supplierRef"
<QBtn color="primary" icon="add" size="lg" round :href="`/#/invoice-in/create`" /> />
</QPageSticky> <VnSelect
url="Companies"
:label="t('Company')"
:fields="['id', 'code']"
v-model="data.companyFk"
option-value="id"
option-label="code"
:required="true"
/>
<VnInputDate :label="t('invoiceIn.summary.issued')" v-model="data.issued" />
</template>
</VnTable>
</template> </template>

View File

@ -10,7 +10,7 @@ import InvoiceOutFilter from '../InvoiceOutFilter.vue';
:descriptor="InvoiceOutDescriptor" :descriptor="InvoiceOutDescriptor"
:filter-panel="InvoiceOutFilter" :filter-panel="InvoiceOutFilter"
search-data-key="InvoiceOutList" search-data-key="InvoiceOutList"
:searchbarProps="{ :searchbar-props="{
url: 'InvoiceOuts/filter', url: 'InvoiceOuts/filter',
label: 'Search invoice', label: 'Search invoice',
info: 'You can search by invoice reference', info: 'You can search by invoice reference',

View File

@ -6,7 +6,7 @@ import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -58,7 +58,7 @@ function setWorkers(data) {
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnCurrency <VnInputNumber
:label="t('Amount')" :label="t('Amount')"
v-model="params.amount" v-model="params.amount"
is-outlined is-outlined

View File

@ -64,7 +64,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'clientSocialName', name: 'clientFk',
label: t('invoiceOutModule.customer'), label: t('invoiceOutModule.customer'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
@ -215,7 +215,7 @@ watchEffect(selectedRows);
selection: 'multiple', selection: 'multiple',
}" }"
> >
<template #column-clientSocialName="{ row }"> <template #column-clientFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.clientSocialName }} {{ row.clientSocialName }}
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -86,7 +86,7 @@ const props = defineProps({
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnCurrency <VnInputNumber
v-model="params.amount" v-model="params.amount"
:label="t('invoiceOut.negativeBases.amount')" :label="t('invoiceOut.negativeBases.amount')"
is-outlined is-outlined

View File

@ -36,15 +36,6 @@ const onIntrastatCreated = (response, formData) => {
@on-fetch="(data) => (itemTypesOptions = data)" @on-fetch="(data) => (itemTypesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Items/withName"
:filter="{
fields: ['id', 'name'],
order: 'id DESC',
}"
@on-fetch="(data) => (itemsWithNameOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Intrastats" url="Intrastats"
:filter="{ :filter="{
@ -73,7 +64,7 @@ const onIntrastatCreated = (response, formData) => {
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnSelect <VnSelect
:label="t('basicData.type')" :label="t('itemBasicData.type')"
v-model="data.typeFk" v-model="data.typeFk"
:options="itemTypesOptions" :options="itemTypesOptions"
option-value="id" option-value="id"
@ -92,19 +83,21 @@ const onIntrastatCreated = (response, formData) => {
</QItem> </QItem>
</template> </template>
</VnSelect> </VnSelect>
<VnInput :label="t('basicData.reference')" v-model="data.comment" /> <VnInput :label="t('itemBasicData.reference')" v-model="data.comment" />
<VnInput :label="t('basicData.relevancy')" v-model="data.relevancy" /> <VnInput :label="t('itemBasicData.relevancy')" v-model="data.relevancy" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput :label="t('basicData.stems')" v-model="data.stems" /> <VnInput :label="t('itemBasicData.stems')" v-model="data.stems" />
<VnInput <VnInput
:label="t('basicData.multiplier')" :label="t('itemBasicData.multiplier')"
v-model="data.stemMultiplier" v-model="data.stemMultiplier"
/> />
<VnSelectDialog <VnSelectDialog
:label="t('basicData.generic')" :label="t('itemBasicData.generic')"
v-model="data.genericFk" v-model="data.genericFk"
:options="itemsWithNameOptions" url="Items/withName"
:fields="['id', 'name']"
sort-by="id DESC"
option-value="id" option-value="id"
option-label="name" option-label="name"
map-options map-options
@ -129,7 +122,7 @@ const onIntrastatCreated = (response, formData) => {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelectDialog <VnSelectDialog
:label="t('basicData.intrastat')" :label="t('itemBasicData.intrastat')"
v-model="data.intrastatFk" v-model="data.intrastatFk"
:options="intrastatsOptions" :options="intrastatsOptions"
option-value="id" option-value="id"
@ -156,7 +149,7 @@ const onIntrastatCreated = (response, formData) => {
</VnSelectDialog> </VnSelectDialog>
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('basicData.expense')" :label="t('itemBasicData.expense')"
v-model="data.expenseFk" v-model="data.expenseFk"
:options="expensesOptions" :options="expensesOptions"
option-value="id" option-value="id"
@ -168,61 +161,64 @@ const onIntrastatCreated = (response, formData) => {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput <VnInput
:label="t('basicData.weightByPiece')" :label="t('itemBasicData.weightByPiece')"
v-model.number="data.weightByPiece" v-model.number="data.weightByPiece"
:min="0" :min="0"
type="number" type="number"
/> />
<VnInput <VnInput
:label="t('basicData.boxUnits')" :label="t('itemBasicData.boxUnits')"
v-model.number="data.packingOut" v-model.number="data.packingOut"
:min="0" :min="0"
type="number" type="number"
/> />
<VnInput <VnInput
:label="t('basicData.recycledPlastic')" :label="t('itemBasicData.recycledPlastic')"
v-model.number="data.recycledPlastic" v-model.number="data.recycledPlastic"
:min="0" :min="0"
type="number" type="number"
/> />
<VnInput <VnInput
:label="t('basicData.nonRecycledPlastic')" :label="t('itemBasicData.nonRecycledPlastic')"
v-model.number="data.nonRecycledPlastic" v-model.number="data.nonRecycledPlastic"
:min="0" :min="0"
type="number" type="number"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox v-model="data.isActive" :label="t('basicData.isActive')" /> <QCheckbox v-model="data.isActive" :label="t('itemBasicData.isActive')" />
<QCheckbox v-model="data.hasKgPrice" :label="t('basicData.hasKgPrice')" /> <QCheckbox
v-model="data.hasKgPrice"
:label="t('itemBasicData.hasKgPrice')"
/>
<div> <div>
<QCheckbox <QCheckbox
v-model="data.isFragile" v-model="data.isFragile"
:label="t('basicData.isFragile')" :label="t('itemBasicData.isFragile')"
class="q-mr-sm" class="q-mr-sm"
/> />
<QIcon name="info" class="cursor-pointer" size="xs"> <QIcon name="info" class="cursor-pointer" size="xs">
<QTooltip max-width="300px"> <QTooltip max-width="300px">
{{ t('basicData.isFragileTooltip') }} {{ t('itemBasicData.isFragileTooltip') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</div> </div>
<div> <div>
<QCheckbox <QCheckbox
v-model="data.isPhotoRequested" v-model="data.isPhotoRequested"
:label="t('basicData.isPhotoRequested')" :label="t('itemBasicData.isPhotoRequested')"
class="q-mr-sm" class="q-mr-sm"
/> />
<QIcon name="info" class="cursor-pointer" size="xs"> <QIcon name="info" class="cursor-pointer" size="xs">
<QTooltip> <QTooltip>
{{ t('basicData.isPhotoRequestedTooltip') }} {{ t('itemBasicData.isPhotoRequestedTooltip') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</div> </div>
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput <VnInput
:label="t('basicData.description')" :label="t('itemBasicData.description')"
type="textarea" type="textarea"
v-model="data.description" v-model="data.description"
fill-input fill-input

View File

@ -10,7 +10,7 @@ import ItemListFilter from '../ItemListFilter.vue';
:descriptor="ItemDescriptor" :descriptor="ItemDescriptor"
:filter-panel="ItemListFilter" :filter-panel="ItemListFilter"
search-data-key="ItemList" search-data-key="ItemList"
:searchbarProps="{ :searchbar-props="{
url: 'Items/filter', url: 'Items/filter',
label: 'searchbar.labelr', label: 'searchbar.labelr',
info: 'searchbar.info', info: 'searchbar.info',

View File

@ -112,7 +112,7 @@ const openCloneDialog = async () => {
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
title: t("All it's properties will be copied"), title: t('All its properties will be copied'),
message: t('Do you want to clone this item?'), message: t('Do you want to clone this item?'),
}, },
}) })
@ -215,7 +215,7 @@ const openCloneDialog = async () => {
<i18n> <i18n>
es: es:
Regularize stock: Regularizar stock Regularize stock: Regularizar stock
All it's properties will be copied: Todas sus propiedades serán copiadas All its properties will be copied: Todas sus propiedades serán copiadas
Do you want to clone this item?: ¿Desea clonar este artículo? Do you want to clone this item?: ¿Desea clonar este artículo?
</i18n> </i18n>

View File

@ -64,7 +64,7 @@ const handlePhotoUpdated = (evt = false) => {
<template> <template>
<div class="relative-position"> <div class="relative-position">
<VnImg ref="image" :id="$props.entityId" @refresh="handlePhotoUpdated(true)"> <VnImg ref="image" :id="$props.entityId" zoom-resolution="1600x900">
<template #error> <template #error>
<div class="absolute-full picture text-center q-pa-md flex flex-center"> <div class="absolute-full picture text-center q-pa-md flex flex-center">
<div> <div>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue'; import { onMounted, computed, onUnmounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { dateRange } from 'src/filters'; import { dateRange } from 'src/filters';
@ -11,6 +11,7 @@ import { toDateTimeFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { toCurrency } from 'filters/index'; import { toCurrency } from 'filters/index';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -35,26 +36,8 @@ const exprBuilder = (param, value) => {
} }
}; };
const datedRange = reactive({ const from = ref();
from: null, const to = ref();
to: null,
});
const from = computed({
get: () => datedRange.from,
set: (val) => {
updateFrom(val);
updateFilter();
},
});
const to = computed({
get: () => datedRange.to,
set: (val) => {
updateTo(val);
updateFilter();
},
});
const arrayData = useArrayData('ItemLastEntries', { const arrayData = useArrayData('ItemLastEntries', {
url: 'Items/lastEntriesFilter', url: 'Items/lastEntriesFilter',
@ -162,41 +145,48 @@ const fetchItemLastEntries = async () => {
itemLastEntries.value = data; itemLastEntries.value = data;
}; };
const updateFrom = async (date) => { const getDate = (date, type) => {
date.setHours(0, 0, 0, 0); if (type == 'from') {
datedRange.from = date.toISOString(); date.setHours(0, 0, 0, 0);
}; } else if (type == 'to') {
date.setHours(23, 59, 59, 999);
const updateTo = async (date) => { }
date.setHours(23, 59, 59, 59); return date.toISOString();
datedRange.to = date.toISOString();
}; };
const updateFilter = async () => { const updateFilter = async () => {
arrayData.store.userFilter.where.landed = { let filter;
between: [datedRange.from, datedRange.to], if (!from.value && to.value) filter = { lte: to.value };
}; else if (from.value && !to.value) filter = { gte: from.value };
else if (from.value && to.value) filter = { between: [from.value, to.value] };
arrayData.store.userFilter.where.landed = filter;
await fetchItemLastEntries(); await fetchItemLastEntries();
}; };
onMounted(async () => { onMounted(async () => {
const _from = Date.vnNew(); const _from = Date.vnNew();
_from.setDate(_from.getDate() - 75); _from.setDate(_from.getDate() - 75);
updateFrom(_from); from.value = getDate(_from, 'from');
const _to = Date.vnNew(); const _to = Date.vnNew();
_to.setDate(_to.getDate() + 10); _to.setDate(_to.getDate() + 10);
updateTo(_to); to.value = getDate(Date.vnNew(), 'to');
updateFilter(); updateFilter();
watch([from, to], ([nFrom, nTo], [oFrom, oTo]) => {
if (nFrom && nFrom != oFrom) nFrom = getDate(new Date(nFrom), 'from');
if (nTo && nTo != oTo) nTo = getDate(new Date(nTo), 'to');
updateFilter();
});
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
<QToolbar class="justify-end"> <VnSubToolbar>
<div id="st-data" class="row"> <template #st-data>
<VnInputDate <VnInputDate
:label="t('lastEntries.since')" :label="t('lastEntries.since')"
dense dense
@ -204,11 +194,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
class="q-mr-lg" class="q-mr-lg"
/> />
<VnInputDate :label="t('lastEntries.to')" dense v-model="to" /> <VnInputDate :label="t('lastEntries.to')" dense v-model="to" />
</div> </template>
<QSpace /> </VnSubToolbar>
<div id="st-actions"></div> <QPage class="column items-center q-pa-xd">
</QToolbar>
<QPage class="column items-center q-pa-md">
<QTable <QTable
:rows="itemLastEntries" :rows="itemLastEntries"
:columns="columns" :columns="columns"

View File

@ -42,9 +42,10 @@ const onItemTagsFetched = async (itemTags) => {
}); });
}; };
const handleTagSelected = (rows, index, tag) => { const handleTagSelected = (rows, index, tagId) => {
const tag = tagOptions.value.find((t) => t.id === tagId);
rows[index].tag = tag; rows[index].tag = tag;
rows[index].tagFk = tag.id; rows[index].tagFk = tagId;
rows[index].value = null; rows[index].value = null;
getSelectedTagValues(rows[index]); getSelectedTagValues(rows[index]);
}; };
@ -94,7 +95,6 @@ const insertTag = (rows) => {
:filter="{ :filter="{
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'], fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
where: { itemFk: route.params.id }, where: { itemFk: route.params.id },
order: 'priority ASC',
include: { include: {
relation: 'tag', relation: 'tag',
scope: { scope: {
@ -102,16 +102,13 @@ const insertTag = (rows) => {
}, },
}, },
}" }"
order="priority"
auto-load auto-load
@on-fetch="onItemTagsFetched" @on-fetch="onItemTagsFetched"
> >
<template #body="{ rows, validate }"> <template #body="{ rows, validate }">
<QCard class="q-pl-lg q-py-md"> <QCard class="q-px-lg q-pt-md q-pb-sm">
<VnRow <VnRow v-for="(row, index) in rows" :key="index">
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<VnSelect <VnSelect
:label="t('itemTags.tag')" :label="t('itemTags.tag')"
:options="tagOptions" :options="tagOptions"
@ -119,7 +116,7 @@ const insertTag = (rows) => {
option-label="name" option-label="name"
hide-selected hide-selected
@update:model-value=" @update:model-value="
($event) => handleTagSelected(rows, index, $event) (val) => handleTagSelected(rows, index, val)
" "
:required="true" :required="true"
:rules="validate('itemTag.tagFk')" :rules="validate('itemTag.tagFk')"
@ -146,7 +143,6 @@ const insertTag = (rows) => {
v-model="row.value" v-model="row.value"
:label="t('itemTags.value')" :label="t('itemTags.value')"
:is-clearable="false" :is-clearable="false"
style="width: 100%"
/> />
<VnInput <VnInput
:label="t('itemTags.relevancy')" :label="t('itemTags.relevancy')"
@ -155,7 +151,7 @@ const insertTag = (rows) => {
:required="true" :required="true"
:rules="validate('itemTag.priority')" :rules="validate('itemTag.priority')"
/> />
<div class="col-1 row justify-center items-center"> <div class="row justify-center items-center" style="flex: 0">
<QIcon <QIcon
@click="itemTagsRef.remove([row])" @click="itemTagsRef.remove([row])"
class="fill-icon-on-hover" class="fill-icon-on-hover"
@ -169,7 +165,7 @@ const insertTag = (rows) => {
</QIcon> </QIcon>
</div> </div>
</VnRow> </VnRow>
<VnRow> <VnRow class="justify-center items-center">
<QIcon <QIcon
@click="insertTag(rows)" @click="insertTag(rows)"
class="cursor-pointer" class="cursor-pointer"
@ -177,6 +173,7 @@ const insertTag = (rows) => {
color="primary" color="primary"
name="add" name="add"
size="sm" size="sm"
style="flex: 0"
> >
<QTooltip> <QTooltip>
{{ t('itemTags.addTag') }} {{ t('itemTags.addTag') }}

View File

@ -25,7 +25,7 @@ itemDiary:
showBefore: Show what's before the inventory showBefore: Show what's before the inventory
since: Since since: Since
warehouse: Warehouse warehouse: Warehouse
basicData: itemBasicData:
type: Type type: Type
reference: Reference reference: Reference
relevancy: Relevancy relevancy: Relevancy

View File

@ -25,7 +25,7 @@ itemDiary:
showBefore: Mostrar lo anterior al inventario showBefore: Mostrar lo anterior al inventario
since: Desde since: Desde
warehouse: Almacén warehouse: Almacén
basicData: itemBasicData:
type: Tipo type: Tipo
reference: Referencia reference: Referencia
relevancy: Relevancia relevancy: Relevancia

View File

@ -72,7 +72,8 @@ async function onSubmit() {
:rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]" :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
class="red" class="red"
/> />
<div> <QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
<div class="column flex-center q-mt-lg">
<QBtn <QBtn
:label="t('login.submit')" :label="t('login.submit')"
type="submit" type="submit"
@ -81,11 +82,15 @@ async function onSubmit() {
rounded rounded
unelevated unelevated
/> />
<RouterLink
class="q-mt-md text-primary"
:to="`/recoverPassword?user=${username}`"
>
{{ t('I do not remember my password') }}
</RouterLink>
</div> </div>
<QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
</QForm> </QForm>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.formCard { .formCard {
max-width: 350px; max-width: 350px;
@ -101,3 +106,7 @@ async function onSubmit() {
} }
} }
</style> </style>
<i18n>
es:
I do not remember my password: No recuerdo mi contraseña
</i18n>

View File

@ -0,0 +1,59 @@
<script setup>
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import VnInput from 'src/components/common/VnInput.vue';
import VnOutForm from 'src/components/ui/VnOutForm.vue';
const quasar = useQuasar();
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
const user = ref(route.query.user);
async function onSubmit() {
try {
await axios.post('VnUsers/recoverPassword', { user: user.value, app: 'lilium' });
router.push('Login');
quasar.notify({
message: t('globals.notificationSent'),
type: 'positive',
});
} catch (e) {
quasar.notify({
message: e.response?.data?.error.message,
type: 'negative',
});
}
}
</script>
<template>
<VnOutForm @submit="onSubmit" :title="t('globals.pageTitles.recoverPassword')">
<template #default>
<VnInput
v-model="user"
:label="t('recoverPassword.userOrEmail')"
:hint="t('recoverPassword.explanation')"
autofocus
required
>
<template #prepend>
<QIcon name="contact_mail" />
</template>
</VnInput>
</template>
<template #buttons>
<QBtn
:label="t('globals.pageTitles.recoverPassword')"
type="submit"
color="primary"
class="full-width q-mt-md"
rounded
unelevated
/>
</template>
</VnOutForm>
</template>

View File

@ -0,0 +1,99 @@
<script setup>
import { ref, onMounted } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import VnInput from 'components/common/VnInput.vue';
import VnOutForm from 'components/ui/VnOutForm.vue';
const quasar = useQuasar();
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
const newPassword = ref();
const repeatPassword = ref();
const passRequirements = ref({});
onMounted(async () => {
passRequirements.value = (await axios('UserPasswords/findOne')).data;
});
async function onSubmit() {
if (newPassword.value != repeatPassword.value)
return quasar.notify({
message: t('resetPassword.passwordNotMatch'),
type: 'negative',
});
const headers = {
Authorization: route.query.access_token,
};
try {
console.log('newPassword: ', newPassword);
await axios.post(
'VnUsers/reset-password',
{ newPassword: newPassword.value },
{ headers }
);
router.push('Login');
quasar.notify({
message: t('resetPassword.passwordChanged'),
type: 'positive',
});
} catch (e) {
quasar.notify({
message: e.response?.data?.error.message,
type: 'negative',
});
}
}
</script>
<template>
<VnOutForm @submit="onSubmit" :title="t('globals.pageTitles.resetPassword')">
<template #default>
<VnInput
type="password"
:label="t('login.password')"
v-model="newPassword"
:info="
t('passwordRequirements', {
length: passRequirements.length,
nAlpha: passRequirements.nAlpha,
nUpper: passRequirements.nUpper,
nDigits: passRequirements.nDigits,
nPunct: passRequirements.nPunct,
})
"
required
>
<template #prepend>
<QIcon name="password" />
</template>
</VnInput>
<VnInput
type="password"
:label="t('resetPassword.repeatPassword')"
v-model="repeatPassword"
required
>
<template #prepend>
<QIcon name="password" />
</template>
</VnInput>
</template>
<template #buttons>
<QBtn
:label="t('globals.pageTitles.resetPassword')"
type="submit"
color="primary"
class="full-width q-mt-md"
rounded
unelevated
/>
</template>
</VnOutForm>
</template>

View File

@ -8,6 +8,7 @@ import axios from 'axios';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin'; import { useLogin } from 'src/composables/useLogin';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnOutForm from 'src/components/ui/VnOutForm.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const session = useSession(); const session = useSession();
@ -38,24 +39,22 @@ async function onSubmit() {
} }
</script> </script>
<template> <template>
<QForm @submit="onSubmit" class="q-gutter-y-md q-pa-lg formCard"> <VnOutForm @submit="onSubmit" :title="t('twoFactor.insert')">
<div class="column items-center"> <template #default>
<QIcon name="phonelink_lock" size="xl" color="primary" /> <VnInput
<h5 class="text-center q-my-md">{{ t('twoFactor.insert') }}</h5> v-model="code"
</div> :hint="t('twoFactor.explanation')"
<VnInput mask="# # # # # #"
v-model="code" fill-mask
:hint="t('twoFactor.explanation')" unmasked-value
mask="# # # # # #" autofocus
fill-mask >
unmasked-value <template #prepend>
autofocus <QIcon name="lock" />
> </template>
<template #prepend> </VnInput>
<QIcon name="lock" /> </template>
</template> <template #buttons>
</VnInput>
<div class="q-mt-xl">
<QBtn <QBtn
:label="t('twoFactor.validate')" :label="t('twoFactor.validate')"
type="submit" type="submit"
@ -64,18 +63,6 @@ async function onSubmit() {
rounded rounded
unelevated unelevated
/> />
</div> </template>
</QForm> </VnOutForm>
</template> </template>
<style lang="scss" scoped>
.formCard {
max-width: 350px;
min-width: 300px;
}
@media (max-width: $breakpoint-xs-max) {
.formCard {
min-width: 100%;
}
}
</style>

View File

@ -16,7 +16,7 @@ const filter = {
:descriptor="ParkingDescriptor" :descriptor="ParkingDescriptor"
:filter-panel="ParkingFilter" :filter-panel="ParkingFilter"
search-data-key="ParkingList" search-data-key="ParkingList"
:searchbarProps="{ :searchbar-props="{
url: 'Parkings', url: 'Parkings',
label: 'parking.searchBar.label', label: 'parking.searchBar.label',
info: 'parking.searchBar.info', info: 'parking.searchBar.info',

View File

@ -8,7 +8,7 @@ import VnCard from 'components/common/VnCard.vue';
base-url="Agencies" base-url="Agencies"
:descriptor="AgencyDescriptor" :descriptor="AgencyDescriptor"
search-data-key="AgencyList" search-data-key="AgencyList"
:searchbarProps="{ :searchbar-props="{
url: 'Agencies', url: 'Agencies',
label: 'agency.searchBar.label', label: 'agency.searchBar.label',
info: 'agency.searchBar.info', info: 'agency.searchBar.info',

View File

@ -119,6 +119,7 @@ const emit = defineEmits(['search']);
sort-by="numberPlate ASC" sort-by="numberPlate ASC"
option-value="id" option-value="id"
option-label="numberPlate" option-label="numberPlate"
option-filter-value="numberPlate"
dense dense
outlined outlined
rounded rounded

View File

@ -142,11 +142,6 @@ const onSave = (data, response) => {
<QInput <QInput
v-model.number="data.kmEnd" v-model.number="data.kmEnd"
:label="t('Km End')" :label="t('Km End')"
:rules="[
(val) =>
val < maxDistance ||
t('Distance must be lesser than', { maxDistance }),
]"
clearable clearable
type="number" type="number"
/> />
@ -194,7 +189,7 @@ es:
Description: Descripción Description: Descripción
Is served: Se ha servido Is served: Se ha servido
Created: Creado Created: Creado
Distance must be lesser than: La distancia debe ser inferior a {maxDistance} The km can not exceed: La distancia debe ser inferior a {maxDistance}
en: en:
Distance must be lesser than: Distance must be lesser than {maxDistance} The km can not exceed: Distance must be lesser than {maxDistance}
</i18n> </i18n>

View File

@ -10,7 +10,7 @@ import RoadmapFilter from 'pages/Route/Roadmap/RoadmapFilter.vue';
:descriptor="RoadmapDescriptor" :descriptor="RoadmapDescriptor"
:filter-panel="RoadmapFilter" :filter-panel="RoadmapFilter"
search-data-key="RoadmapList" search-data-key="RoadmapList"
:searchbarProps="{ :searchbar-props="{
url: 'Roadmaps', url: 'Roadmaps',
label: 'Search roadmap', label: 'Search roadmap',
info: 'You can search by roadmap id or customer name', info: 'You can search by roadmap id or customer name',

View File

@ -214,7 +214,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
@click="openDmsUploadDialog" @click="openDmsUploadDialog"
> >
<QTooltip> <QTooltip>
{{ t('Create invoiceIn') }} {{ t('globals.createInvoiceIn') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</QCard> </QCard>
@ -267,7 +267,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
es: es:
Search autonomous: Buscar autónomos Search autonomous: Buscar autónomos
You can search by autonomous reference: Puedes buscar por referencia del autónomo You can search by autonomous reference: Puedes buscar por referencia del autónomo
Create invoiceIn: Crear factura recibida
Two autonomous cannot be counted at the same time: Dos autonónomos no pueden ser contabilizados al mismo tiempo Two autonomous cannot be counted at the same time: Dos autonónomos no pueden ser contabilizados al mismo tiempo
Date: Fecha Date: Fecha
Agency route: Agencia Ruta Agency route: Agencia Ruta

View File

@ -99,6 +99,7 @@ const columns = computed(() => [
url: 'vehicles', url: 'vehicles',
fields: ['id', 'numberPlate'], fields: ['id', 'numberPlate'],
optionLabel: 'numberPlate', optionLabel: 'numberPlate',
optionFilterValue: 'numberPlate',
find: { find: {
value: 'vehicleFk', value: 'vehicleFk',
label: 'vehiclePlateNumber', label: 'vehiclePlateNumber',

View File

@ -177,7 +177,7 @@ const getEntryQueryParams = (supplier) => {
icon="vn:invoice-in-create" icon="vn:invoice-in-create"
color="primary" color="primary"
> >
<QTooltip>{{ t('Create invoiceIn') }}</QTooltip> <QTooltip>{{ t('globals.createInvoiceIn') }}</QTooltip>
</QBtn> </QBtn>
</QCardActions> </QCardActions>
</template> </template>
@ -188,7 +188,6 @@ const getEntryQueryParams = (supplier) => {
es: es:
All entries with current supplier: Todas las entradas con proveedor actual All entries with current supplier: Todas las entradas con proveedor actual
Go to client: Ir a cliente Go to client: Ir a cliente
Create invoiceIn: Crear factura recibida
Go to module index: Ir al índice del módulo Go to module index: Ir al índice del módulo
Inactive supplier: Proveedor inactivo Inactive supplier: Proveedor inactivo
Unverified supplier: Proveedor no verificado Unverified supplier: Proveedor no verificado

View File

@ -105,14 +105,14 @@ async function getVideoList(expeditionId, timed) {
label label
markers markers
snap snap
color="orange" color="primary"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem v-if="lastExpedition && videoList.length"> <QItem v-if="lastExpedition && videoList.length">
<QItemSection> <QItemSection>
<QSelect <QSelect
color="orange" color="primary"
v-model="slide" v-model="slide"
:options="videoList" :options="videoList"
:label="t('ticket.boxing.selectVideo')" :label="t('ticket.boxing.selectVideo')"

View File

@ -20,7 +20,7 @@ const customRouteRedirectName = computed(() => routeName.value);
:filter-panel="TicketFilter" :filter-panel="TicketFilter"
:descriptor="TicketDescriptor" :descriptor="TicketDescriptor"
search-data-key="TicketList" search-data-key="TicketList"
:searchbarProps="{ :searchbar-props="{
customRouteRedirectName, customRouteRedirectName,
label: t('card.search'), label: t('card.search'),
info: t('card.searchInfo'), info: t('card.searchInfo'),

View File

@ -34,7 +34,7 @@ const cancel = () => {
<template> <template>
<QPopupProxy ref="QPopupProxyRef"> <QPopupProxy ref="QPopupProxyRef">
<div class="container"> <div class="container">
<QSpinner v-if="!mana" color="orange" size="md" /> <QSpinner v-if="!mana" color="primary" size="md" />
<div v-else> <div v-else>
<div class="header">Mana: {{ toCurrency(mana) }}</div> <div class="header">Mana: {{ toCurrency(mana) }}</div>
<div class="q-pa-md"> <div class="q-pa-md">

View File

@ -298,6 +298,7 @@ onMounted(() => (stateStore.rightDrawer = true));
<div class="col"> <div class="col">
<VnSelect <VnSelect
url="Warehouses" url="Warehouses"
:sort-by="['name']"
:label="t('ticket.create.warehouse')" :label="t('ticket.create.warehouse')"
v-model="data.warehouseId" v-model="data.warehouseId"
:options="warehousesOptions" :options="warehousesOptions"

View File

@ -37,7 +37,7 @@ const filter = {
search-data-key="TravelList" search-data-key="TravelList"
:filter="filter" :filter="filter"
:descriptor="TravelDescriptor" :descriptor="TravelDescriptor"
:searchbarProps="{ :searchbar-props="{
url: 'Travels', url: 'Travels',
label: 'Search travel', label: 'Search travel',
info: 'You can search by travel id or name', info: 'You can search by travel id or name',

View File

@ -64,7 +64,12 @@ function confirm() {
<QList class="row q-mx-auto q-mt-xl"> <QList class="row q-mx-auto q-mt-xl">
<QItem v-for="(props, name) in counters" :key="name" class="col-6"> <QItem v-for="(props, name) in counters" :key="name" class="col-6">
<QItemSection> <QItemSection>
<VnImg :id="props.id" width="130px" @click="handleEvent(name, 'add')" /> <VnImg
:id="props.id"
width="130px"
@click="handleEvent(name, 'add')"
:zoom="false"
/>
<p class="title">{{ props.title }}</p> <p class="title">{{ props.title }}</p>
</QItemSection> </QItemSection>
<QItemSection class="q-ma-none"> <QItemSection class="q-ma-none">

View File

@ -10,7 +10,7 @@ import WorkerFilter from '../WorkerFilter.vue';
:descriptor="WorkerDescriptor" :descriptor="WorkerDescriptor"
:filter-panel="WorkerFilter" :filter-panel="WorkerFilter"
search-data-key="WorkerList" search-data-key="WorkerList"
:searchbarProps="{ :searchbar-props="{
url: 'Workers/filter', url: 'Workers/filter',
label: 'Search worker', label: 'Search worker',
info: 'You can search by worker id or name', info: 'You can search by worker id or name',

View File

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

View File

@ -29,7 +29,7 @@ const searchBarDataKeys = {
:descriptor="ZoneDescriptor" :descriptor="ZoneDescriptor"
:search-data-key="searchBarDataKeys[routeName]" :search-data-key="searchBarDataKeys[routeName]"
:filter-panel="ZoneFilterPanel" :filter-panel="ZoneFilterPanel"
:searchbarProps="{ :searchbar-props="{
url: 'Zones', url: 'Zones',
label: t('list.searchZone'), label: t('list.searchZone'),
info: t('list.searchInfo'), info: t('list.searchInfo'),

View File

@ -46,7 +46,7 @@ export { Router };
export default route(function (/* { store, ssrContext } */) { export default route(function (/* { store, ssrContext } */) {
Router.beforeEach(async (to, from, next) => { Router.beforeEach(async (to, from, next) => {
const { isLoggedIn } = session; const { isLoggedIn } = session;
const outLayout = ['Login', 'TwoFactor', 'VerifyEmail']; const outLayout = Router.options.routes[0].children.map((r) => r.name);
if (!isLoggedIn() && !outLayout.includes(to.name)) { if (!isLoggedIn() && !outLayout.includes(to.name)) {
return next({ name: 'Login', query: { redirect: to.fullPath } }); return next({ name: 'Login', query: { redirect: to.fullPath } });
} }

View File

@ -65,13 +65,13 @@ export default {
component: () => import('src/pages/Account/AccountAliasList.vue'), component: () => import('src/pages/Account/AccountAliasList.vue'),
}, },
{ {
path: 'connections', path: 'acls',
name: 'AccountConnections', name: 'AccountAcls',
meta: { meta: {
title: 'connections', title: 'acls',
icon: 'check', icon: 'check',
}, },
component: () => import('src/pages/Account/AccountConnections.vue'), component: () => import('src/pages/Account/AccountAcls.vue'),
}, },
{ {
path: 'accounts', path: 'accounts',
@ -104,13 +104,13 @@ export default {
component: () => import('src/pages/Account/AccountSamba.vue'), component: () => import('src/pages/Account/AccountSamba.vue'),
}, },
{ {
path: 'acls', path: 'connections',
name: 'AccountAcls', name: 'AccountConnections',
meta: { meta: {
title: 'acls', title: 'connections',
icon: 'check', icon: 'share',
}, },
component: () => import('src/pages/Account/AccountAcls.vue'), component: () => import('src/pages/Account/AccountConnections.vue'),
}, },
{ {
path: 'acl-form', path: 'acl-form',

View File

@ -46,6 +46,18 @@ const routes = [
meta: { title: 'verifyEmail' }, meta: { title: 'verifyEmail' },
component: () => import('../pages/Login/VerifyEmail.vue'), component: () => import('../pages/Login/VerifyEmail.vue'),
}, },
{
path: '/recoverPassword',
name: 'RecoverPassword',
meta: { title: 'recoverPassword' },
component: () => import('../pages/Login/RecoverPassword.vue'),
},
{
path: '/resetPassword',
name: 'ResetPassword',
meta: { title: 'resetPassword' },
component: () => import('../pages/Login/ResetPassword.vue'),
},
], ],
}, },
{ {

View File

@ -1,8 +1,9 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInIntrastat', () => { describe('InvoiceInIntrastat', () => {
const inputBtns = 'label button'; const firstRow = 'tbody > :nth-child(1)';
const thirdRow = 'tbody > :nth-child(3)'; const thirdRow = 'tbody > :nth-child(3)';
const firstLineCode = 'tbody > :nth-child(1) > :nth-child(2)'; const firstRowCode = `${firstRow} > :nth-child(2)`;
const firstRowAmount = `${firstRow} > :nth-child(3)`;
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
@ -10,10 +11,10 @@ describe('InvoiceInIntrastat', () => {
}); });
it('should edit the first line', () => { it('should edit the first line', () => {
cy.selectOption(firstLineCode, 'Plantas vivas: Esqueje/injerto, Vid'); cy.selectOption(firstRowCode, 'Plantas vivas: Esqueje/injerto, Vid');
cy.get(inputBtns).eq(1).click(); cy.get(firstRowAmount).clear();
cy.saveCard(); cy.saveCard();
cy.get(`${firstLineCode} span`).should( cy.get(`${firstRowCode} span`).should(
'have.text', 'have.text',
'6021010:Plantas vivas: Esqueje/injerto, Vid' '6021010:Plantas vivas: Esqueje/injerto, Vid'
); );

View File

@ -1,23 +1,23 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceInList', () => { describe('InvoiceInList', () => {
const firstCard = '.q-card:nth-child(1)'; const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
const firstChipId = const firstId = `${firstRow} > td:nth-child(1) span`;
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content'; const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
const firstDetailBtn = '.q-card:nth-child(1) .q-btn:nth-child(2)';
const summaryHeaders = '.summaryBody .header-link'; const summaryHeaders = '.summaryBody .header-link';
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/list`); cy.visit(`/#/invoice-in/list`);
cy.get('#searchbar input').type('{enter}');
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {
cy.get(firstChipId) cy.get(firstId)
.invoke('text') .invoke('text')
.then((content) => { .then((content) => {
const id = content.replace(/\D/g, ''); const id = content.replace(/\D/g, '');
cy.get(firstCard).click(); cy.get(firstRow).click();
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });
}); });

View File

@ -4,8 +4,7 @@ describe('InvoiceInVat', () => {
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)'; const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
const dialogInputs = '.q-dialog label input'; const dialogInputs = '.q-dialog label input';
const dialogBtns = '.q-dialog button'; const dialogBtns = '.q-dialog button';
const acrossInput = const acrossInput = 'tbody tr:nth-child(1) td:nth-child(2) .default-icon';
':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon';
const randomInt = Math.floor(Math.random() * 100); const randomInt = Math.floor(Math.random() * 100);
beforeEach(() => { beforeEach(() => {

View File

@ -7,10 +7,8 @@ describe('Logout', () => {
}); });
describe('by user', () => { describe('by user', () => {
it('should logout', () => { it('should logout', () => {
cy.get( cy.get('#user').click();
'#user > .q-btn__content > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image' cy.get('#logout').click();
).click();
cy.get('.block').click();
}); });
}); });
describe('not user', () => { describe('not user', () => {

View File

@ -0,0 +1,54 @@
/// <reference types="cypress" />
describe('Recover Password', () => {
const username = 'trainee';
beforeEach(() => {
cy.visit('/#/login');
cy.get('#switchLanguage').click();
cy.get('.q-menu > :nth-child(1) > .q-item').click();
});
it('should go to recover password section and send notification', () => {
cy.get('input[aria-label="Username"]').type(username);
cy.get(`a[href="#/recoverPassword?user=${username}"]`).click();
cy.waitForElement('input[aria-label="User or recovery email"]');
cy.get('input[aria-label="User or recovery email"]').should(
'have.value',
username
);
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Notification sent');
});
it('should change password to user', () => {
// Get token from mail
cy.request(
`http://localhost:3000/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
).then((response) => {
const regex = /access_token=([a-zA-Z0-9]+)/;
const [match] = response.body[0].body.match(regex);
const resetUrl = '/#/resetPassword?' + match;
cy.visit(resetUrl);
});
// Change password
const newPassword = 'test.1234';
cy.waitForElement('input[aria-label="Password"]');
cy.waitForElement('input[aria-label="Repeat password"]');
cy.get('input[aria-label="Password"]').type(newPassword);
cy.get('input[aria-label="Repeat password"]').type(newPassword);
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should('have.text', 'Password changed');
// Try to login successfully
cy.get('input[aria-label="Username"]').type(username);
cy.get('input[aria-label="Password"]').type(newPassword);
cy.get('button[type="submit"]').click();
cy.url().should('contain', '/dashboard');
// ❗The password cannot be returned because "nightmare" does not meet the requirements
});
});

View File

@ -0,0 +1,56 @@
/// <reference types="cypress" />
describe('Two Factor', () => {
const username = 'sysadmin';
const userId = 66;
beforeEach(() => {
cy.visit('/#/login');
cy.get('#switchLanguage').click();
cy.get('.q-menu > :nth-child(1) > .q-item').click();
});
it('should enable two factor to sysadmin', () => {
cy.request(
'PATCH',
`http://localhost:3000/api/VnUsers/${userId}/update-user?access_token=DEFAULT_TOKEN`,
{ twoFactor: 'email' }
);
});
it('should fail when login with incorrect two factor', () => {
cy.get('input[aria-label="Username"]').type(username);
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should(
'have.text',
'Two-factor verification required'
);
cy.get('input[type="text"]').type('123456');
cy.get('button[type="submit"]').click();
cy.url().should('contain', '/twoFactor');
});
it('should login with correct two factor', () => {
cy.get('input[aria-label="Username"]').type(username);
cy.get('input[aria-label="Password"]').type('nightmare');
cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should(
'have.text',
'Two-factor verification required'
);
// Get code from mail
cy.request(
`http://localhost:3000/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
).then((response) => {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = response.body[0].body;
const codeElement = tempDiv.querySelector('.code');
const code = codeElement ? codeElement.textContent.trim() : null;
cy.get('input[type="text"]').type(code);
cy.get('button[type="submit"]').click();
cy.url().should('contain', '/dashboard');
});
});
});