@@ -414,14 +469,11 @@ async function changeState(value) {
-
-
-
+
+
+
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+ {{ props.row.description }}
+ {{ toDate(props.row.created) }}
+ {{ props.row.requester?.user?.username }}
+ {{ props.row.atender?.user?.username }}
+ {{ props.row.quantity }}
+ {{ toCurrency(props.row.price) }}
+
+
+ {{ props.row.itemFk }}
+
+
+
+
+
+
+ {{ t('Accepted') }}
+
+
+ {{ t('Denied') }}
+
+
+
+
+
+
+
es:
Create training course: Crear curso de formación
diff --git a/src/pages/Worker/Card/WorkerMedical.vue b/src/pages/Worker/Card/WorkerMedical.vue
index 6bca4ae85..fab1416c9 100644
--- a/src/pages/Worker/Card/WorkerMedical.vue
+++ b/src/pages/Worker/Card/WorkerMedical.vue
@@ -65,6 +65,18 @@ const columns = [
create: true,
component: 'input',
},
+ {
+ align: 'right',
+ name: 'tableActions',
+ actions: [
+ {
+ title: t('delete'),
+ icon: 'delete',
+ action: async (row) => await tableRef.value.CrudModelRef.remove([row]),
+ isPrimary: true,
+ },
+ ],
+ },
];
@@ -87,5 +99,6 @@ const columns = [
:right-search="false"
:is-editable="true"
:use-model="true"
+ :default-remove="false"
/>
diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue
index 0e7bfd863..ed34e771d 100644
--- a/src/pages/Worker/Card/WorkerSummary.vue
+++ b/src/pages/Worker/Card/WorkerSummary.vue
@@ -1,9 +1,9 @@
@@ -88,10 +52,7 @@ const filter = {
-
+
@@ -128,13 +89,9 @@ const filter = {
-
-
-
+
+
-
+
diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue
index abf60a078..39fb536b6 100644
--- a/src/pages/Worker/Card/WorkerTimeControl.vue
+++ b/src/pages/Worker/Card/WorkerTimeControl.vue
@@ -2,6 +2,7 @@
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
+import { axiosNoError } from 'src/boot/axios';
import FetchData from 'components/FetchData.vue';
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
@@ -12,7 +13,6 @@ import WorkerTimeControlCalendar from 'pages/Worker/Card/WorkerTimeControlCalend
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
-import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import { useStateStore } from 'stores/useStateStore';
@@ -63,13 +63,16 @@ const selectedCalendarDates = ref([]);
const selectedDateFormatted = ref(toDateString(defaultDate.value));
const arrayData = useArrayData('workerData');
-
+const acl = useAcl();
const worker = computed(() => 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) {
@@ -349,16 +326,20 @@ const updateData = async () => {
};
const getMailStates = async (date) => {
+ const url = `WorkerTimeControls/${route.params.id}/getMailStates`;
+ const month = date.getMonth() + 1;
+ const prevMonth = month == 1 ? 12 : month - 1;
const params = {
- month: date.getMonth() + 1,
+ month,
year: date.getFullYear(),
};
- const { data } = await axios.get(
- `WorkerTimeControls/${route.params.id}/getMailStates`,
- { params }
- );
- workerTimeControlMails.value = data;
+ const curMonthStates = (await axios.get(url, { params })).data;
+ const prevMonthStates = (
+ await axios.get(url, { params: { ...params, month: prevMonth } })
+ ).data;
+
+ workerTimeControlMails.value = curMonthStates.concat(prevMonthStates);
};
const showWorkerTimeForm = (propValue, formType) => {
@@ -449,7 +430,7 @@ onMounted(async () => {
{
@click="isSatisfied()"
/>
{
{
{{ secondsToHoursMinutes(day.dayData?.workedHours) }}
-
{{ t('Add time') }}
-
+
diff --git a/src/pages/Worker/WorkerCreate.vue b/src/pages/Worker/WorkerCreate.vue
index 297aa4182..b51209879 100644
--- a/src/pages/Worker/WorkerCreate.vue
+++ b/src/pages/Worker/WorkerCreate.vue
@@ -194,7 +194,6 @@ async function autofillBic(worker) {
handleLocation(data, location)"
:disable="formData.isFreelance"
>
diff --git a/src/pages/Worker/WorkerDepartmentTree.vue b/src/pages/Worker/WorkerDepartmentTree.vue
index 392539c86..c73cb59b9 100644
--- a/src/pages/Worker/WorkerDepartmentTree.vue
+++ b/src/pages/Worker/WorkerDepartmentTree.vue
@@ -180,17 +180,18 @@ function handleEvent(type, event, node) {
{{ t('Remove') }}
-
{{ t('Create') }}
-
+