arrayData.store?.data);
-
-const isHr = computed(() => useRole().hasAny(['hr']));
-
-const canSend = computed(() => useAcl().hasAny('WorkerTimeControl', 'sendMail', 'WRITE'));
-
+const canSend = computed(() =>
+ acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }])
+);
+const canUpdate = computed(() =>
+ acl.hasAny([
+ { model: 'WorkerTimeControl', props: 'updateMailState', accessType: 'WRITE' },
+ ])
+);
const isHimself = computed(() => user.value.id === Number(route.params.id));
const columns = computed(() => {
@@ -257,58 +260,32 @@ const fetchHours = async () => {
}
};
-const fetchWorkerTimeControlMails = async (filter) => {
- try {
- const { data } = await axios.get('WorkerTimeControlMails', {
- params: { filter: JSON.stringify(filter) },
- });
-
- return data;
- } catch (err) {
- console.error('Error fetching worker time control mails');
- }
-};
-
const fetchWeekData = async () => {
+ const where = {
+ year: selectedDate.value.getFullYear(),
+ week: selectedWeekNumber.value,
+ };
try {
- const filter = {
- where: {
- workerFk: route.params.id,
- year: selectedDate.value ? selectedDate.value?.getFullYear() : null,
- week: selectedWeekNumber.value,
- },
- };
+ const mail = (
+ await axiosNoError.get(`Workers/${route.params.id}/mail`, {
+ params: { filter: { where } },
+ })
+ ).data[0];
- const data = await fetchWorkerTimeControlMails(filter);
- if (!data.length) {
- state.value = null;
- } else {
- const [mail] = data;
+ if (!mail) state.value = null;
+ else {
state.value = mail.state;
reason.value = mail.reason;
}
- await canBeResend();
+ canResend.value = !!(
+ await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
+ ).data.count;
} catch (err) {
console.error('Error fetching week data');
}
};
-const canBeResend = async () => {
- canResend.value = false;
-
- const filter = {
- where: {
- year: selectedDate.value.getFullYear(),
- week: selectedWeekNumber.value,
- },
- limit: 1,
- };
-
- const data = await fetchWorkerTimeControlMails(filter);
- if (data.length) canResend.value = true;
-};
-
const setHours = (data) => {
for (const weekDay of weekDays.value) {
if (data) {
@@ -449,7 +426,7 @@ onMounted(async () => {
{
@click="isSatisfied()"
/>
{
{
expect(value).to.have.length(newFileTd++);
const newRowSelector = `tbody > :nth-child(${newFileTd})`;
cy.waitForElement(newRowSelector);
- cy.validateRow(newRowSelector, [u, u, u, u, 'ENTRADA ID 1']);
+ cy.validateRow(newRowSelector, [u, u, u, u, u, 'ENTRADA ID 1']);
//Edit new dms
const newDescription = 'entry id 1 modified';
@@ -38,7 +38,7 @@ describe('EntryDms', () => {
cy.saveCard();
cy.reload();
- cy.validateRow(newRowSelector, [u, u, u, u, newDescription]);
+ cy.validateRow(newRowSelector, [u, u, u, u, u, newDescription]);
});
});
});
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index 516b0f13d8..8192b7c7ca 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -5,7 +5,7 @@ describe('Ticket descriptor', () => {
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
const summaryHeader = '.summaryHeader > div';
const weight = 25;
- const weightValue = ':nth-child(10) > .value > span';
+ const weightValue = '.summaryBody.row :nth-child(1) > :nth-child(9) > .value > span';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);