diff --git a/src/components/ui/VnLinkMail.vue b/src/components/ui/VnLinkMail.vue
index a54f463f5..6c5129a9b 100644
--- a/src/components/ui/VnLinkMail.vue
+++ b/src/components/ui/VnLinkMail.vue
@@ -1,8 +1,11 @@
+ {{ dashIfEmpty(email) }}
diff --git a/src/components/ui/VnLinkPhone.vue b/src/components/ui/VnLinkPhone.vue
index 4174e4ae6..e34a70011 100644
--- a/src/components/ui/VnLinkPhone.vue
+++ b/src/components/ui/VnLinkPhone.vue
@@ -1,7 +1,7 @@
+
-
-
- {{ capitalize(type).replace('-', '') }}
-
-
- {{ phoneNumber }}
+
+
+ handleClick(type)"
+ >
+
+ {{ capitalize(type).replace('-', '') }}
+
+
+ {{ dashIfEmpty(phone) }}
+
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index b067381f6..7facb7916 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -215,6 +215,7 @@ defineExpose({
paginate,
userParams: arrayData.store.userParams,
currentFilter: arrayData.store.currentFilter,
+ arrayData,
});
diff --git a/src/composables/__tests__/useRole.spec.js b/src/composables/__tests__/useRole.spec.js
index d0bca5342..54d983a13 100644
--- a/src/composables/__tests__/useRole.spec.js
+++ b/src/composables/__tests__/useRole.spec.js
@@ -23,18 +23,19 @@ describe('useRole', () => {
name: `T'Challa`,
nickname: 'Black Panther',
lang: 'en',
+ worker: { department: { departmentFk: 155 } },
};
const expectedUser = {
id: 999,
name: `T'Challa`,
nickname: 'Black Panther',
lang: 'en',
+ departmentFk: 155,
};
const expectedRoles = ['salesPerson', 'admin'];
- vi.spyOn(axios, 'get')
- .mockResolvedValueOnce({
+ vi.spyOn(axios, 'get').mockResolvedValueOnce({
data: { roles: rolesData, user: fetchedUser },
- })
+ });
vi.spyOn(role.state, 'setUser');
vi.spyOn(role.state, 'setRoles');
diff --git a/src/composables/__tests__/useSession.spec.js b/src/composables/__tests__/useSession.spec.js
index 789b149ec..cae33f893 100644
--- a/src/composables/__tests__/useSession.spec.js
+++ b/src/composables/__tests__/useSession.spec.js
@@ -75,6 +75,7 @@ describe('session', () => {
userConfig: {
darkMode: false,
},
+ worker: { department: { departmentFk: 155 } },
};
const rolesData = [
{
@@ -143,7 +144,7 @@ describe('session', () => {
await session.destroy(); // this clears token and user for any other test
});
},
- {}
+ {},
);
describe('RenewToken', () => {
@@ -175,7 +176,7 @@ describe('session', () => {
await session.checkValidity();
expect(sessionStorage.getItem('token')).toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).toEqual(
- expectedTokenMultimedia
+ expectedTokenMultimedia,
);
});
it('Should renewToken', async () => {
@@ -204,7 +205,7 @@ describe('session', () => {
await session.checkValidity();
expect(sessionStorage.getItem('token')).not.toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).not.toEqual(
- expectedTokenMultimedia
+ expectedTokenMultimedia,
);
});
});
diff --git a/src/composables/useAcl.js b/src/composables/useAcl.js
index ede359186..52704fee9 100644
--- a/src/composables/useAcl.js
+++ b/src/composables/useAcl.js
@@ -30,9 +30,16 @@ export function useAcl() {
return false;
}
+ function hasAcl(model, prop, accessType) {
+ const modelAcl = state.getAcls().value[model];
+ const propAcl = modelAcl?.[prop] || modelAcl?.['*'];
+ return !!(propAcl?.[accessType] || propAcl?.['*']);
+ }
+
return {
fetch,
hasAny,
state,
+ hasAcl,
};
}
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index d1c1b01b8..363580148 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -189,7 +189,7 @@ export function useArrayData(key, userOptions) {
store.order = order;
resetPagination();
- fetch({});
+ await fetch({});
index++;
return { index, order };
diff --git a/src/composables/useFilterParams.js b/src/composables/useFilterParams.js
index 07dcdf99b..7c3f3bdeb 100644
--- a/src/composables/useFilterParams.js
+++ b/src/composables/useFilterParams.js
@@ -14,7 +14,7 @@ export function useFilterParams(key) {
watch(
() => arrayData.value.store?.currentFilter,
(val, oldValue) => (val || oldValue) && setUserParams(val),
- { immediate: true, deep: true }
+ { immediate: true, deep: true },
);
function parseOrder(urlOrders) {
@@ -54,7 +54,7 @@ export function useFilterParams(key) {
Object.assign(params, item);
});
delete params[key];
- } else if (value && typeof value === 'object') {
+ } else if (value && typeof value === 'object' && !Array.isArray(value)) {
const param = Object.values(value)[0];
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
}
diff --git a/src/composables/useRole.js b/src/composables/useRole.js
index ff54b409c..e700b1f2e 100644
--- a/src/composables/useRole.js
+++ b/src/composables/useRole.js
@@ -13,6 +13,7 @@ export function useRole() {
name: data.user.name,
nickname: data.user.nickname,
lang: data.user.lang || 'es',
+ departmentFk: data.user.worker.department.departmentFk,
};
state.setUser(userData);
state.setRoles(roles);
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 76fc31a5b..7bcf90793 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -370,6 +370,11 @@ globals:
countryCodeFk: Country
companyFk: Company
nickname: Alias
+ changedModel: Entity
+ changedModelValue: Search
+ changedModelId: Entity id
+ userFk: User
+ action: Action
model: Model
fuel: Fuel
active: Active
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 75fac881c..b2512193d 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -371,6 +371,11 @@ globals:
countryCodeFk: País
companyFk: Empresa
nickname: Alias
+ changedModel: Entidad
+ changedModelValue: Buscar
+ changedModelId: Id de entidad
+ userFk: Usuario
+ action: Acción
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
diff --git a/src/pages/Account/Card/AccountDescriptorMenu.vue b/src/pages/Account/Card/AccountDescriptorMenu.vue
index eafd62df6..f3eabb531 100644
--- a/src/pages/Account/Card/AccountDescriptorMenu.vue
+++ b/src/pages/Account/Card/AccountDescriptorMenu.vue
@@ -100,12 +100,8 @@ const onChangePass = (oldPass) => {
};
onMounted(() => {
- hasitManagementAccess.value = useAcl().hasAny([
- { model: 'VnUser', props: 'higherPrivileges', accessType: 'WRITE' },
- ]);
- hasSysadminAccess.value = useAcl().hasAny([
- { model: 'VnUser', props: 'adminUser', accessType: 'WRITE' },
- ]);
+ hasitManagementAccess.value = useAcl().hasAcl('VnUser', 'higherPrivileges', 'WRITE');
+ hasSysadminAccess.value = useAcl().hasAcl('VnUser', 'adminUser', 'WRITE');
});
@@ -227,7 +223,7 @@ onMounted(() => {
{{ t('account.card.actions.deactivateUser.name') }}