This commit is contained in:
iriska-gri committed 2024-07-03 08:16:13 +03:00
1 parent a478dae14e
commit f4a442244e
2 files changed
+23 -22

No files matched your search

@@ -122,7 +122,7 @@ export default {
props.staff.forEach((e) => { props.staff.forEach((e) => {
e.employees e.employees
.filter((n) => n.selected == true) .filter((n) => n.selected == true)
.map((res) => { .forEach((res) => {
idEmployees.push({ idEmployees.push({
participant_calendar: res.id, participant_calendar: res.id,
}); });
@@ -136,7 +136,7 @@ export default {
} }
}); });
emit("returnIdParticant", idEmployees, selected); emit("returnIdParticant", idEmployees);
return selected; return selected;
}); });
@@ -100,7 +100,7 @@
</template> </template>
<script> <script>
import { computed, ref} from "vue"; import { computed, ref } from "vue";
import { axiosApiInstance } from "@/utils/axios-api"; import { axiosApiInstance } from "@/utils/axios-api";
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue"; import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
import { useAlertStore } from "@/store/useAlertStore"; import { useAlertStore } from "@/store/useAlertStore";
@@ -120,23 +120,25 @@ export default {
setup(props, { emit }) { setup(props, { emit }) {
const postParticant = {}; const postParticant = {};
const form_calendar = ref(null); const form_calendar = ref(null);
const for_editor = ref([]) const for_editor = ref([]);
const accountStore = useAccountStore(); const accountStore = useAccountStore();
const returnIdParticant = (idPart, selected) => { const returnIdParticant = (idPart, selected) => {
// for_editor.value = selected.map((e) => {
// if (e.id != accountStore.user.is_idEmployee) {
// e.selected = false
// }
// console.log(e, 'e')
// return e
// })
selected.forEach((val, key) => {
for_editor.value[key] = val
})
// for_edit = selected.slice() // for_edit = selected.slice()
// for_editor.value // for_editor.value
// .forEach((e)=> { // .forEach((e)=> {
// e.selected = false // e.selected = false
// if(e.employees) { // if(e.employees) {
// e.employees.forEach((p)=> { // e.employees.forEach((p)=> {
@@ -146,17 +148,18 @@ export default {
// else { // else {
// p.selected = true // p.selected = true
// } // }
// } // }
// ) // )
// } // }
// }) // })
console.log(for_editor.value, 'for_edit.value') // console.log( staff.value, 'for_edit.value')
postParticant.value = { ...props.calendar, participant: idPart }; postParticant.value = { ...props.calendar, participant: idPart };
console.log(postParticant.value, 'postParticant.value')
}; };
const propsCalendar = computed({ const propsCalendar = computed({
@@ -186,7 +189,6 @@ export default {
calendarNewOrOld(); calendarNewOrOld();
const postCalendar = (val) => { const postCalendar = (val) => {
if (val) { if (val) {
axiosApiInstance axiosApiInstance
.post(`api/calendar_of_events/my_calendars/`, postParticant.value) .post(`api/calendar_of_events/my_calendars/`, postParticant.value)
@@ -206,19 +208,18 @@ export default {
axiosApiInstance axiosApiInstance
.get("api/calendar_of_events/get_employees/") .get("api/calendar_of_events/get_employees/")
.then((res) => { .then((res) => {
console.log(res.data, "res.data");
staff.value = res.data.filter((e) => e.employees.length > 0); staff.value = res.data.filter((e) => e.employees.length > 0);
// console.log(staff.value, "propsCalendar.value");
staff.value.forEach((e) => { staff.value.forEach((e) => {
console.log(propsCalendar.value.participant, 'propsCalendar.value.participant')
if (propsCalendar.value.participant.length > 0) { if (propsCalendar.value.participant.length > 0) {
e.employees.forEach((empl) => { e.employees.forEach((empl) => {
if ( if (
propsCalendar.value.participant.find( propsCalendar.value.participant.find(
(a) => a.participant_calendar === empl.id (a) => a.participant_calendar === empl.id
) )
) { ) {
empl.selected = true; empl.selected = true;
// empl.editor =
} }
}); });
} }
@@ -279,7 +280,7 @@ export default {
form_calendar, form_calendar,
titleCard, titleCard,
newCalendar, newCalendar,
staff staff,
}; };
}, },
}; };