P-47
This commit is contained in:
1 parent
48f06c886e
commit
31110bafe8
4 files changed
+76
-64
No files matched your search
@@ -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(1)
|
||||
|
||||
const getMonth = (month) => {
|
||||
MyMonth.value = month + 1;
|
||||
@@ -151,6 +151,7 @@ export default {
|
||||
.get(`api/calendar_of_events/my_events/${idEvent.value==null?'':`?id=${idEvent.value}`}`)
|
||||
.then((res) => {
|
||||
eventFromCalendar.value = res.data
|
||||
|
||||
if (idEvent.value==null) {
|
||||
eventFromCalendar.value.event = {name:'', participant: [accountStore.user.is_idEmployee], files: [], date_start: new Date(), date_end: new Date(), period: null, description: '', calendar: null}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ export default {
|
||||
const filtered = ref("");
|
||||
const accountStore = useAccountStore();
|
||||
const back = ref([]);
|
||||
|
||||
const staffed = computed({
|
||||
get() {
|
||||
if (props.okey == "editor") {
|
||||
@@ -141,22 +142,25 @@ export default {
|
||||
const selectedStaff = computed({
|
||||
get() {
|
||||
let selected = [];
|
||||
|
||||
props.staff.forEach((e) => {
|
||||
// console.log(e, 'eeeeeeeeeeeee')
|
||||
if (e.employees.every((n) => n[props.okey] == true)) {
|
||||
// console.log(e.employees.length, 'if')
|
||||
e[props.okey] = true;
|
||||
selected.push(e);
|
||||
} else {
|
||||
// console.log(e, 'else eeeeeeeeeeeee')
|
||||
e[props.okey] = false;
|
||||
selected.push(...e.employees.filter((n) => n[props.okey] == true));
|
||||
}
|
||||
});
|
||||
|
||||
emit("returnIdParticant", {
|
||||
okey: props.okey,
|
||||
select: selected,
|
||||
staff: [],
|
||||
});
|
||||
console.log(selected, "geet selected");
|
||||
// emit("returnIdParticant", {
|
||||
// okey: props.okey,
|
||||
// select: selected,
|
||||
// staff: [],
|
||||
// });
|
||||
return selected;
|
||||
},
|
||||
|
||||
@@ -174,7 +178,6 @@ export default {
|
||||
|
||||
const emitUp = (part) => {
|
||||
if ("employees" in part) {
|
||||
console.log(part, "1");
|
||||
part.employees.forEach((e) => {
|
||||
if (e.id != accountStore.user.is_idEmployee) {
|
||||
e[props.okey] = !part[props.okey];
|
||||
@@ -186,7 +189,6 @@ export default {
|
||||
select: [],
|
||||
});
|
||||
} else if (part.length) {
|
||||
console.log(part, "2");
|
||||
if (part[0].id != accountStore.user.is_idEmployee) {
|
||||
let val = part.every((e) => e[props.okey] == true) ? false : true;
|
||||
cbstaff(part, val);
|
||||
@@ -198,7 +200,6 @@ export default {
|
||||
back.value = [];
|
||||
}
|
||||
} else {
|
||||
console.log(part, "3");
|
||||
part[props.okey] = !part[props.okey];
|
||||
emit("returnIdParticant", {
|
||||
okey: props.okey,
|
||||
@@ -240,9 +241,6 @@ export default {
|
||||
|
||||
const allUser = () => {
|
||||
emitUp(staffed.value);
|
||||
|
||||
console.log(staffed.value);
|
||||
// selectedStaff =
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@@ -113,7 +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
|
||||
@@ -121,6 +121,7 @@ export default {
|
||||
let ind = propsCalendar.value.participant.find(
|
||||
(l) => l.participant_calendar == e.id
|
||||
);
|
||||
console.log(indx, ind, 'inxind')
|
||||
if (idPart.okey == "editor") {
|
||||
ind.editor = e.editor;
|
||||
} else {
|
||||
|
||||
@@ -31,12 +31,9 @@
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
|
||||
:staff="newStaff"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/>
|
||||
|
||||
</v-col
|
||||
/> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
@@ -53,7 +50,7 @@
|
||||
density="compact"
|
||||
class="py-3"
|
||||
return-object
|
||||
>
|
||||
>
|
||||
<template v-slot:selection="{ item }">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
@@ -174,7 +171,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref } from "vue";
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
@@ -197,6 +194,8 @@ export default {
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
});
|
||||
|
||||
|
||||
|
||||
const staff = ref([]);
|
||||
|
||||
axiosApiInstance
|
||||
@@ -210,16 +209,22 @@ export default {
|
||||
|
||||
const newStaff = computed({
|
||||
get() {
|
||||
|
||||
let ns = [];
|
||||
console.log(propsEvent.value.event.participant, '------------propsEvent.value.event.participant')
|
||||
let indCal = propsEvent.value.mycalendars.findIndex(
|
||||
(e) => e.id == calendar.value[0].id
|
||||
);
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
|
||||
let emp = { ...e };
|
||||
emp.employees = e.employees.filter((n) => {
|
||||
if (n.id == accountStore.user.is_idEmployee) {
|
||||
|
||||
if (
|
||||
n.id == accountStore.user.is_idEmployee ||
|
||||
propsEvent.value.event.participant.some((e) => n.id == e)
|
||||
) {
|
||||
|
||||
n.selected = true;
|
||||
}
|
||||
|
||||
@@ -244,7 +249,7 @@ export default {
|
||||
// });
|
||||
// }
|
||||
});
|
||||
|
||||
console.log(ns, " ns---------------");
|
||||
return ns;
|
||||
},
|
||||
});
|
||||
@@ -289,6 +294,7 @@ export default {
|
||||
return files.value;
|
||||
},
|
||||
set(newValue) {
|
||||
// console.log(newValue,'file')
|
||||
newValue.forEach((e) => {
|
||||
if (!files.value.some((l) => l.name == e.name.split(" ").join("_"))) {
|
||||
files.value.push(e);
|
||||
@@ -303,7 +309,6 @@ export default {
|
||||
|
||||
const calendar = computed({
|
||||
get() {
|
||||
|
||||
// propsEvent.value.event.participant = [accountStore.user.is_idEmployee]
|
||||
let selected = [];
|
||||
if (propsEvent.value.event.calendar) {
|
||||
@@ -313,14 +318,14 @@ export default {
|
||||
selected.push({
|
||||
cl_name: propsEvent.value.mycalendars[ind].cl_name,
|
||||
cl_color: propsEvent.value.mycalendars[ind].cl_color,
|
||||
id: propsEvent.value.mycalendars[ind].id
|
||||
id: propsEvent.value.mycalendars[ind].id,
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
selected.push({
|
||||
cl_name: propsEvent.value.mycalendars[0].cl_name,
|
||||
cl_color: propsEvent.value.mycalendars[0].cl_color,
|
||||
id: propsEvent.value.mycalendars[0].id})
|
||||
id: propsEvent.value.mycalendars[0].id,
|
||||
});
|
||||
}
|
||||
|
||||
return selected;
|
||||
@@ -331,15 +336,15 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
// const newStaff = computed({
|
||||
// get() {
|
||||
// let ns = []
|
||||
// const newStaff = computed({
|
||||
// get() {
|
||||
// let ns = []
|
||||
|
||||
// return ns
|
||||
// },
|
||||
// set() {
|
||||
// return ns
|
||||
// },
|
||||
// set() {
|
||||
|
||||
// }})
|
||||
// }})
|
||||
|
||||
const titleCard = ref("");
|
||||
const newEvent = ref(false);
|
||||
@@ -355,46 +360,53 @@ export default {
|
||||
|
||||
calendarNewOrOld();
|
||||
|
||||
const part = new Set()
|
||||
const part = new Set();
|
||||
|
||||
const returnIdParticant = (idPart) => {
|
||||
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) {
|
||||
console.log(e, 'eeeeeeeeeeeeeeeeee')
|
||||
part.add(e.id)
|
||||
} else {
|
||||
part.delete(e.id)
|
||||
}
|
||||
|
||||
idPart.staff.forEach((e)=> {
|
||||
if(e.selected == true && !propsEvent.value.event.participant.includes(e.id)) {
|
||||
propsEvent.value.event.participant.push(e.id)
|
||||
}
|
||||
else {
|
||||
|
||||
let ind = propsEvent.value.event.participant.findIndex(
|
||||
(l) => l == e.id
|
||||
)
|
||||
|
||||
if (ind != -1) {
|
||||
propsEvent.value.event.participant.splice(ind, 1);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
propsEvent.value.event.participant = [...part]
|
||||
};
|
||||
|
||||
watch(
|
||||
() => propsEvent.value.event.calendar,
|
||||
(newValue, oldValue) => {
|
||||
if (newValue) {
|
||||
|
||||
const cbSelect = (item) => {
|
||||
|
||||
console.log(item, '-----------------------------------------------------')
|
||||
item.forEach((e)=> {
|
||||
|
||||
console.log(propsEvent.value.event.participant , '---newValue')
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const cbSelect = (item, arr) => {
|
||||
|
||||
item.forEach((e) => {
|
||||
if (!("employees" in e)) {
|
||||
part.add(e.id)
|
||||
if (!propsEvent.value.event.participant.includes(e.id)) {
|
||||
propsEvent.value.event.participant.push(e.id);
|
||||
}
|
||||
}
|
||||
if ("employees" in e) {
|
||||
cbSelect(e.employees);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const dateEvent = computed({
|
||||
get() {
|
||||
|
||||
Reference in new issue
Block a user