From 21c0216d67468eb032a08a48ed2640e427a99cda Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:21:51 +0300 Subject: [PATCH] P-47 --- .../calendar_of_events/event-create.vue | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/front/src/components/calendar_of_events/event-create.vue b/src/front/src/components/calendar_of_events/event-create.vue index 37e31f8e1..4da47e789 100644 --- a/src/front/src/components/calendar_of_events/event-create.vue +++ b/src/front/src/components/calendar_of_events/event-create.vue @@ -31,8 +31,20 @@ + + @@ -206,27 +218,27 @@ export default { const accountStore = useAccountStore(); const newStaff = computed({ get() { - - let ns = [] - let indCal = propsEvent.value.mycalendars.findIndex(e=>e.id ==propsEvent.value.event.calendar ) - - + let ns = []; + let indCal = propsEvent.value.mycalendars.findIndex( + (e) => e.id == propsEvent.value.event.calendar + ); + console.log(indCal); + staff.value.forEach((e) => { let emp = { ...e }; - emp.employees = e.employees.filter((n) => - { - if (n.id ==accountStore.user.is_idEmployee) { - n.selected = true + emp.employees = e.employees.filter((n) => { + if (n.id == accountStore.user.is_idEmployee) { + n.selected = true; } - - return propsEvent.value.mycalendars[indCal].participant.some(part => part.id === n.id) - // == n.id - } - ); - - if (emp.employees.length > 0) ns.push(emp) - + return propsEvent.value.mycalendars[indCal].participant.some( + (part) => part.id === n.id + ); + // == n.id + }); + + if (emp.employees.length > 0) ns.push(emp); + // if (propsEvent.value.event.participant.length > 0) { // e.employees.forEach((empl) => { // let ab = propsEvent.value.event.participant.find( @@ -347,7 +359,6 @@ export default { // propsEvent.value.event.participant.push(e.id) ); - }; const dateEvent = computed({ @@ -357,7 +368,7 @@ export default { set(newValue) { let dateParts = newValue.split("."); - + // let d = new Date(propsEvent.value.event.date_start).setFullYear(parseInt(dateParts[2], 10), parseInt(dateParts[1], 10), parseInt(dateParts[0], 10)) // let d = new Date(propsEvent.value.event.date_start).setDate(new Date(2024,01,01)) // propsEvent.value.event.date_start = new Date(2024,01,01); @@ -370,11 +381,10 @@ export default { let postEvent = new FormData(); postEvent.append("event", JSON.stringify({ ...propsEvent.value.event })); if (propsEvent.value.event.files !== null) { - files.value.forEach((e) => postEvent.append("files", e)); // postEvent.append("files", propsEvent.value.event.files[0]); } - + axiosApiInstance .post("api/calendar_of_events/my_events/", postEvent) .then((res) => {