From 565848b226e35ff8e99f0a84b69b4c9daff9c0ea Mon Sep 17 00:00:00 2001
From: iriska-gri <79623434+iriska-gri@users.noreply.github.com>
Date: Wed, 10 Jul 2024 11:03:39 +0300
Subject: [PATCH] P-47
---
.../calendar-create-select.vue | 71 ++++++++++++-------
.../calendar_of_events/calendar-create.vue | 3 +-
.../calendar_of_events/calendar-my.vue | 2 +-
.../calendar_of_events/event-calendar.vue | 1 -
.../calendar_of_events/event-create.vue | 63 +++++++++-------
.../calendar_of_events/event-dialog.vue | 2 +-
6 files changed, 89 insertions(+), 53 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 eb3f30992..4e90cfccc 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
@@ -60,13 +60,14 @@
:color="'indigo-darken-4'"
:true-value="true"
:false-value="false"
- :disabled="okey == 'editor' ? disable(item.raw) : false"
+ disabled
:indeterminate="
item.raw.employees.some((e) => e[okey] == true) &&
!item.raw.employees.every((e) => e[okey] == true)
"
:model-value="item.raw[okey]"
>
+
@@ -77,13 +78,14 @@
)"
:key="x.id"
:value="x.title"
- :disabled="x.id == accountStore.user.is_idEmployee"
+ disabled
@click.stop="selectedStaff = x"
density="compact"
>
+
@@ -137,7 +139,6 @@ export default {
},
});
const selectedStaff = computed({
-
get() {
let selected = [];
props.staff.forEach((e) => {
@@ -149,34 +150,54 @@ export default {
selected.push(...e.employees.filter((n) => n[props.okey] == true));
}
});
+
+ emit("returnIdParticant", {
+ okey: props.okey,
+ select: selected,
+ staff: [],
+ });
return selected;
},
set(item) {
- if ("employees" in item) {
- item.employees.forEach((e) => {
- if (e.id != accountStore.user.is_idEmployee) {
- e[props.okey] = !item[props.okey];
- }
- });
- emit("returnIdParticant", {
- okey: props.okey,
- staff: item.employees,
- });
- } else if (item.length) {
- 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 {
- item[props.okey] = !item[props.okey];
- emit("returnIdParticant", { okey: props.okey, staff: [item] });
- }
+ console.log(item, '----------------------')
+ emitUp(item);
},
});
+ const emitUp = (part) => {
+ if ("employees" in part) {
+ part.employees.forEach((e) => {
+ if (e.id != accountStore.user.is_idEmployee) {
+ e[props.okey] = !part[props.okey];
+ }
+ });
+ emit("returnIdParticant", {
+ okey: props.okey,
+ staff: part.employees,
+ select: [],
+ });
+ } else if (part.length) {
+ if (part[0].id != accountStore.user.is_idEmployee) {
+ let val = part.every((e) => e[props.okey] == true) ? false : true;
+ cbstaff(part, val);
+ emit("returnIdParticant", {
+ okey: props.okey,
+ staff: back.value,
+ select: [],
+ });
+ back.value = [];
+ }
+ } else {
+ part[props.okey] = !part[props.okey];
+ emit("returnIdParticant", {
+ okey: props.okey,
+ staff: [part],
+ select: [],
+ });
+ }
+ };
+
const cbstaff = (item, value) => {
item.forEach((e) => {
if (e.id != accountStore.user.is_idEmployee) {
diff --git a/src/front/src/components/calendar_of_events/calendar-create.vue b/src/front/src/components/calendar_of_events/calendar-create.vue
index fd0202c29..859148a4b 100644
--- a/src/front/src/components/calendar_of_events/calendar-create.vue
+++ b/src/front/src/components/calendar_of_events/calendar-create.vue
@@ -11,7 +11,7 @@
-
+
Название
@@ -113,6 +113,7 @@ export default {
const accountStore = useAccountStore();
const returnIdParticant = (idPart) => {
+ // console.log(idPart, '2222222222222222222222')
idPart.staff.forEach((e) => {
let indx = propsCalendar.value.participant.findIndex(
(l) => l.participant_calendar == e.id
diff --git a/src/front/src/components/calendar_of_events/calendar-my.vue b/src/front/src/components/calendar_of_events/calendar-my.vue
index 88541d012..bf7ac91ae 100644
--- a/src/front/src/components/calendar_of_events/calendar-my.vue
+++ b/src/front/src/components/calendar_of_events/calendar-my.vue
@@ -47,7 +47,7 @@
-
+
-
-
+
Название
@@ -31,21 +31,12 @@
-
@@ -66,7 +57,7 @@
@@ -219,14 +210,12 @@ export default {
const newStaff = computed({
get() {
- console.log(propsEvent.value);
- console.log(calendar.value, 'calendar')
+
let ns = [];
let indCal = propsEvent.value.mycalendars.findIndex(
(e) => e.id == calendar.value[0].id
);
- // console.log(indCal);
- // let indCal = 0
+
staff.value.forEach((e) => {
let emp = { ...e };
emp.employees = e.employees.filter((n) => {
@@ -314,6 +303,8 @@ export default {
const calendar = computed({
get() {
+
+ // propsEvent.value.event.participant = [accountStore.user.is_idEmployee]
let selected = [];
if (propsEvent.value.event.calendar) {
let ind = propsEvent.value.mycalendars.findIndex(
@@ -364,23 +355,47 @@ export default {
calendarNewOrOld();
+ const part = new Set()
+
const returnIdParticant = (idPart) => {
- idPart.staff.forEach(
+ if (idPart.select.length > 0){
+ part.clear()
+ cbSelect(idPart.select)
+
+ }
+ else {
+ console.log(idPart.staff, idPart.staff.length, 'e-----------------------------------------------------')
+ idPart.staff.forEach(
(e) => {
+
if (e.selected == true) {
- propsEvent.value.event.participant.push(e.id);
+ console.log(e, 'eeeeeeeeeeeeeeeeee')
+ part.add(e.id)
} else {
- let ind = propsEvent.value.event.participant.findIndex(
- (l) => l == e.id
- );
- propsEvent.value.event.participant.splice(ind, 1);
+ part.delete(e.id)
}
}
- // propsEvent.value.event.participant.push(e.id)
);
+ }
+
+ propsEvent.value.event.participant = [...part]
};
+
+ const cbSelect = (item) => {
+
+ console.log(item, '-----------------------------------------------------')
+ item.forEach((e)=> {
+ if (!("employees" in e)) {
+ part.add(e.id)
+ }
+ if ("employees" in e) {
+ cbSelect(e.employees);
+ }
+ })
+ }
+
const dateEvent = computed({
get() {
return formatComa(new Date(propsEvent.value.event.date_start));
diff --git a/src/front/src/components/calendar_of_events/event-dialog.vue b/src/front/src/components/calendar_of_events/event-dialog.vue
index e32cc6128..be436a737 100644
--- a/src/front/src/components/calendar_of_events/event-dialog.vue
+++ b/src/front/src/components/calendar_of_events/event-dialog.vue
@@ -1,7 +1,7 @@
-
+