P-47 delete event
This commit is contained in:
1 parent
dac26595fc
commit
bd04bd6d08
4 files changed
+54
-29
No files matched your search
@@ -42,7 +42,7 @@
|
||||
width="150"
|
||||
type="transformation"
|
||||
>
|
||||
{{ title =="Новый календарь" ? "Создать" : "Редактировать" }}
|
||||
{{ newOrOld ? "Создать" : "Редактировать" }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
|
||||
@@ -144,12 +144,7 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
// if (propsCalendar.value.participant.length == 0) {
|
||||
// propsCalendar.value.participant.push({
|
||||
// editor: true,
|
||||
// participant_calendar: accountStore.user.is_idEmployee,
|
||||
// });
|
||||
// }
|
||||
|
||||
};
|
||||
|
||||
const propsCalendar = computed({
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
:newOrOld="newEvent"
|
||||
@postData="postData"
|
||||
@closeDialog="$emit('closeDialog')"
|
||||
@delObject="delEvent(propsEvent.event.id)"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
@@ -22,6 +23,7 @@
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsEvent.event.name"
|
||||
:rules="rules.name"
|
||||
></v-textarea> </v-col
|
||||
></v-row>
|
||||
|
||||
@@ -170,6 +172,7 @@ import { useAccountStore } from "@/store/AccountStore";
|
||||
import UploadingFile from "@/components/UI/defaultportal/uploading-file.vue";
|
||||
import ReminderEvent from "@/components/calendar_of_events/UI_calendar/reminderEvent.vue";
|
||||
import PeriodEvents from "@/components/calendar_of_events/UI_calendar/periodEvents.vue";
|
||||
import { useAlertStore } from "@/store/useAlertStore";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -193,6 +196,14 @@ export default {
|
||||
get: () => props.eventCalendar,
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
});
|
||||
const feedalert = useAlertStore().alert;
|
||||
const req = (val) => {
|
||||
return !!val || "Поле обязательно";
|
||||
};
|
||||
|
||||
const rules = {
|
||||
name: [(val) => req(val)],
|
||||
};
|
||||
|
||||
const staff = ref([]);
|
||||
|
||||
@@ -247,6 +258,20 @@ export default {
|
||||
return ns;
|
||||
},
|
||||
});
|
||||
|
||||
const delEvent = (idev) => {
|
||||
axiosApiInstance
|
||||
.delete(`api/calendar_of_events/my_events/?delid=${idev}`)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "orange-accent-1";
|
||||
|
||||
});
|
||||
emit("closeDialog");
|
||||
}
|
||||
|
||||
const files = ref([]);
|
||||
const postFiles = (f) => {
|
||||
files.value = f;
|
||||
@@ -273,7 +298,7 @@ export default {
|
||||
id: propsEvent.value.mycalendars[0].id,
|
||||
});
|
||||
}
|
||||
|
||||
propsEvent.value.event.calendar = propsEvent.value.mycalendars[0].id;
|
||||
return selected;
|
||||
},
|
||||
|
||||
@@ -282,15 +307,7 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
// const newStaff = computed({
|
||||
// get() {
|
||||
// let ns = []
|
||||
|
||||
// return ns
|
||||
// },
|
||||
// set() {
|
||||
|
||||
// }})
|
||||
|
||||
|
||||
const titleCard = ref("");
|
||||
const newEvent = ref(false);
|
||||
@@ -301,6 +318,7 @@ export default {
|
||||
} else {
|
||||
titleCard.value = "Новое событие";
|
||||
newEvent.value = true;
|
||||
console.log( newEvent.value, ' newEvent.value')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -342,6 +360,7 @@ export default {
|
||||
|
||||
const dateEvent = computed({
|
||||
get() {
|
||||
console.log('работает?')
|
||||
return formatComa(new Date(propsEvent.value.event.date_start));
|
||||
},
|
||||
|
||||
@@ -357,18 +376,27 @@ export default {
|
||||
const menudate = ref(false);
|
||||
|
||||
const postData = (validate) => {
|
||||
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) => {
|
||||
console.log(res, "res");
|
||||
});
|
||||
if (validate) {
|
||||
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));
|
||||
}
|
||||
|
||||
axiosApiInstance
|
||||
.post("api/calendar_of_events/my_events/", postEvent)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "green-darken-4";
|
||||
emit("closeDialog");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -383,6 +411,8 @@ export default {
|
||||
returnIdParticant,
|
||||
postFiles,
|
||||
postData,
|
||||
rules,
|
||||
delEvent
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user