0
0
Fork 0

Merge branch 'dev' into 7717_fixOrderCatalog

This commit is contained in:
Jon Elias 2024-08-19 09:20:31 +00:00
commit ce8d12fe20
63 changed files with 789 additions and 440 deletions

View File

@ -87,6 +87,10 @@ const $props = defineProps({
type: Boolean,
default: false,
},
defaultTrim: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['onFetch', 'onDataSaved']);
const modelValue = computed(
@ -195,6 +199,7 @@ async function save() {
isLoading.value = true;
try {
formData.value = trimData(formData.value);
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
const method = $props.urlCreate ? 'post' : 'patch';
const url =
@ -253,6 +258,14 @@ function updateAndEmit(evt, val, res) {
emit(evt, state.get(modelValue), res);
}
function trimData(data) {
if (!$props.defaultTrim) return data;
for (const key in data) {
if (typeof data[key] == 'string') data[key] = data[key].trim();
}
return data;
}
defineExpose({
save,
isLoading,

View File

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

View File

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

View File

@ -315,7 +315,7 @@ defineExpose({
col?.columnFilter !== false &&
col?.name !== 'tableActions'
"
v-model="orders[col.name]"
v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
@ -409,7 +409,7 @@ defineExpose({
style="height: 30px"
>
<VnTableOrder
v-model="orders[col.name]"
v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name"
:label="col?.label"
:data-key="$attrs['data-key']"

View File

@ -407,9 +407,12 @@ watch(
@on-fetch="
(data) =>
(actions = data.map((item) => {
const changedModel = item.changedModel;
return {
locale: useCapitalize(validations[item.changedModel].locale.name),
value: item.changedModel,
locale: useCapitalize(
validations[changedModel]?.locale?.name ?? changedModel
),
value: changedModel,
};
}))
"

View File

@ -31,7 +31,7 @@ const dialog = ref(null);
<div class="container order-catalog-item overflow-hidden">
<QCard class="card shadow-6">
<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
class="item-color"

View File

@ -1,45 +1,62 @@
<script setup>
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useSession } from 'src/composables/useSession';
import { useColor } from 'src/composables/useColor';
import { getCssVar } from 'quasar';
const $props = defineProps({
workerId: { type: Number, required: true },
description: { type: String, default: null },
size: { type: String, default: null },
title: { type: String, default: null },
color: { type: String, default: null },
});
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
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 backgroundColor = computed(() => {
const color = $props.color || useColor(title.value);
return getCssVar(color) || color;
});
watch(src, () => (showLetter.value = false));
</script>
<template>
<div class="avatar-picture column items-center">
<div class="column items-center">
<QAvatar
:style="{
backgroundColor: useColor(title),
}"
:size="$props.size"
:title="title"
:style="{ backgroundColor }"
v-bind="$attrs"
:title="title || t('globals.system')"
>
<template v-if="showLetter">{{ title.charAt(0) }}</template>
<QImg
v-else
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
spinner-color="white"
@error="showLetter = true"
/>
<template v-if="showLetter">
{{ title.charAt(0) }}
</template>
<QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
</QAvatar>
<div class="description">
<slot name="description" v-if="$props.description">
<p>
{{ $props.description }}
</p>
<slot name="description" v-if="description">
<p v-text="description" />
</slot>
</div>
</div>
</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: {
type: Array,
default: () => ['filter'],
default: () => ['filter', 'search', 'or', 'and'],
},
customTags: {
type: Array,
@ -202,8 +202,10 @@ function formatValue(value) {
function sanitizer(params) {
for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object')
params[key] = Object.values(value)[0].replaceAll('%', '');
if (typeof value == 'object') {
const param = Object.values(value)[0];
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
}
}
return params;
}

View File

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

View File

@ -1,17 +1,17 @@
<script setup>
defineProps({ wrap: { type: Boolean, default: false } });
</script>
<template>
<div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }">
<slot></slot>
<div class="vn-row q-gutter-md q-mb-md">
<slot />
</div>
</template>
<style lang="scss" scopped>
<style lang="scss" scoped>
.vn-row {
display: flex;
> * {
> :deep(*) {
flex: 1;
}
&[wrap] {
flex-wrap: wrap;
}
}
@media screen and (max-width: 800px) {
.vn-row {

View File

@ -43,20 +43,9 @@ onBeforeUnmount(() => stateStore.toggleSubToolbar());
</slot>
</QToolbar>
</template>
<style lang="scss">
.q-toolbar {
background: var(--vn-section-color);
}
</style>
<style lang="scss" scoped>
.sticky {
position: sticky;
top: 61px;
z-index: 1;
}
@media (max-width: $breakpoint-sm) {
.sticky {
top: 90px;
}
}
</style>

View File

@ -190,6 +190,10 @@ select:-webkit-autofill {
font-size: medium;
}
.q-toolbar {
background: var(--vn-section-color);
}
.q-card__actions {
justify-content: center;
}

View File

@ -252,6 +252,9 @@ globals:
privileges: Privileges
ldap: LDAP
samba: Samba
twoFactor: Two factor
recoverPassword: Recover password
resetPassword: Reset password
created: Created
worker: Worker
now: Now
@ -264,6 +267,7 @@ globals:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?
createInvoiceIn: Create invoice in
myAccount: My account
errors:
statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred
@ -289,14 +293,17 @@ twoFactor:
explanation: >-
Please, enter the verification code that we have sent to your email in the
next 5 minutes
pageTitles:
twoFactor: Two-Factor
verifyEmail:
pageTitles:
verifyEmail: Email verification
dashboard:
pageTitles:
recoverPassword:
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:
list:
phone: Phone

View File

@ -254,6 +254,9 @@ globals:
packages: Bultos
ldap: LDAP
samba: Samba
twoFactor: Doble factor
recoverPassword: Recuperar contraseña
resetPassword: Restablecer contraseña
created: Fecha creación
worker: Trabajador
now: Ahora
@ -266,7 +269,7 @@ globals:
title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar?
createInvoiceIn: Crear factura recibida
myAccount: Mi cuenta
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
@ -290,14 +293,17 @@ twoFactor:
validate: Validar
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
pageTitles:
twoFactor: Doble factor
verifyEmail:
pageTitles:
verifyEmail: Verificación de correo
dashboard:
pageTitles:
recoverPassword:
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:
list:
phone: Teléfono
@ -877,7 +883,7 @@ worker:
card:
workerId: ID Trabajador
name: Nombre
email: Email
email: Correo personal
phone: Teléfono
mobile: Móvil
active: Activo

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,36 +1,21 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue';
import AccountDescriptor from './AccountDescriptor.vue';
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>
<template>
<VnCard
data-key="Account"
:descriptor="AccountDescriptor"
:search-data-key="searchBarDataKeys[routeName]"
search-data-key="AccountUsers"
:searchbar-props="{
redirect: !!customRouteRedirectName,
customRouteRedirectName,
url: 'VnUsers/preview',
label: t('account.search'),
info: t('account.searchInfo'),
searchUrl: 'table',
}"
/>
</template>

View File

@ -54,7 +54,7 @@ const hasAccount = ref(false);
</template>
<template #before>
<!-- 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>
<div
class="absolute-full picture text-center q-pa-md flex flex-center"

View File

@ -82,6 +82,54 @@ const removeAccount = async () => {
};
</script>
<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
v-if="account.hasAccount"
v-ripple

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -50,7 +50,7 @@ const columns = computed(() => [
align: 'left',
label: t('claim.attendedBy'),
name: 'attendedBy',
cardVisible: true,
orderBy: 'workerFk',
columnFilter: {
component: 'select',
attrs: {
@ -63,6 +63,7 @@ const columns = computed(() => [
optionFilter: 'firstName',
},
},
cardVisible: true,
},
{
align: 'left',

View File

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

View File

@ -10,7 +10,6 @@ import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { toCurrency } from 'src/filters';
import useNotify from 'src/composables/useNotify.js';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, onUnmounted, ref, computed } from 'vue';
import { onMounted, onUnmounted, ref, computed, watchEffect } from 'vue';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
@ -12,7 +12,6 @@ import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
import { toCurrency, toDate } from 'src/filters/index';
import { useStateStore } from 'stores/useStateStore';
import { QBtn } from 'quasar';
import { watchEffect } from 'vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
const { t } = useI18n();
@ -222,14 +221,17 @@ watchEffect(selectedRows);
</span>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="Tickets"
v-model="data.ticketFk"
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
:options="ticketsOptions"
option-label="nickname"
option-value="id"
/>
<div class="flex no-wrap flex-center">
<VnSelect
url="Tickets"
v-model="data.ticketFk"
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
:options="ticketsOptions"
option-label="nickname"
option-value="id"
/>
<span class="q-ml-md">O</span>
</div>
<VnSelect
url="Clients"
v-model="data.clientFk"
@ -238,10 +240,6 @@ watchEffect(selectedRows);
option-label="name"
option-value="id"
/>
<VnInputDate
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
v-model="data.maxShipped"
/>
<VnSelect
url="InvoiceOutSerials"
v-model="data.invoiceOutSerial"
@ -250,6 +248,10 @@ watchEffect(selectedRows);
option-label="description"
option-value="code"
/>
<VnInputDate
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
v-model="data.maxShipped"
/>
<VnSelect
url="TaxAreas"
v-model="data.area"

View File

@ -74,6 +74,9 @@ const columns = computed(() => [
align: 'left',
name: 'amount',
label: t('invoiceOutModule.amount'),
columnFilter: {
type: 'number',
},
format: (row) => toCurrency(row.amount),
cardVisible: true,
},

View File

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

View File

@ -112,7 +112,7 @@ const openCloneDialog = async () => {
.dialog({
component: VnConfirm,
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?'),
},
})
@ -215,7 +215,7 @@ const openCloneDialog = async () => {
<i18n>
es:
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?
</i18n>

View File

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

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
import { onMounted, computed, onUnmounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { dateRange } from 'src/filters';
@ -11,6 +11,7 @@ import { toDateTimeFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { toCurrency } from 'filters/index';
import { useArrayData } from 'composables/useArrayData';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n();
const route = useRoute();
@ -35,26 +36,8 @@ const exprBuilder = (param, value) => {
}
};
const datedRange = reactive({
from: null,
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 from = ref();
const to = ref();
const arrayData = useArrayData('ItemLastEntries', {
url: 'Items/lastEntriesFilter',
@ -162,41 +145,48 @@ const fetchItemLastEntries = async () => {
itemLastEntries.value = data;
};
const updateFrom = async (date) => {
date.setHours(0, 0, 0, 0);
datedRange.from = date.toISOString();
};
const updateTo = async (date) => {
date.setHours(23, 59, 59, 59);
datedRange.to = date.toISOString();
const getDate = (date, type) => {
if (type == 'from') {
date.setHours(0, 0, 0, 0);
} else if (type == 'to') {
date.setHours(23, 59, 59, 999);
}
return date.toISOString();
};
const updateFilter = async () => {
arrayData.store.userFilter.where.landed = {
between: [datedRange.from, datedRange.to],
};
let filter;
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();
};
onMounted(async () => {
const _from = Date.vnNew();
_from.setDate(_from.getDate() - 75);
updateFrom(_from);
from.value = getDate(_from, 'from');
const _to = Date.vnNew();
_to.setDate(_to.getDate() + 10);
updateTo(_to);
to.value = getDate(Date.vnNew(), 'to');
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));
</script>
<template>
<QToolbar class="justify-end">
<div id="st-data" class="row">
<VnSubToolbar>
<template #st-data>
<VnInputDate
:label="t('lastEntries.since')"
dense
@ -204,11 +194,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
class="q-mr-lg"
/>
<VnInputDate :label="t('lastEntries.to')" dense v-model="to" />
</div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md">
</template>
</VnSubToolbar>
<QPage class="column items-center q-pa-xd">
<QTable
:rows="itemLastEntries"
: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].tagFk = tag.id;
rows[index].tagFk = tagId;
rows[index].value = null;
getSelectedTagValues(rows[index]);
};
@ -94,7 +95,6 @@ const insertTag = (rows) => {
:filter="{
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
where: { itemFk: route.params.id },
order: 'priority ASC',
include: {
relation: 'tag',
scope: {
@ -102,16 +102,13 @@ const insertTag = (rows) => {
},
},
}"
order="priority"
auto-load
@on-fetch="onItemTagsFetched"
>
<template #body="{ rows, validate }">
<QCard class="q-pl-lg q-py-md">
<VnRow
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<QCard class="q-px-lg q-pt-md q-pb-sm">
<VnRow v-for="(row, index) in rows" :key="index">
<VnSelect
:label="t('itemTags.tag')"
:options="tagOptions"
@ -119,7 +116,7 @@ const insertTag = (rows) => {
option-label="name"
hide-selected
@update:model-value="
($event) => handleTagSelected(rows, index, $event)
(val) => handleTagSelected(rows, index, val)
"
:required="true"
:rules="validate('itemTag.tagFk')"
@ -146,7 +143,6 @@ const insertTag = (rows) => {
v-model="row.value"
:label="t('itemTags.value')"
:is-clearable="false"
style="width: 100%"
/>
<VnInput
:label="t('itemTags.relevancy')"
@ -155,7 +151,7 @@ const insertTag = (rows) => {
:required="true"
:rules="validate('itemTag.priority')"
/>
<div class="col-1 row justify-center items-center">
<div class="row justify-center items-center" style="flex: 0">
<QIcon
@click="itemTagsRef.remove([row])"
class="fill-icon-on-hover"
@ -169,7 +165,7 @@ const insertTag = (rows) => {
</QIcon>
</div>
</VnRow>
<VnRow>
<VnRow class="justify-center items-center">
<QIcon
@click="insertTag(rows)"
class="cursor-pointer"
@ -177,6 +173,7 @@ const insertTag = (rows) => {
color="primary"
name="add"
size="sm"
style="flex: 0"
>
<QTooltip>
{{ t('itemTags.addTag') }}

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<script setup>
import { ref } from 'vue';
import { Notify, useQuasar } from 'quasar';
import { Notify } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
@ -11,7 +11,6 @@ import VnLogo from 'components/ui/VnLogo.vue';
import VnInput from 'src/components/common/VnInput.vue';
import axios from 'axios';
const quasar = useQuasar();
const session = useSession();
const loginCache = useLogin();
const router = useRouter();
@ -72,7 +71,8 @@ async function onSubmit() {
:rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
class="red"
/>
<div>
<QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
<div class="column flex-center q-mt-lg">
<QBtn
:label="t('login.submit')"
type="submit"
@ -81,11 +81,15 @@ async function onSubmit() {
rounded
unelevated
/>
<RouterLink
class="q-mt-md text-primary"
:to="`/recoverPassword?user=${username}`"
>
{{ t('I do not remember my password') }}
</RouterLink>
</div>
<QToggle v-model="keepLogin" :label="t('login.keepLogin')" />
</QForm>
</template>
<style lang="scss" scoped>
.formCard {
max-width: 350px;
@ -101,3 +105,7 @@ async function onSubmit() {
}
}
</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 { useLogin } from 'src/composables/useLogin';
import VnInput from 'src/components/common/VnInput.vue';
import VnOutForm from 'src/components/ui/VnOutForm.vue';
const quasar = useQuasar();
const session = useSession();
@ -38,24 +39,22 @@ async function onSubmit() {
}
</script>
<template>
<QForm @submit="onSubmit" class="q-gutter-y-md q-pa-lg formCard">
<div class="column items-center">
<QIcon name="phonelink_lock" size="xl" color="primary" />
<h5 class="text-center q-my-md">{{ t('twoFactor.insert') }}</h5>
</div>
<VnInput
v-model="code"
:hint="t('twoFactor.explanation')"
mask="# # # # # #"
fill-mask
unmasked-value
autofocus
>
<template #prepend>
<QIcon name="lock" />
</template>
</VnInput>
<div class="q-mt-xl">
<VnOutForm @submit="onSubmit" :title="t('twoFactor.insert')">
<template #default>
<VnInput
v-model="code"
:hint="t('twoFactor.explanation')"
mask="# # # # # #"
fill-mask
unmasked-value
autofocus
>
<template #prepend>
<QIcon name="lock" />
</template>
</VnInput>
</template>
<template #buttons>
<QBtn
:label="t('twoFactor.validate')"
type="submit"
@ -64,18 +63,6 @@ async function onSubmit() {
rounded
unelevated
/>
</div>
</QForm>
</template>
</VnOutForm>
</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

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

View File

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

View File

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

View File

@ -64,7 +64,12 @@ function confirm() {
<QList class="row q-mx-auto q-mt-xl">
<QItem v-for="(props, name) in counters" :key="name" class="col-6">
<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>
</QItemSection>
<QItemSection class="q-ma-none">

View File

@ -12,9 +12,12 @@ import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
const countriesOptions = ref([]);
const educationLevelsOptions = ref([]);
const educationLevels = ref([]);
const countries = ref([]);
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
const workerFilter = {
include: [
@ -29,44 +32,21 @@ const workerFilter = {
{ relation: 'department', scope: { include: { relation: 'department' } } },
],
};
const workersFilter = {
fields: ['id', 'nickname'],
order: 'nickname ASC',
limit: 30,
};
const countriesFilter = {
fields: ['id', 'name', 'code'],
order: 'name ASC',
limit: 30,
};
const educationLevelsFilter = { fields: ['id', 'name'], order: 'name ASC', limit: 30 };
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
</script>
<template>
<FetchData
:filter="workersFilter"
@on-fetch="(data) => (workersOptions = data)"
auto-load
url="Workers/search"
/>
<FetchData
:filter="countriesFilter"
@on-fetch="(data) => (countriesOptions = data)"
auto-load
url="Countries"
/>
<FetchData
:filter="educationLevelsFilter"
@on-fetch="(data) => (educationLevelsOptions = data)"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (educationLevels = data)"
auto-load
url="EducationLevels"
/>
<FetchData
url="Countries"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (countries = data)"
auto-load
/>
<FormModel
:filter="workerFilter"
:url="`Workers/${route.params.id}`"
@ -90,7 +70,7 @@ const maritalStatus = [
<VnRow>
<VnSelect
:label="t('Boss')"
:options="workersOptions"
url="Workers/search"
hide-selected
option-label="nickname"
option-value="id"
@ -121,7 +101,7 @@ const maritalStatus = [
<VnRow>
<VnSelect
:label="t('Origin country')"
:options="countriesOptions"
:options="countries"
hide-selected
option-label="name"
option-value="id"
@ -129,7 +109,7 @@ const maritalStatus = [
/>
<VnSelect
:label="t('Education level')"
:options="educationLevelsOptions"
:options="educationLevels"
hide-selected
option-label="name"
option-value="id"

View File

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

View File

@ -108,7 +108,7 @@ const columns = computed(() => [
:filter="courseFilter"
:create="{
urlCreate: 'trainingCourses',
title: 'Create trainingCourse',
title: t('Create training course'),
onDataSaved: () => tableRef.reload(),
formInitialData: {
workerFk: entityId,
@ -122,3 +122,7 @@ const columns = computed(() => [
:use-model="true"
/>
</template>
<i18n>
es:
Create training course: Crear curso de formación
</i18n>

View File

@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const props = defineProps({
@ -26,7 +27,7 @@ const departments = ref();
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput :label="t('FI')" v-model="params.fi" is-outlined
@ -67,20 +68,17 @@ const departments = ref();
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="departments">
<QSelect
<VnSelect
:label="t('Department')"
v-model="params.departmentFk"
@update:model-value="searchFn()"
:options="departments"
option-value="id"
option-label="name"
emit-value
map-options
use-input
dense
outlined
rounded
:input-debounce="0"
/>
</QItemSection>
</QItem>
@ -107,6 +105,7 @@ en:
userName: User
extension: Extension
departmentFk: Department
id: ID
es:
params:
search: Contiene
@ -116,6 +115,7 @@ es:
userName: Usuario
extension: Extensión
departmentFk: Departamento
id: ID
FI: NIF
First Name: Nombre
Last Name: Apellidos

View File

@ -14,6 +14,8 @@ import VnLocation from 'src/components/common/VnLocation.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import FetchData from 'src/components/FetchData.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import WorkerFilter from './WorkerFilter.vue';
const { t } = useI18n();
const tableRef = ref();
@ -28,14 +30,8 @@ const columns = computed(() => [
{
align: 'left',
name: 'id',
label: t('tableColumns.id'),
columnFilter: {
alias: 'w',
inWhere: true,
},
chip: {
condition: () => true,
},
label: t('id'),
field: 'id',
isId: true,
},
{
@ -44,7 +40,7 @@ const columns = computed(() => [
label: t('tableColumns.name'),
isTitle: true,
columnFilter: {
name: 'search',
name: 'firstName',
},
},
{
@ -54,8 +50,7 @@ const columns = computed(() => [
cardVisible: true,
columnFilter: {
component: 'select',
inWhere: true,
alias: 'wd',
name: 'departmentFk',
attrs: {
url: 'Departments',
},
@ -130,6 +125,11 @@ function uppercaseStreetModel(data) {
@on-fetch="(data) => (bankEntitiesOptions = data)"
auto-load
/>
<RightMenu>
<template #right-panel>
<WorkerFilter data-key="Worker" />
</template>
</RightMenu>
<VnTable
ref="tableRef"
data-key="Worker"
@ -145,6 +145,7 @@ function uppercaseStreetModel(data) {
:columns="columns"
default-mode="table"
redirect="worker"
:right-search="false"
auto-load
>
<template #more-create-dialog="{ data }">

View File

@ -46,7 +46,7 @@ export { Router };
export default route(function (/* { store, ssrContext } */) {
Router.beforeEach(async (to, from, next) => {
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)) {
return next({ name: 'Login', query: { redirect: to.fullPath } });
}

View File

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

View File

@ -46,6 +46,18 @@ const routes = [
meta: { title: 'verifyEmail' },
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

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

View File

@ -1,4 +1,7 @@
describe('WorkerList', () => {
const inputName = '.q-drawer .q-form input[aria-label="First Name"]';
const searchBtn = '.q-drawer button:nth-child(3)';
const descriptorTitle = '.descriptor .title span';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@ -6,6 +9,11 @@ describe('WorkerList', () => {
});
it('should open the worker summary', () => {
cy.get('.q-drawer .q-form input[aria-label="Name"]').type('jessica jones{enter}');
cy.get(inputName).type('jessica{enter}');
cy.get(searchBtn).click();
cy.intercept('GET', /\/api\/Workers\/\d+/).as('worker');
cy.wait('@worker').then(() =>
cy.get(descriptorTitle).should('include.text', 'Jessica')
);
});
});

View File

@ -44,10 +44,6 @@ describe('Login', () => {
it('should not set the token into session if any error occurred', async () => {
vi.spyOn(axios, 'post').mockReturnValue({ data: null });
vi.spyOn(vm.quasar, 'notify');
await vm.onSubmit();
expect(vm.quasar.notify).not.toHaveBeenCalled();
});
});