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