diff --git a/src/composables/useAdvancedSummary.js b/src/composables/useAdvancedSummary.js
new file mode 100644
index 000000000..98b998d2a
--- /dev/null
+++ b/src/composables/useAdvancedSummary.js
@@ -0,0 +1,11 @@
+import axios from 'axios';
+import { useRole } from './useRole';
+
+export async function useAdvancedSummary(model, id, roles = ['hr']) {
+ if (useRole().hasAny(roles)) {
+ const { data } = await axios.get(`${model}/advancedSummary`, {
+ params: { filter: { where: { id } } },
+ });
+ return Array.isArray(data) ? data[0] : data;
+ }
+}
diff --git a/src/pages/Ticket/Card/TicketExpedition.vue b/src/pages/Ticket/Card/TicketExpedition.vue
index 8041ad069..d682d0408 100644
--- a/src/pages/Ticket/Card/TicketExpedition.vue
+++ b/src/pages/Ticket/Card/TicketExpedition.vue
@@ -211,6 +211,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
-import { ref } from 'vue';
+import { ref, onBeforeMount } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnInputDate from 'src/components/common/VnInputDate.vue';
@@ -8,32 +8,22 @@ import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
+import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
-const route = useRoute();
const { t } = useI18n();
-
const educationLevels = ref([]);
const countries = ref([]);
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
+const advancedSummary = ref({});
-const workerFilter = {
- include: [
- {
- relation: 'user',
- scope: {
- fields: ['name', 'emailVerified'],
- include: { relation: 'emailUser', scope: { fields: ['email'] } },
- },
- },
- { relation: 'sip', scope: { fields: ['extension', 'secret'] } },
- { relation: 'department', scope: { include: { relation: 'department' } } },
- ],
-};
+onBeforeMount(async () => {
+ advancedSummary.value =
+ (await useAdvancedSummary('Workers', +useRoute().params.id)) ?? {};
+});
-
{
+ Object.assign(data, advancedSummary);
+ }
+ "
>
@@ -134,7 +130,7 @@ const workerFilter = {
-
+
useRoute().params.id);
const filter = computed(() => ({
where: {
- gender: store.data?.sex,
+ gender: store.data?.[0]?.sex,
or: [{ workerFk: null }, { workerFk: entityId.value }],
},
}));
@@ -51,6 +51,7 @@ const init = async (data) => {
>
$props.id || route.params.id);
const basicDataUrl = ref(null);
-const isHr = computed(() => useRole().hasAny(['hr']));
const advancedSummary = ref();
onBeforeMount(async () => {
- if (isHr.value) {
- advancedSummary.value = (
- await axios.get('Workers/advancedSummary', {
- params: { filter: { where: { id: entityId.value } } },
- })
- ).data[0];
- basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
- }
+ advancedSummary.value = await useAdvancedSummary('Workers', entityId.value);
+ basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
});
@@ -101,21 +93,27 @@ onBeforeMount(async () => {
:label="t('worker.summary.seniority')"
:value="toDate(worker.seniority)"
/>
-
-
+
+
+
-
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index c2a9e668f..d1feff23d 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -87,6 +87,13 @@ export default {
meta: {
title: 'basicData',
icon: 'vn:settings',
+ acls: [
+ {
+ model: 'Worker',
+ props: 'updateAttributes',
+ accessType: 'WRITE',
+ },
+ ],
},
component: () => import('src/pages/Worker/Card/WorkerBasicData.vue'),
},
diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js
index 5eb2c1a2a..d4afd401f 100644
--- a/test/cypress/integration/ticket/ticketExpedition.spec.js
+++ b/test/cypress/integration/ticket/ticketExpedition.spec.js
@@ -11,15 +11,13 @@ describe('Ticket expedtion', () => {
it('should change the state', () => {
cy.visit('#/ticket/1/expedition');
- cy.intercept('GET', /\/api\/Expeditions\/filter/).as('expeditions');
- cy.intercept('POST', /\/api\/Expeditions\/crud/).as('crud');
-
- cy.wait('@expeditions');
+ cy.intercept('GET', /\/api\/Expeditions\/filter/).as('show');
+ cy.intercept('POST', /\/api\/ExpeditionStates\/addExpeditionState/).as('add');
+ cy.wait('@show');
cy.selectRows([1, 2]);
- cy.get('#subToolbar [aria-controls]:nth-child(1)').click();
- cy.get('.q-menu .q-item').contains('Perdida').click();
- cy.wait('@crud');
+ cy.selectOption('[data-cy="change-state"]', 'Perdida');
+ cy.wait('@add');
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
cy.wrap($el).contains('Perdida');
diff --git a/test/cypress/integration/worker/workerList.spec.js b/test/cypress/integration/worker/workerList.spec.js
index 8a8bea443..c1c37fd32 100644
--- a/test/cypress/integration/worker/workerList.spec.js
+++ b/test/cypress/integration/worker/workerList.spec.js
@@ -11,7 +11,7 @@ describe('WorkerList', () => {
it('should open the worker summary', () => {
cy.get(inputName).type('jessica{enter}');
cy.get(searchBtn).click();
- cy.intercept('GET', /\/api\/Workers\/\d+/).as('worker');
+ cy.intercept('GET', /\/api\/Workers\/summary+/).as('worker');
cy.wait('@worker').then(() =>
cy.get(descriptorTitle).should('include.text', 'Jessica')
);
diff --git a/test/cypress/integration/worker/workerLocker.spec.js b/test/cypress/integration/worker/workerLocker.spec.js
index 8a169dfb2..c222414fd 100644
--- a/test/cypress/integration/worker/workerLocker.spec.js
+++ b/test/cypress/integration/worker/workerLocker.spec.js
@@ -1,8 +1,7 @@
describe('WorkerLocker', () => {
const productionId = 49;
- const lockerCode = '2F';
- const input = '.q-card input';
- const thirdOpt = '[role="listbox"] .q-item:nth-child(1)';
+ const lockerCode = '4F';
+ const lockerSelect = '[data-cy="locker"]';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('productionBoss');
@@ -10,10 +9,8 @@ describe('WorkerLocker', () => {
});
it('should allocates a locker', () => {
- cy.get(input).click();
- cy.waitForElement('[role="listbox"]');
- cy.get(thirdOpt).click();
+ cy.selectOption(lockerSelect, lockerCode);
cy.saveCard();
- cy.get(input).invoke('val').should('eq', lockerCode);
+ cy.get(lockerSelect).invoke('val').should('eq', lockerCode);
});
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index c9b1a748e..76bdefd27 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -82,7 +82,7 @@ Cypress.Commands.add('getValue', (selector) => {
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option) => {
cy.waitForElement(selector);
- cy.get(selector).find('.q-select__dropdown-icon').click();
+ cy.get(selector).click();
cy.get('.q-menu .q-item').contains(option).click();
});