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