P-42 себя нельзя удалить из участников
This commit is contained in:
1 parent
d83c260e59
commit
ec98f90fd5
6 files changed
+271
-397
No files matched your search
@@ -129,6 +129,7 @@ export default {
|
||||
};
|
||||
|
||||
const getCalendar = () => {
|
||||
|
||||
axiosApiInstance
|
||||
.get(`api/calendar_of_events/my_calendars/`)
|
||||
.then((res) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-card min-height="436" class="pa-3 ">
|
||||
<v-card min-height="436" class="pa-3">
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
|
||||
{{ title }}
|
||||
<v-icon
|
||||
@@ -10,168 +10,42 @@
|
||||
/>
|
||||
</v-card-title>
|
||||
<v-form ref="form_valid" @submit.prevent="transformation">
|
||||
<v-card-text class="d-flex px-3">
|
||||
<slot name="card_text"></slot>
|
||||
</v-card-text>
|
||||
<v-card-actions class="justify-end">
|
||||
<v-btn
|
||||
icon="mdi-delete"
|
||||
variant="tonal"
|
||||
rounded
|
||||
size="36px"
|
||||
:disabled="!newOrOld"
|
||||
@click="$emit('delObject')"
|
||||
/>
|
||||
<v-card-text class="d-flex px-3">
|
||||
<slot name="card_text"></slot>
|
||||
</v-card-text>
|
||||
<v-card-actions class="justify-end">
|
||||
<v-btn
|
||||
icon="mdi-delete"
|
||||
variant="tonal"
|
||||
rounded
|
||||
size="36px"
|
||||
:disabled="newOrOld"
|
||||
@click="$emit('delObject')"
|
||||
/>
|
||||
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="$emit('closeDialog')"
|
||||
color="btn_gray"
|
||||
variant="flat"
|
||||
>Отменить</v-btn
|
||||
>
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="$emit('closeDialog')"
|
||||
color="btn_gray"
|
||||
variant="flat"
|
||||
>Отменить</v-btn
|
||||
>
|
||||
|
||||
<v-btn
|
||||
class="text-subtitle-1 font-weight-regular"
|
||||
color="btn_text"
|
||||
variant="flat"
|
||||
elevation="0"
|
||||
width="150"
|
||||
type="transformation"
|
||||
>
|
||||
|
||||
{{
|
||||
newOrOld? "Создать" : "Редактировать"
|
||||
}}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
<v-btn
|
||||
class="text-subtitle-1 font-weight-regular"
|
||||
color="btn_text"
|
||||
variant="flat"
|
||||
elevation="0"
|
||||
width="150"
|
||||
type="transformation"
|
||||
>
|
||||
{{ newOrOld ? "Создать" : "Редактировать" }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
<!--
|
||||
|
||||
<v-form ref="form_calendar" @submit.prevent="postCalendar">
|
||||
<v-card-text class="d-flex px-3">
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsCalendar.cl_name"
|
||||
:rules="rules.cl_name"
|
||||
></v-textarea></v-col
|
||||
></v-row>
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Цвет </v-col>
|
||||
<v-col v-for="(x, key) in color" :key="key">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
@click="colorPik(x, key)"
|
||||
size="x-small"
|
||||
:color="x"
|
||||
:variant="
|
||||
propsCalendar.cl_color === null
|
||||
? 'flat'
|
||||
: propsCalendar.cl_color === x
|
||||
? 'flat'
|
||||
: 'tonal'
|
||||
"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:participant="propsCalendar.participant"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-grow-0">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="4"
|
||||
variant="outlined"
|
||||
shaped
|
||||
no-resize
|
||||
:rules="rules.cl_descr"
|
||||
v-model="propsCalendar.cl_descr"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Редакторы
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:editor="true"
|
||||
:participant="
|
||||
propsCalendar.participant.filter((e) => e.editor == 1)
|
||||
"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col lg="1" class="text-center">
|
||||
<v-tooltip location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon v-bind="props" icon="mdi-help-circle-outline" />
|
||||
</template>
|
||||
<div class="custom-tooltip">
|
||||
Участники с доступом редактирования смогут изменять поля
|
||||
календаря, а также редактировать и удалять события
|
||||
</div>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
<v-card-actions class="justify-end">
|
||||
<v-btn
|
||||
icon="mdi-delete"
|
||||
variant="tonal"
|
||||
rounded
|
||||
size="36px"
|
||||
:disabled="!propsCalendar.hasOwnProperty('id')"
|
||||
@click="delCalendar(propsCalendar.id)"
|
||||
/>
|
||||
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="dialog_create_calendar = false"
|
||||
color="btn_gray"
|
||||
variant="flat"
|
||||
>Отменить</v-btn
|
||||
>
|
||||
|
||||
<v-btn
|
||||
class="text-subtitle-1 font-weight-regular"
|
||||
color="btn_text"
|
||||
variant="flat"
|
||||
elevation="0"
|
||||
width="150"
|
||||
type="postCalendar"
|
||||
>
|
||||
{{
|
||||
propsCalendar.hasOwnProperty("id") ? "Редактировать" : "Создать"
|
||||
}}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form> -->
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -186,25 +60,21 @@ export default {
|
||||
},
|
||||
|
||||
newOrOld: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, {emit}) {
|
||||
setup(props, { emit }) {
|
||||
const form_valid = ref(null);
|
||||
const transformation = () => {
|
||||
emit("postData", form_valid.value)
|
||||
}
|
||||
|
||||
emit("postData", form_valid.value.isValid);
|
||||
};
|
||||
|
||||
return {
|
||||
form_valid,
|
||||
transformation
|
||||
|
||||
}
|
||||
|
||||
form_valid,
|
||||
transformation,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<template>
|
||||
<!-- <div>
|
||||
{{staff}}
|
||||
</div> -->
|
||||
|
||||
<v-autocomplete
|
||||
v-model="selectedStaff"
|
||||
:items="staff"
|
||||
@@ -14,12 +18,12 @@
|
||||
class="max-height-select py-3"
|
||||
return-object
|
||||
>
|
||||
<!-- -->
|
||||
<template v-slot:selection="{ item }">
|
||||
<v-chip>
|
||||
<!-- {{item}} -->
|
||||
<span> {{ item.title }}</span>
|
||||
|
||||
<v-icon
|
||||
v-if="item.value != accountStore.user.is_idEmployee"
|
||||
icon="mdi-close-circle"
|
||||
size="x-small"
|
||||
class="ml-3"
|
||||
@@ -73,13 +77,18 @@
|
||||
)"
|
||||
:key="x.id"
|
||||
:value="x.title"
|
||||
@click.stop="x.selected = !x.selected"
|
||||
@click.stop="
|
||||
x.id != accountStore.user.is_idEmployee
|
||||
? (x.selected = !x.selected)
|
||||
: ''
|
||||
"
|
||||
density="compact"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-checkbox-btn
|
||||
color="indigo-darken-4"
|
||||
:model-value="x.selected"
|
||||
:disabled="x.id == accountStore.user.is_idEmployee"
|
||||
></v-checkbox-btn>
|
||||
</template>
|
||||
<span class="text-body-2"> {{ x.title }} </span>
|
||||
@@ -91,60 +100,32 @@
|
||||
|
||||
<script>
|
||||
import { ref, computed } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { splitname } from "@/utils/universal_functions";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
participant: {
|
||||
staff: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
editor: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const filtered = ref("");
|
||||
const staff = ref([]);
|
||||
|
||||
// const calendarParticipant = computed({
|
||||
// get: () => props.participant,
|
||||
// set: (value) => emit("update:participant", value),
|
||||
// });
|
||||
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
console.log(staff.value, 'staff.valuestaff.value')
|
||||
staff.value.forEach((e) => {
|
||||
if (props.participant.length > 0) {
|
||||
e.employees.forEach((empl) => {
|
||||
if (
|
||||
props.participant.find(
|
||||
(a) => a.participant_calendar === empl.id
|
||||
)
|
||||
) {
|
||||
empl.selected = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
const accountStore = useAccountStore();
|
||||
|
||||
const selectedStaff = computed(() => {
|
||||
|
||||
let selected = [];
|
||||
let idEmployees = [];
|
||||
|
||||
staff.value.forEach((e) => {
|
||||
props.staff.forEach((e) => {
|
||||
e.employees
|
||||
.filter((n) => n.selected == true)
|
||||
.map((res) => {
|
||||
idEmployees.push({ participant_calendar: res.id, editor: props.editor?1:props.participant.editor });
|
||||
idEmployees.push({
|
||||
participant_calendar: res.id,
|
||||
});
|
||||
});
|
||||
if (e.employees.every((n) => n.selected == true)) {
|
||||
e.selected = true;
|
||||
@@ -154,10 +135,9 @@ export default {
|
||||
selected.push(...e.employees.filter((n) => n.selected == true));
|
||||
}
|
||||
});
|
||||
|
||||
emit("returnIdParticant", idEmployees);
|
||||
|
||||
// console.log(selected, accountStore.user.is_idEmployee, props.editor, selected.some(e=> e.id== accountStore.user.is_idEmployee), '222222222222222222222222222222222222')
|
||||
|
||||
emit("returnIdParticant", idEmployees, selected);
|
||||
|
||||
return selected;
|
||||
});
|
||||
|
||||
@@ -171,8 +151,8 @@ export default {
|
||||
};
|
||||
|
||||
const allman = () => {
|
||||
let val = staff.value.every((e) => e.selected == true) ? false : true;
|
||||
cbstaff(staff.value, val);
|
||||
let val = props.staff.every((e) => e.selected == true) ? false : true;
|
||||
cbstaff(props.staff, val);
|
||||
};
|
||||
|
||||
function toggledep(item) {
|
||||
@@ -191,7 +171,7 @@ export default {
|
||||
|
||||
return {
|
||||
filtered,
|
||||
staff,
|
||||
accountStore,
|
||||
selectedStaff,
|
||||
allman,
|
||||
cbstaff,
|
||||
|
||||
@@ -1,118 +1,116 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_create_calendar" min-width="636" max-width="800">
|
||||
<dialog-create
|
||||
:title="titleCard"
|
||||
:newOrOld="newCalendar"
|
||||
@closeDialog="dialog_create_calendar = false"
|
||||
@delObject="delCalendar(propsCalendar.id)"
|
||||
@postData="postCalendar"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsCalendar.cl_name"
|
||||
:rules="rules.cl_name"
|
||||
></v-textarea></v-col
|
||||
></v-row>
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Цвет </v-col>
|
||||
<v-col v-for="(x, key) in color" :key="key">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
@click="colorPik(x, key)"
|
||||
size="x-small"
|
||||
:color="x"
|
||||
:variant="
|
||||
propsCalendar.cl_color === null
|
||||
? 'flat'
|
||||
: propsCalendar.cl_color === x
|
||||
? 'flat'
|
||||
: 'tonal'
|
||||
"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:participant="propsCalendar.participant"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-grow-0">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="4"
|
||||
variant="outlined"
|
||||
shaped
|
||||
no-resize
|
||||
:rules="rules.cl_descr"
|
||||
v-model="propsCalendar.cl_descr"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<dialog-create
|
||||
:title="titleCard"
|
||||
:newOrOld="newCalendar"
|
||||
@closeDialog="$emit('closeDialog')"
|
||||
@delObject="delCalendar(propsCalendar.id)"
|
||||
@postData="postCalendar"
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Редакторы </v-col>
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
<v-col>
|
||||
<calendar-create-select
|
||||
:editor="true"
|
||||
:participant="
|
||||
propsCalendar.participant.filter((e) => e.editor == 1)
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsCalendar.cl_name"
|
||||
:rules="rules.cl_name"
|
||||
></v-textarea></v-col
|
||||
></v-row>
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Цвет </v-col>
|
||||
<v-col v-for="(x, key) in color" :key="key">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
@click="colorPik(x, key)"
|
||||
size="x-small"
|
||||
:color="x"
|
||||
:variant="
|
||||
propsCalendar.cl_color === null
|
||||
? 'flat'
|
||||
: propsCalendar.cl_color === x
|
||||
? 'flat'
|
||||
: 'tonal'
|
||||
"
|
||||
/> </v-col
|
||||
></v-row>
|
||||
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Участники </v-col>
|
||||
<v-col>
|
||||
ss {{ propsCalendar.participant }}
|
||||
<calendar-create-select
|
||||
:staff="staff"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col lg="1" class="text-center">
|
||||
<v-tooltip location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon v-bind="props" icon="mdi-help-circle-outline" />
|
||||
</template>
|
||||
<div class="custom-tooltip">
|
||||
Участники с доступом редактирования смогут изменять поля
|
||||
календаря, а также редактировать и удалять события
|
||||
</div>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<!-- <calendar-create-select
|
||||
:participant="propsCalendar.participant"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/>
|
||||
--></v-col
|
||||
></v-row
|
||||
>
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-grow-0">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Описание"
|
||||
row-height="25"
|
||||
rows="4"
|
||||
variant="outlined"
|
||||
shaped
|
||||
no-resize
|
||||
:rules="rules.cl_descr"
|
||||
v-model="propsCalendar.cl_descr"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Редакторы </v-col>
|
||||
<v-col>
|
||||
<!-- <calendar-create-select
|
||||
:editor="true"
|
||||
:participant="
|
||||
propsCalendar.participant.filter((e) => e.editor == 1)
|
||||
"
|
||||
@returnIdParticant="returnIdParticant"
|
||||
/> -->
|
||||
</v-col>
|
||||
<v-col lg="1" class="text-center">
|
||||
<v-tooltip location="top">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-icon v-bind="props" icon="mdi-help-circle-outline" />
|
||||
</template>
|
||||
<div class="custom-tooltip">
|
||||
Участники с доступом редактирования смогут изменять поля
|
||||
календаря, а также редактировать и удалять события
|
||||
</div>
|
||||
</v-tooltip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</dialog-create>
|
||||
</v-dialog>
|
||||
</v-row>
|
||||
</template>
|
||||
</dialog-create>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } 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";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import DialogCreate from "./UI_calendar/dialogCreate.vue";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
|
||||
export default {
|
||||
components: { calendarCreateSelect, DialogCreate },
|
||||
|
||||
props: {
|
||||
opendialog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
calendar: {
|
||||
type: Object,
|
||||
default: {},
|
||||
@@ -122,24 +120,42 @@ export default {
|
||||
setup(props, { emit }) {
|
||||
const postParticant = {};
|
||||
const form_calendar = ref(null);
|
||||
const for_edit = ref([])
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
// Возможно можно сделать запись короче
|
||||
const returnIdParticant = (idPart) => {
|
||||
|
||||
const returnIdParticant = (idPart, selected) => {
|
||||
|
||||
// selected
|
||||
// .forEach((e)=> {
|
||||
|
||||
// e.selected = false
|
||||
// if(e.employees) {
|
||||
// e.employees.forEach((p)=> {
|
||||
// if (p.id != accountStore.user.is_idEmployee) {
|
||||
// p.selected = false
|
||||
// }
|
||||
// else {
|
||||
// p.selected = true
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// )
|
||||
// }
|
||||
|
||||
// })
|
||||
|
||||
postParticant.value = { ...props.calendar, participant: idPart };
|
||||
};
|
||||
|
||||
const dialog_create_calendar = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
const propsCalendar = computed({
|
||||
get: () => props.calendar,
|
||||
set: (value) => emit("update:calendar", value),
|
||||
});
|
||||
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const rules = {
|
||||
cl_name: [(val) => req(val)],
|
||||
cl_descr: [(val) => req(val)],
|
||||
@@ -157,42 +173,46 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => dialog_create_calendar,
|
||||
(newValue, oldValue) => {
|
||||
if (newValue) {
|
||||
calendarNewOrOld();
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
calendarNewOrOld();
|
||||
|
||||
const postCalendar = (val) => {
|
||||
if (val.isValid) {
|
||||
if (
|
||||
postParticant.value.participant.some(
|
||||
(e) => e.participant_calendar == accountStore.user.is_idEmployee
|
||||
)
|
||||
) {
|
||||
axiosApiInstance
|
||||
.post(`api/calendar_of_events/my_calendars/`, postParticant.value)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "green-darken-4";
|
||||
emit("getCalendar");
|
||||
dialog_create_calendar.value = false;
|
||||
});
|
||||
} else {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = "Вы не можете удалить себя из редакторов";
|
||||
feedalert.color = "red-darken-2";
|
||||
feedalert.ico = "mdi-alert-outline";
|
||||
}
|
||||
|
||||
if (val) {
|
||||
axiosApiInstance
|
||||
.post(`api/calendar_of_events/my_calendars/`, postParticant.value)
|
||||
.then((result) => {
|
||||
feedalert.alert = true;
|
||||
feedalert.text = result.data.mess;
|
||||
feedalert.ico = "mdi-check";
|
||||
feedalert.color = "green-darken-4";
|
||||
emit("getCalendar");
|
||||
emit("closeDialog");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const staff = ref([]);
|
||||
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/get_employees/")
|
||||
.then((res) => {
|
||||
staff.value = res.data.filter((e) => e.employees.length > 0);
|
||||
staff.value.forEach((e) => {
|
||||
if (propsCalendar.value.participant.length > 0) {
|
||||
e.employees.forEach((empl) => {
|
||||
|
||||
if (
|
||||
propsCalendar.value.participant.find(
|
||||
(a) => a.participant_calendar === empl.id
|
||||
)
|
||||
) {
|
||||
empl.selected = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const color = [
|
||||
"red",
|
||||
"pink",
|
||||
@@ -229,7 +249,7 @@ export default {
|
||||
feedalert.color = "orange-accent-1";
|
||||
emit("getCalendar");
|
||||
});
|
||||
dialog_create_calendar.value = false;
|
||||
emit("closeDialog");
|
||||
};
|
||||
|
||||
const req = (val) => {
|
||||
@@ -237,8 +257,6 @@ export default {
|
||||
};
|
||||
|
||||
return {
|
||||
dialog_create_calendar,
|
||||
|
||||
postCalendar,
|
||||
color,
|
||||
colorPik,
|
||||
@@ -249,6 +267,7 @@ export default {
|
||||
form_calendar,
|
||||
titleCard,
|
||||
newCalendar,
|
||||
staff
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -74,15 +74,14 @@
|
||||
</template>
|
||||
</v-expansion-panel-text>
|
||||
</v-expansion-panel>
|
||||
|
||||
<v-dialog v-model="showDialog" min-width="636" max-width="800">
|
||||
<calendar-create
|
||||
|
||||
@update:opendialog="showDialog = $event"
|
||||
:opendialog="showDialog"
|
||||
@closeDialog = "showDialog = false"
|
||||
:calendar="calendar"
|
||||
@update:calendar="calendar = $event"
|
||||
@getCalendar="$emit('getCalendar')"
|
||||
/>
|
||||
</v-dialog>
|
||||
</v-expansion-panels>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -4,17 +4,16 @@
|
||||
:title="titleCard"
|
||||
:newOrOld="newEvent"
|
||||
@closeDialog="dialog_create_calendar = false"
|
||||
|
||||
>
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<template v-slot:card_text>
|
||||
<v-row no-gutters class="flex-column">
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
<v-col>
|
||||
{{propsEvent}}
|
||||
{{ propsEvent }}
|
||||
<v-textarea
|
||||
density="compact"
|
||||
label="Добавить название"
|
||||
@@ -22,35 +21,43 @@
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="propsEvent.event.name"
|
||||
|
||||
></v-textarea>
|
||||
</v-col
|
||||
></v-textarea> </v-col
|
||||
></v-row>
|
||||
<v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2"> Календарь</v-col>
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Календарь</v-col
|
||||
>
|
||||
<v-col>
|
||||
{{nameCalendar}}
|
||||
|
||||
<v-autocomplete
|
||||
v-model="nameCalendar"
|
||||
:items="propsEvent.mycalendars"
|
||||
label="Выберите календарь или найдите по названию"
|
||||
item-title="cl_name"
|
||||
item-value="id"
|
||||
|
||||
|
||||
hide-details
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
class="max-height-select py-3"
|
||||
return-object
|
||||
>
|
||||
|
||||
v-model="nameCalendar"
|
||||
:items="propsEvent.mycalendars"
|
||||
label="Выберите календарь или найдите по названию"
|
||||
item-title="cl_name"
|
||||
item-value="id"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
class="py-3"
|
||||
return-object
|
||||
|
||||
>
|
||||
<template v-slot:chip="{ item }">
|
||||
<v-avatar
|
||||
class="cursor-pointer"
|
||||
size="8"
|
||||
:color="item.raw.cl_color"
|
||||
/>
|
||||
<span class="pl-2">
|
||||
{{ item.title }}
|
||||
</span>
|
||||
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
|
||||
</v-col
|
||||
></v-row>
|
||||
</v-col></v-row
|
||||
>
|
||||
|
||||
<!-- <v-row no-gutters class="align-center pb-3">
|
||||
<!-- <v-row no-gutters class="align-center pb-3">
|
||||
<v-col class="text-body-2 text-text_grey" lg="2">
|
||||
Участники
|
||||
</v-col>
|
||||
@@ -88,8 +95,8 @@
|
||||
|
||||
</v-row> -->
|
||||
</v-row>
|
||||
<!-- {{propsEvent}} -->
|
||||
</template>
|
||||
<!-- {{propsEvent}} -->
|
||||
</template>
|
||||
</dialog-create>
|
||||
<!-- @delObject="delCalendar(propsCalendar.id)"
|
||||
@postData="postCalendar" -->
|
||||
@@ -102,8 +109,7 @@ import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "./UI_calendar/dialogCreate.vue";
|
||||
|
||||
export default {
|
||||
|
||||
components: { DialogCreate },
|
||||
components: { DialogCreate },
|
||||
|
||||
props: {
|
||||
opendialog: {
|
||||
@@ -118,7 +124,6 @@ export default {
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const propsEvent = computed({
|
||||
get: () => props.eventCalendar,
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
@@ -132,36 +137,36 @@ export default {
|
||||
const titleCard = ref("");
|
||||
const newEvent = ref(false);
|
||||
|
||||
const eventNewOrOld = () => {
|
||||
const eventNewOrOld = () => {
|
||||
// propsCalendar.value.hasOwnProperty("id")
|
||||
// if (true) {
|
||||
titleCard.value = "Новое события";
|
||||
titleCard.value = "Новое события";
|
||||
// } else {
|
||||
// titleCard.value = "Новое событие";
|
||||
// newEvent.value = true;
|
||||
// }
|
||||
};
|
||||
|
||||
const nameCalendar = ref([])
|
||||
|
||||
|
||||
const nameCalendar = ref([]);
|
||||
|
||||
watch(
|
||||
() => dialog_create_event,
|
||||
(newValue, oldValue) => {
|
||||
if (newValue) {
|
||||
eventNewOrOld ();
|
||||
eventNewOrOld();
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
|
||||
|
||||
return {
|
||||
dialog_create_event,
|
||||
titleCard,
|
||||
newEvent,
|
||||
propsEvent,
|
||||
nameCalendar
|
||||
nameCalendar,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user