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