This commit is contained in:
iriska-gri committed 2024-07-09 16:21:51 +03:00
1 parent a170ae017a
commit 21c0216d67
1 file changed
+31 -21
@@ -31,8 +31,20 @@
</v-col> </v-col>
<v-col> <v-col>
<calendar-create-select <calendar-create-select
v-if="calendar.length > 0"
:staff="newStaff" :staff="newStaff"
@returnIdParticant="returnIdParticant" @returnIdParticant="returnIdParticant"
/>
<v-autocomplete
v-else
label="Выберите из списка или найдите по ФИО"
variant="outlined"
density="compact"
hide-details
class="max-height-select py-3"
disabled
return-object
/> </v-col /> </v-col
></v-row> ></v-row>
@@ -206,27 +218,27 @@ export default {
const accountStore = useAccountStore(); const accountStore = useAccountStore();
const newStaff = computed({ const newStaff = computed({
get() { get() {
let ns = [];
let ns = [] let indCal = propsEvent.value.mycalendars.findIndex(
let indCal = propsEvent.value.mycalendars.findIndex(e=>e.id ==propsEvent.value.event.calendar ) (e) => e.id == propsEvent.value.event.calendar
);
console.log(indCal);
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) { n.selected = true;
n.selected = true
} }
return propsEvent.value.mycalendars[indCal].participant.some(part => part.id === n.id)
// == n.id
}
); return propsEvent.value.mycalendars[indCal].participant.some(
(part) => part.id === n.id
if (emp.employees.length > 0) ns.push(emp) );
// == n.id
});
if (emp.employees.length > 0) ns.push(emp);
// if (propsEvent.value.event.participant.length > 0) { // if (propsEvent.value.event.participant.length > 0) {
// e.employees.forEach((empl) => { // e.employees.forEach((empl) => {
// let ab = propsEvent.value.event.participant.find( // let ab = propsEvent.value.event.participant.find(
@@ -347,7 +359,6 @@ export default {
// propsEvent.value.event.participant.push(e.id) // propsEvent.value.event.participant.push(e.id)
); );
}; };
const dateEvent = computed({ const dateEvent = computed({
@@ -357,7 +368,7 @@ export default {
set(newValue) { set(newValue) {
let dateParts = newValue.split("."); 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).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)) // 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); // propsEvent.value.event.date_start = new Date(2024,01,01);
@@ -370,11 +381,10 @@ export default {
let postEvent = new FormData(); let postEvent = new FormData();
postEvent.append("event", JSON.stringify({ ...propsEvent.value.event })); postEvent.append("event", JSON.stringify({ ...propsEvent.value.event }));
if (propsEvent.value.event.files !== null) { if (propsEvent.value.event.files !== null) {
files.value.forEach((e) => postEvent.append("files", e)); files.value.forEach((e) => postEvent.append("files", e));
// postEvent.append("files", propsEvent.value.event.files[0]); // postEvent.append("files", propsEvent.value.event.files[0]);
} }
axiosApiInstance axiosApiInstance
.post("api/calendar_of_events/my_events/", postEvent) .post("api/calendar_of_events/my_events/", postEvent)
.then((res) => { .then((res) => {