From a170ae017a61b6052d5a08d0dd58051322b3bff8 Mon Sep 17 00:00:00 2001
From: iriska-gri <79623434+iriska-gri@users.noreply.github.com>
Date: Tue, 9 Jul 2024 15:40:00 +0300
Subject: [PATCH] P-47
---
.../calendar-create-select.vue | 83 +++++--------------
1 file changed, 22 insertions(+), 61 deletions(-)
diff --git a/src/front/src/components/calendar_of_events/calendar-create-select.vue b/src/front/src/components/calendar_of_events/calendar-create-select.vue
index f4c3a692c..eb3f30992 100644
--- a/src/front/src/components/calendar_of_events/calendar-create-select.vue
+++ b/src/front/src/components/calendar_of_events/calendar-create-select.vue
@@ -17,7 +17,6 @@
{{ item.title }}
-
-
-
-
-
-
ВСЕ СОТРУДНИКИ
@@ -59,44 +53,39 @@
@click.stop=""
density="compact"
class="text-body-2"
-
>
-
-
-
+
-
{{ x.title }}
@@ -129,12 +118,10 @@ export default {
const back = ref([]);
const staffed = computed({
get() {
-
if (props.okey == "editor") {
let ns = [];
props.staff.forEach((e) => {
let emp = { ...e };
-
emp.employees = e.employees.filter((n) => n.selected == true);
if (emp.employees.length > 0) ns.push(emp);
});
@@ -144,17 +131,15 @@ export default {
e.editor = true;
}
});
-
return ns;
}
-
return props.staff;
},
});
const selectedStaff = computed({
+
get() {
let selected = [];
-
props.staff.forEach((e) => {
if (e.employees.every((n) => n[props.okey] == true)) {
e[props.okey] = true;
@@ -168,57 +153,37 @@ export default {
},
set(item) {
-
- console.log(item, '0')
if ("employees" in item) {
-
item.employees.forEach((e) => {
-
if (e.id != accountStore.user.is_idEmployee) {
- e[props.okey] = !e[props.okey];
+ e[props.okey] = !item[props.okey];
}
});
- console.log(item, '1')
emit("returnIdParticant", {
okey: props.okey,
staff: item.employees,
});
} else if (item.length) {
- console.log(item, '2')
-
- let val = item.every((e) => e[props.okey] == true) ? false : true;
-
-
- cbstaff(item, val);
- console.log(back.value, '1111back.value')
- emit("returnIdParticant", { okey: props.okey, staff: back.value });
- back.value = []
- // if (val == true) {
- // back.value = []
- // console.log(back.value, 'b1111111111111111111111111ack.value')
- // }
- console.log(back.value.length, 'back.value')
-
+ if (item[0].id != accountStore.user.is_idEmployee) {
+ let val = item.every((e) => e[props.okey] == true) ? false : true;
+ cbstaff(item, val);
+ emit("returnIdParticant", { okey: props.okey, staff: back.value });
+ back.value = [];
+ }
} else {
- console.log(item, '3')
item[props.okey] = !item[props.okey];
-
emit("returnIdParticant", { okey: props.okey, staff: [item] });
}
},
});
const cbstaff = (item, value) => {
-
item.forEach((e) => {
if (e.id != accountStore.user.is_idEmployee) {
e[props.okey] = value;
}
-
if (!("employees" in e)) {
- console.log(e, '---------------------------------------------------')
back.value.push(e);
-
}
if ("employees" in e) {
cbstaff(e.employees, value);
@@ -227,7 +192,6 @@ export default {
};
function onFilter(item, itemText) {
-
return (
item.includes(filtered.value) ||
itemText.raw.employees.some((e) =>
@@ -236,15 +200,12 @@ export default {
);
}
- const disable = (empl) => {
- console.log(empl, 'empl')
- let d = (staffed.value.length == 1 && staffed.value[0].employees.length == 1)
-
-return false
-
-
-// return false
-};
+ const disable = (department) => {
+ return department.id == accountStore.user.id_dict_department &&
+ department.employees.length == 1
+ ? true
+ : false;
+ };
return {
staffed,
@@ -253,7 +214,7 @@ return false
selectedStaff,
splitname,
onFilter,
- disable
+ disable,
};
},
};