From 31fd9fbfb4c4b0c20d791ccab64e87bbd42b60f9 Mon Sep 17 00:00:00 2001
From: iriska-gri <79623434+iriska-gri@users.noreply.github.com>
Date: Wed, 3 Jul 2024 16:42:23 +0300
Subject: [PATCH] =?UTF-8?q?P-42=20=D0=97=D0=B0=D0=B2=D0=B5=D1=80=D1=88?=
=?UTF-8?q?=D0=B5=D0=BD=D0=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../UI_calendar/dialogCreate.vue | 5 +-
.../calendar-create-select.vue | 62 ++++++++++++++-----
.../calendar_of_events/calendar-create.vue | 45 +++++++++-----
3 files changed, 77 insertions(+), 35 deletions(-)
diff --git a/src/front/src/components/calendar_of_events/UI_calendar/dialogCreate.vue b/src/front/src/components/calendar_of_events/UI_calendar/dialogCreate.vue
index 6589f8acf..6b71a72d1 100644
--- a/src/front/src/components/calendar_of_events/UI_calendar/dialogCreate.vue
+++ b/src/front/src/components/calendar_of_events/UI_calendar/dialogCreate.vue
@@ -15,11 +15,12 @@
@@ -41,7 +42,7 @@
width="150"
type="transformation"
>
- {{ newOrOld ? "Создать" : "Редактировать" }}
+ {{ title =="Новый календарь" ? "Создать" : "Редактировать" }}
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 c6670b8ec..949d1e9c1 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
@@ -1,7 +1,7 @@
-
-
+
ВСЕ СОТРУДНИКИ
@@ -74,6 +73,7 @@
)"
:key="x.id"
:value="x.title"
+ :disabled="x.id == accountStore.user.is_idEmployee"
@click.stop="selectedStaff = x"
density="compact"
>
@@ -112,7 +112,28 @@ export default {
const filtered = ref("");
const accountStore = useAccountStore();
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);
+ });
+
+ ns.forEach((e) => {
+ if (e.employees.every((w) => w.editor == true)) {
+ e.editor = true;
+ }
+ });
+
+ return ns;
+ }
+ return props.staff;
+ },
+ });
const selectedStaff = computed({
get() {
let selected = [];
@@ -134,7 +155,9 @@ export default {
set(item) {
if ("employees" in item) {
item.employees.forEach((e) => {
- account(e);
+ if (e.id != accountStore.user.is_idEmployee) {
+ e[props.okey] = !e[props.okey];
+ }
});
emit("returnIdParticant", {
@@ -143,31 +166,36 @@ export default {
});
} else if (item.length) {
let val = item.every((e) => e[props.okey] == true) ? false : true;
+ // console.log(item, "GJVTYZKCZ");
cbstaff(item, val);
emit("returnIdParticant", { okey: props.okey, staff: back.value });
} else {
- account(item)
-
+ // account(item)
+
+ item[props.okey] = !item[props.okey];
emit("returnIdParticant", { okey: props.okey, staff: [item] });
}
},
});
- const account = (val) => {
- if (props.okey == "selected") {
- if (val.id != accountStore.user.is_idEmployee) {
- val.selected = !val.selected;
- } else {
- val.editor = !val.editor;
- }
- }
- };
+ // const account = (val) => {
+ // if (props.okey == "selected") {
+ // if (val.id != accountStore.user.is_idEmployee) {
+ // val.selected = !val.selected;
+ // } else {
+ // val.editor = !val.editor;
+ // }
+ // }
+ // };
const cbstaff = (item, value) => {
item.forEach((e) => {
- account(e);
+ // account(e);
+ if (e.id != accountStore.user.is_idEmployee) {
+ e[props.okey] = value;
+ }
if (!("employees" in e)) {
back.value.push(e);
@@ -176,6 +204,7 @@ export default {
cbstaff(e.employees, value);
}
});
+ console.log(item, "item");
};
function onFilter(item, itemText) {
@@ -188,6 +217,7 @@ export default {
}
return {
+ staffed,
filtered,
accountStore,
selectedStaff,
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 9f28b1587..949afd160 100644
--- a/src/front/src/components/calendar_of_events/calendar-create.vue
+++ b/src/front/src/components/calendar_of_events/calendar-create.vue
@@ -68,7 +68,7 @@
Редакторы
@@ -127,18 +127,20 @@ export default {
idPart.staff.forEach((e) => {
if(idPart.okey == 'editor') {
- let ind = propsCalendar.value.participant.findIndex(
+ let ind = propsCalendar.value.participant.find(
(l) => l.participant_calendar == e.id
)
- if (ind >= 0) {
- propsCalendar.value.participant[ind].editor = e.editor
- }
- else {
- propsCalendar.value.participant.push({
- editor: e.editor,
- participant_calendar: e.id,
- });
- }
+ console.log(ind);
+ ind.editor = e.editor
+ // if (ind >= 0) {
+ // propsCalendar.value.participant[ind].editor = e.editor
+ // }
+ // else {
+ // propsCalendar.value.participant.push({
+ // editor: e.editor,
+ // participant_calendar: e.id,
+ // });
+ // }
}
else {
@@ -152,6 +154,7 @@ export default {
(l) => l.participant_calendar == e.id
);
propsCalendar.value.participant.splice(ind, 1);
+
}
}
});
@@ -175,10 +178,13 @@ export default {
const newCalendar = ref(false);
const calendarNewOrOld = () => {
+ console.log(propsCalendar.value, '------propsCalendar.valuepropsCalendar.value')
if (propsCalendar.value.hasOwnProperty("id")) {
titleCard.value = "Редактирование календаря";
+ if(propsCalendar.value.author!=accountStore.user.is_idEmployee ) newCalendar.value = true
} else {
titleCard.value = "Новый календарь";
+
newCalendar.value = true;
}
};
@@ -224,25 +230,30 @@ export default {
const newStaff = computed({
get() {
+
staff.value.forEach((e) => {
+
if (propsCalendar.value.participant.length > 0) {
e.employees.forEach((empl) => {
- let a =
+
+ let ab =
propsCalendar.value.participant.find(
(a) => a.participant_calendar === empl.id
)
- if (
- a
- ) {
+ if (ab) {
empl.selected = true;
- empl.editor = a.editor
+ empl.editor = ab.editor
}
+ else {
+ empl.selected = false;
+ empl.editor = false
+ }
});
}
});
-
+ // console.log(staff.value);
return staff.value;
},
});