From 6d359eeeb0bac9a3e2adf862c0f637541e4c02da Mon Sep 17 00:00:00 2001
From: iriska-gri <79623434+iriska-gri@users.noreply.github.com>
Date: Tue, 9 Jul 2024 13:48:37 +0300
Subject: [PATCH] P-47
---
.../calendar_of_events/BigCalendar.vue | 4 +-
.../calendar-create-select.vue | 90 ++++++++++++-------
.../calendar_of_events/calendar-create.vue | 40 ++++++---
.../calendar_of_events/calendar-my.vue | 1 +
4 files changed, 86 insertions(+), 49 deletions(-)
diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue
index d1a3349eb..7542bc65e 100644
--- a/src/front/src/components/calendar_of_events/BigCalendar.vue
+++ b/src/front/src/components/calendar_of_events/BigCalendar.vue
@@ -119,8 +119,8 @@ export default {
const MyMonth = ref(selectdate.value.getMonth() + 1);
const calendarForMy = ref([]);
const eventFromCalendar = ref({})
- // const idEvent = ref(null)
- const idEvent = ref(2)
+ const idEvent = ref(null)
+ // const idEvent = ref(2)
const getMonth = (month) => {
MyMonth.value = month + 1;
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 3b69e4dd6..f4c3a692c 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,7 @@
{{ item.title }}
-
+
+
@@ -33,9 +34,11 @@
+
+
ВСЕ СОТРУДНИКИ
@@ -56,7 +59,7 @@
@click.stop=""
density="compact"
class="text-body-2"
- :disabled="disable()"
+
>
@@ -65,36 +68,37 @@
:color="'indigo-darken-4'"
:true-value="true"
:false-value="false"
+
:indeterminate="
item.raw.employees.some((e) => e[okey] == true) &&
!item.raw.employees.every((e) => e[okey] == true)
"
- :model-value="disable() ? true : item.raw[okey]"
+ :model-value="item.raw[okey]"
>
+
-
+
-
+
- -->
+
{{ x.title }}
@@ -125,6 +129,7 @@ export default {
const back = ref([]);
const staffed = computed({
get() {
+
if (props.okey == "editor") {
let ns = [];
props.staff.forEach((e) => {
@@ -142,47 +147,60 @@ export default {
return ns;
}
+
return props.staff;
},
});
const selectedStaff = computed({
-
get() {
-
let selected = [];
props.staff.forEach((e) => {
- console.log(e, 'да гдееееееее')
- // if (e.employees.every((n) => n[props.okey] == true)) {
- // e[props.okey] = true;
- // selected.push(e);
- // } else {
- // e[props.okey] = false;
- // selected.push(...e.employees.filter((n) => n[props.okey] == true));
- // }
+ if (e.employees.every((n) => n[props.okey] == true)) {
+ e[props.okey] = true;
+ selected.push(e);
+ } else {
+ e[props.okey] = false;
+ selected.push(...e.employees.filter((n) => n[props.okey] == true));
+ }
});
return selected;
},
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];
}
});
-
+ console.log(item, '1')
emit("returnIdParticant", {
okey: props.okey,
staff: item.employees,
});
} else if (item.length) {
- console.log(item, 'newvalue')
+ 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')
+
} else {
+ console.log(item, '3')
item[props.okey] = !item[props.okey];
emit("returnIdParticant", { okey: props.okey, staff: [item] });
@@ -191,13 +209,16 @@ export default {
});
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);
@@ -206,6 +227,7 @@ export default {
};
function onFilter(item, itemText) {
+
return (
item.includes(filtered.value) ||
itemText.raw.employees.some((e) =>
@@ -214,13 +236,15 @@ export default {
);
}
- const disable = () => {
+ const disable = (empl) => {
+ console.log(empl, 'empl')
+ let d = (staffed.value.length == 1 && staffed.value[0].employees.length == 1)
- return (
- staffed.value.length == 1 && staffed.value[0].employees.length == 1
- );
- // return false
- };
+return false
+
+
+// return false
+};
return {
staffed,
@@ -229,7 +253,7 @@ export default {
selectedStaff,
splitname,
onFilter,
- disable,
+ disable
};
},
};
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 7ea7202db..fd0202c29 100644
--- a/src/front/src/components/calendar_of_events/calendar-create.vue
+++ b/src/front/src/components/calendar_of_events/calendar-create.vue
@@ -11,6 +11,7 @@
+
Название
@@ -113,26 +114,41 @@ export default {
const returnIdParticant = (idPart) => {
idPart.staff.forEach((e) => {
+ let indx = propsCalendar.value.participant.findIndex(
+ (l) => l.participant_calendar == e.id
+ );
+ let ind = propsCalendar.value.participant.find(
+ (l) => l.participant_calendar == e.id
+ );
if (idPart.okey == "editor") {
- let ind = propsCalendar.value.participant.find(
- (l) => l.participant_calendar == e.id
- );
-
ind.editor = e.editor;
} else {
if (e.selected == true) {
- propsCalendar.value.participant.push({
- editor: false,
- participant_calendar: e.id,
- });
+ if (e.id != accountStore.user.is_idEmployee) {
+ if (indx == -1) {
+ propsCalendar.value.participant.push({
+ editor: false,
+ participant_calendar: e.id,
+ });
+ }
+ }
} else {
let ind = propsCalendar.value.participant.findIndex(
(l) => l.participant_calendar == e.id
);
- propsCalendar.value.participant.splice(ind, 1);
+
+ if (ind != -1) {
+ propsCalendar.value.participant.splice(ind, 1);
+ }
}
}
});
+ // if (propsCalendar.value.participant.length == 0) {
+ // propsCalendar.value.participant.push({
+ // editor: true,
+ // participant_calendar: accountStore.user.is_idEmployee,
+ // });
+ // }
};
const propsCalendar = computed({
@@ -160,9 +176,7 @@ export default {
newCalendar.value = true;
}
- }
- ;
-
+ };
calendarNewOrOld();
const postCalendar = (val) => {
@@ -275,9 +289,7 @@ export default {
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 8f502d771..88541d012 100644
--- a/src/front/src/components/calendar_of_events/calendar-my.vue
+++ b/src/front/src/components/calendar_of_events/calendar-my.vue
@@ -121,6 +121,7 @@ export default {
cl_descr: "",
};
} else {
+
calendar.value = cal;
}
showDialog.value = true;