P-9
This commit is contained in:
1 parent
3fe102b6da
commit
be6f3dbd2b
7 files changed
+420
-230
No files matched your search
@@ -55,10 +55,16 @@ class CalendarEvents(models.Model):
|
||||
|
||||
class FilesEvent(models.Model):
|
||||
""" Прикрепленные файлы к событию"""
|
||||
name = models.CharField(max_length=300, verbose_name='Название файла')
|
||||
link = models.FileField(upload_to='calendar/%Y/%m/%d')
|
||||
event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, null=True, blank= True, related_name='get_calendar_events_files', verbose_name='Событие к которому привязаны файлы')
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Файл к событию"
|
||||
verbose_name_plural = "Файлы к событиям"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.link)
|
||||
|
||||
class ParticipantsEvent(models.Model):
|
||||
""" Участники события """
|
||||
participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
|
||||
|
||||
@@ -7,11 +7,14 @@ from rest_framework.response import Response
|
||||
class CalendarEventsAPIView(APIView):
|
||||
|
||||
def updateCreate(self, ev, calendar, bigname):
|
||||
# print(calendar['start'], '11111111111111111111111111111111111111111111')
|
||||
CalendarEvents.objects.update_or_create(**ev,
|
||||
defaults = {**calendar,
|
||||
'author': User.objects.get(pk=self.request.user.id),
|
||||
'calendarname_id': bigname.pk,
|
||||
'frequency': 'repeat: {weekdays: [5] }',
|
||||
'startdate': calendar['start']
|
||||
|
||||
|
||||
})
|
||||
|
||||
@@ -21,6 +24,8 @@ class CalendarEventsAPIView(APIView):
|
||||
eventslist = CalendarEventsSerializer(CalendarEvents.objects.all(), many=True)
|
||||
return Response(eventslist.data)
|
||||
|
||||
|
||||
|
||||
def post(self, request):
|
||||
""" Записываем или обновляем глобальное название в таблицу, если есть участники так же пишем в соотвтв. таблицу с привязкой к событию.
|
||||
Добавляем или удаляяем запись о событии
|
||||
@@ -28,11 +33,13 @@ class CalendarEventsAPIView(APIView):
|
||||
namecalendar, created = CalendarEventsName.objects.update_or_create(name=request.data['participants'],
|
||||
defaults = {'name':request.data['participants'],
|
||||
'author_id': self.request.user.id})
|
||||
|
||||
print('request.data', request.data['files'])
|
||||
if 'pk' in request.data['calendar']:
|
||||
|
||||
event = {"calendarname_id":namecalendar.pk,
|
||||
"pk": request.data['calendar']['pk'],}
|
||||
self.updateCreate(event, request.data['calendar'], namecalendar)
|
||||
self.updateCreate(event, request.data['calendar'], namecalendar)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<v-row>
|
||||
<v-col class="flex-column pr-0">
|
||||
<v-card class="h-100">
|
||||
<my-helper :pretext="selectedEvent" />
|
||||
<!-- <my-helper :pretext="events" /> q -->
|
||||
|
||||
<vue-cal
|
||||
locale="ru"
|
||||
@@ -48,7 +48,7 @@
|
||||
<v-col>
|
||||
<v-card class="h-100">
|
||||
<v-card-title class="text-center"
|
||||
>События на {{selData }}</v-card-title
|
||||
>События на {{ selData }}</v-card-title
|
||||
>
|
||||
|
||||
<vue-cal
|
||||
@@ -61,9 +61,8 @@
|
||||
hide-view-selector
|
||||
:time="false"
|
||||
:events="events"
|
||||
|
||||
>
|
||||
<!-- :on-event-dblclick="onEventClick" -->
|
||||
|
||||
<template #cell-content="{ view, events }">
|
||||
<v-img
|
||||
v-if="['week', 'day'].includes(view.id) && !events.length"
|
||||
@@ -73,15 +72,14 @@
|
||||
cover
|
||||
/>
|
||||
<v-card v-else>
|
||||
|
||||
<v-list lines="one">
|
||||
<v-list-item
|
||||
@click="onEventClick(n)"
|
||||
v-for="n in events"
|
||||
:key="n.pk"
|
||||
:title="n.name"
|
||||
:subtitle="n.description"
|
||||
></v-list-item>
|
||||
<v-list-item
|
||||
@click="onEventClick(n)"
|
||||
v-for="n in events"
|
||||
:key="n.pk"
|
||||
:title="n.name"
|
||||
:subtitle="n.description"
|
||||
></v-list-item>
|
||||
</v-list>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -110,10 +108,8 @@ export default {
|
||||
const events = ref([]);
|
||||
|
||||
const onEventClick = (n) => {
|
||||
|
||||
selectedEvent.value = n;
|
||||
showDialog.value = true;
|
||||
|
||||
};
|
||||
|
||||
function f_generalvacation() {
|
||||
@@ -121,14 +117,13 @@ export default {
|
||||
axiosApiInstance
|
||||
.get("api/calendar_of_events/calendarEvents/")
|
||||
.then((data) => {
|
||||
data.data.forEach((e)=>{
|
||||
e.start = formaDashTime(e.start)
|
||||
e.end = e.start
|
||||
})
|
||||
events.value=data.data
|
||||
// icon: "mdi-book-open",
|
||||
// class: "bg-indigo-lighten-5 border-sm",
|
||||
|
||||
data.data.forEach((e) => {
|
||||
e.start = formaDashTime(e.start);
|
||||
e.end = e.start;
|
||||
});
|
||||
events.value = data.data;
|
||||
// icon: "mdi-book-open",
|
||||
// class: "bg-indigo-lighten-5 border-sm",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -140,21 +135,17 @@ export default {
|
||||
|
||||
const selectedDate = ref(null);
|
||||
|
||||
const selData = computed({
|
||||
get: () => {
|
||||
const d = new Date(selectedDate.value);
|
||||
let mess = "сегодня";
|
||||
if (d.getFullYear() != "1970") {
|
||||
mess = `${d.getDate()} число`;
|
||||
}
|
||||
|
||||
const selData = computed({
|
||||
get: () => {
|
||||
const d = new Date(selectedDate.value);
|
||||
let mess = "сегодня";
|
||||
if (d.getFullYear() != "1970") {
|
||||
mess = `${d.getDate()} число`;
|
||||
}
|
||||
|
||||
return mess;
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
return mess;
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
selectedEvent,
|
||||
@@ -166,7 +157,7 @@ export default {
|
||||
eventsCssClasses,
|
||||
burl,
|
||||
returnUpdateData,
|
||||
selData
|
||||
selData,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<v-dialog v-model="mydialog" max-width="700">
|
||||
<v-card
|
||||
:loading="isUpdating"
|
||||
class="mx-auto"
|
||||
color="blue-grey-darken-1"
|
||||
max-width="420"
|
||||
>
|
||||
<template v-slot:loader="{ isActive }">
|
||||
<v-progress-linear
|
||||
:active="isActive"
|
||||
color="green-lighten-3"
|
||||
height="4"
|
||||
indeterminate
|
||||
></v-progress-linear>
|
||||
</template>
|
||||
|
||||
<v-img
|
||||
height="200"
|
||||
src="https://cdn.vuetifyjs.com/images/cards/dark-beach.jpg"
|
||||
cover
|
||||
>
|
||||
<v-row class="pa-3">
|
||||
<v-col cols="12">
|
||||
<v-menu
|
||||
location="bottom start"
|
||||
origin="overlap"
|
||||
transition="slide-y-transition"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
v-bind="props"
|
||||
density="comfortable"
|
||||
icon="mdi-dots-vertical"
|
||||
variant="tonal"
|
||||
></v-btn>
|
||||
</template>
|
||||
|
||||
<v-list :lines="false">
|
||||
<v-list-item
|
||||
title="Update"
|
||||
@click="isUpdating = true"
|
||||
></v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
|
||||
<v-row>
|
||||
<v-col class="text-center">
|
||||
<h3 class="text-h5">{{ name }}</h3>
|
||||
|
||||
<span class="text-grey-lighten-1">{{ title }}</span>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row>
|
||||
</v-img>
|
||||
|
||||
<v-form>
|
||||
<v-container>
|
||||
<v-row dense>
|
||||
<v-col cols="12" md="6">
|
||||
<v-text-field
|
||||
v-model="name"
|
||||
:disabled="isUpdating"
|
||||
color="blue-grey-lighten-2"
|
||||
label="Name"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="6">
|
||||
<v-text-field
|
||||
v-model="title"
|
||||
:disabled="isUpdating"
|
||||
color="blue-grey-lighten-2"
|
||||
label="Title"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-autocomplete
|
||||
v-model="friends"
|
||||
:disabled="isUpdating"
|
||||
:items="people"
|
||||
color="blue-grey-lighten-2"
|
||||
item-title="name"
|
||||
item-value="name"
|
||||
label="Select"
|
||||
chips
|
||||
closable-chips
|
||||
multiple
|
||||
>
|
||||
<template v-slot:chip="{ props, item }">
|
||||
<v-chip
|
||||
v-bind="props"
|
||||
:prepend-avatar="item.raw.avatar"
|
||||
:text="item.raw.name"
|
||||
></v-chip>
|
||||
</template>
|
||||
|
||||
<template v-slot:item="{ props, item }">
|
||||
<v-list-item
|
||||
v-bind="props"
|
||||
:prepend-avatar="item.raw.avatar"
|
||||
:subtitle="item.raw.group"
|
||||
:title="item.raw.name"
|
||||
></v-list-item>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-form>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-switch
|
||||
v-model="autoUpdate"
|
||||
:disabled="isUpdating"
|
||||
class="mt-0 ms-2"
|
||||
color="green-lighten-2"
|
||||
density="compact"
|
||||
label="Auto Update"
|
||||
hide-details
|
||||
></v-switch>
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
<v-btn
|
||||
:disabled="autoUpdate"
|
||||
:loading="isUpdating"
|
||||
:variant="isUpdating ? 'tonal' : undefined"
|
||||
color="blue-grey-lighten-3"
|
||||
prepend-icon="mdi-update"
|
||||
@click="isUpdating = true"
|
||||
>
|
||||
Update Now
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, computed } from "vue";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
opendialog: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
|
||||
|
||||
const mydialog = computed({
|
||||
get: () => props.opendialog,
|
||||
set: (value) => emit("update:opendialog", value),
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
const people= [
|
||||
// TODO: https://github.com/vuetifyjs/vuetify/issues/15721
|
||||
// { header: 'Group 1' },
|
||||
{ name: 'Sandra Adams', group: 'Group 1', avatar: srcs[1] },
|
||||
{ name: 'Ali Connors', group: 'Group 1', avatar: srcs[2] },
|
||||
{ name: 'Trevor Hansen', group: 'Group 1', avatar: srcs[3] },
|
||||
{ name: 'Tucker Smith', group: 'Group 1', avatar: srcs[2] },
|
||||
// { divider: true },
|
||||
// { header: 'Group 2' },
|
||||
{ name: 'Britta Holt', group: 'Group 2', avatar: srcs[4] },
|
||||
{ name: 'Jane Smith ', group: 'Group 2', avatar: srcs[5] },
|
||||
{ name: 'John Smith', group: 'Group 2', avatar: srcs[1] },
|
||||
{ name: 'Sandra Williams', group: 'Group 2', avatar: srcs[3] },
|
||||
]
|
||||
|
||||
return {
|
||||
mydialog,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<v-card>
|
||||
|
||||
<v-card-title>
|
||||
<v-textarea
|
||||
<!-- <v-textarea
|
||||
v-model="dataToEdit.bigname"
|
||||
rows="1"
|
||||
placeholder="Название календаря"
|
||||
/>
|
||||
/> -->
|
||||
<v-text-field v-model="dataToEdit.name" placeholder="Заголовок" />
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
@@ -54,20 +53,41 @@
|
||||
</v-card-subtitle>
|
||||
<v-card-text class="pt-2">
|
||||
<!-- <v-textarea v-model="dataToEdit.description" placeholder="Описание события" /> -->
|
||||
<ckeditor :editor="editor" v-model="dataToEdit.description" :config="{
|
||||
placeholder:'Описание события',
|
||||
language: 'ru'
|
||||
|
||||
}"></ckeditor>
|
||||
<v-textarea
|
||||
<ckeditor
|
||||
:editor="editor"
|
||||
v-model="dataToEdit.description"
|
||||
:config="{
|
||||
placeholder: 'Описание события',
|
||||
language: 'ru',
|
||||
}"
|
||||
/>
|
||||
<ckeditor
|
||||
:editor="editor"
|
||||
v-model="dataToEdit.content"
|
||||
placeholder="Полное описание события"
|
||||
:config="{
|
||||
placeholder: 'Полное описание события',
|
||||
language: 'ru',
|
||||
}"
|
||||
/>
|
||||
|
||||
<v-textarea
|
||||
v-model="dataToEdit.place"
|
||||
placeholder="Местопроведение события"
|
||||
/>
|
||||
<!-- <v-btn @click="openDialog">
|
||||
добавить
|
||||
</v-btn> -->
|
||||
<!-- <event-dialog-edit-participant
|
||||
:opendialog="showDialog"
|
||||
@update:opendialog="showDialog = $event"
|
||||
/> -->
|
||||
<v-file-input
|
||||
label="File input w/ chips"
|
||||
chips
|
||||
multiple
|
||||
@change="onFileChange"
|
||||
></v-file-input>
|
||||
|
||||
<strong>Время:</strong>
|
||||
|
||||
<ul class="pl-5">
|
||||
@@ -86,13 +106,12 @@
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-icon
|
||||
icon="mdi-check"
|
||||
color="green"
|
||||
class="pb-1"
|
||||
@click="confirmation"
|
||||
/>
|
||||
icon="mdi-check"
|
||||
color="green"
|
||||
class="pb-1"
|
||||
@click="confirmation"
|
||||
/>
|
||||
</v-card-actions>
|
||||
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
@@ -100,27 +119,29 @@
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
import { ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
|
||||
import '@ckeditor/ckeditor5-build-classic/build/translations/ru';
|
||||
import CKEditor from "@ckeditor/ckeditor5-vue";
|
||||
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
||||
import "@ckeditor/ckeditor5-build-classic/build/translations/ru";
|
||||
import EventDialogEditParticipant from "./event-dialog-edit-participant.vue";
|
||||
export default {
|
||||
props: {
|
||||
event: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
components: {
|
||||
// Use the <ckeditor> component in this view.
|
||||
ckeditor: CKEditor.component
|
||||
},
|
||||
// Use the <ckeditor> component in this view.
|
||||
ckeditor: CKEditor.component,
|
||||
EventDialogEditParticipant,
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const eventFiles = ref([]);
|
||||
const menudate = ref(false);
|
||||
const dataToEdit = ref({...props.event})
|
||||
|
||||
const dataToEdit = ref({ ...props.event, description: "" });
|
||||
const showDialog = ref(false);
|
||||
|
||||
const startTime = ref(
|
||||
`${dataToEdit.value.start.getHours()}:${String(
|
||||
dataToEdit.value.start.getMinutes()
|
||||
@@ -130,28 +151,47 @@ export default {
|
||||
const updateDateTime = () => {
|
||||
if (startTime.value) {
|
||||
const timeParts = startTime.value.split(":");
|
||||
|
||||
dataToEdit.value.start.setHours(parseInt(timeParts[0], 10));
|
||||
dataToEdit.value.start.setMinutes(parseInt(timeParts[1], 10));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const onFileChange = (event) => {
|
||||
|
||||
}
|
||||
|
||||
const confirmation = () => {
|
||||
|
||||
|
||||
const participants = dataToEdit.value.bigname
|
||||
|
||||
const sdata = new FormData();
|
||||
sdata.append("dailyfiles", eventFiles.value[0]);
|
||||
|
||||
const participants = dataToEdit.value.bigname;
|
||||
console.log(sdata,
|
||||
'sdata')
|
||||
console.log(eventFiles.value[0],
|
||||
'sdata1')
|
||||
axiosApiInstance
|
||||
.post(`api/calendar_of_events/calendarEvents/`, {
|
||||
participants: participants,
|
||||
calendar: dataToEdit.value,
|
||||
})
|
||||
calendar: dataToEdit.value,
|
||||
files: sdata,
|
||||
|
||||
},
|
||||
// {
|
||||
// headers: {
|
||||
// "Content-Type": "multipart/form-data"
|
||||
// },
|
||||
// }
|
||||
)
|
||||
.then((data) => {
|
||||
emit('returnUpdateData')
|
||||
emit("returnUpdateData");
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
const openDialog = () => {
|
||||
showDialog.value = true;
|
||||
};
|
||||
|
||||
return {
|
||||
editor: ClassicEditor,
|
||||
@@ -160,7 +200,10 @@ export default {
|
||||
startTime,
|
||||
updateDateTime,
|
||||
dataToEdit,
|
||||
confirmation
|
||||
confirmation,
|
||||
openDialog,
|
||||
showDialog,
|
||||
eventFiles,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<component
|
||||
:is = "editEvent ? 'eventDialogEdit':'eventDialogInfo'"
|
||||
:event="event"
|
||||
@returnUpdateData="returnUpdateData"
|
||||
@returnUpdateData="returnUpdateData"
|
||||
/>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
@@ -1,173 +1,129 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card
|
||||
class="bg-white pa-1 px-0 "
|
||||
<div>
|
||||
<v-card class="bg-white pa-1 px-0" width="550">
|
||||
<v-card
|
||||
class="mx-auto overflow-auto mx-0 px-0"
|
||||
width="550"
|
||||
|
||||
>
|
||||
<v-card
|
||||
class="mx-auto overflow-auto mx-0 px-0"
|
||||
width="550"
|
||||
height="600"
|
||||
flat
|
||||
>
|
||||
height="600"
|
||||
flat
|
||||
>
|
||||
<v-card-title class="fixed-bar bg-white">
|
||||
<v-row class="bggrad">
|
||||
<v-col class="text-center text-black_and_white">
|
||||
{{ namepos }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pa-0 mb-1">
|
||||
<v-divider class="" />
|
||||
<v-text-field
|
||||
v-model="searchname"
|
||||
clearable
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
hide-details
|
||||
class="ma-0"
|
||||
label="Поиск"
|
||||
rows="1"
|
||||
no-resize
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-title class="fixed-bar bg-white">
|
||||
|
||||
<v-row class="bggrad">
|
||||
<v-col class="text-center text-black_and_white">
|
||||
{{namepos}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pa-0 mb-1">
|
||||
<v-divider class=""/>
|
||||
<v-text-field
|
||||
v-model="searchname"
|
||||
clearable
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
hide-details
|
||||
class="ma-0"
|
||||
label="Поиск"
|
||||
rows="1"
|
||||
no-resize
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
</v-card-title>
|
||||
|
||||
|
||||
|
||||
<div
|
||||
v-for="(x, key) in result"
|
||||
:key="key"
|
||||
class="px-3 ddd" >
|
||||
|
||||
<v-list class="py-0">
|
||||
<v-list-subheader>{{key}} </v-list-subheader>
|
||||
</v-list>
|
||||
<div
|
||||
v-for="item in x"
|
||||
:key="item"
|
||||
>
|
||||
<list-user :author=item />
|
||||
<!-- <vcard-user :author = item /> -->
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</v-card>
|
||||
<v-divider class=""/>
|
||||
<v-card-actions class="pb-0" style="place-content: end">
|
||||
<v-btn
|
||||
color="more_details_btn"
|
||||
variant="text"
|
||||
@click="onSubmit"
|
||||
|
||||
|
||||
>
|
||||
Закрыть
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
|
||||
</div>
|
||||
<div v-for="(x, key) in result" :key="key" class="px-3 ddd">
|
||||
<v-list class="py-0">
|
||||
<v-list-subheader>{{ key }} </v-list-subheader>
|
||||
</v-list>
|
||||
<div v-for="item in x" :key="item">
|
||||
<list-user :author="item" />
|
||||
<!-- <vcard-user :author = item /> -->
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
<v-divider class="" />
|
||||
<v-card-actions class="pb-0" style="place-content: end">
|
||||
<v-btn color="more_details_btn" variant="text" @click="onSubmit">
|
||||
Закрыть
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { checkremote } from "@/utils/universal_functions";
|
||||
import { spravURL } from "@/utils/axios-api";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import VcardUser from "@/components/UI/fiousercard/vcardUser.vue";
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
VcardUser
|
||||
},
|
||||
|
||||
props: {
|
||||
idpos: {
|
||||
type: Number,
|
||||
default: ''
|
||||
},
|
||||
namepos: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
|
||||
|
||||
components: {
|
||||
VcardUser,
|
||||
},
|
||||
|
||||
setup(props, {emit}){
|
||||
|
||||
const t_dailyRound = ref({})
|
||||
// const result = ref({})
|
||||
const iduser = ref('')
|
||||
const searchname = ref('')
|
||||
props: {
|
||||
idpos: {
|
||||
type: Number,
|
||||
default: "",
|
||||
},
|
||||
namepos: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const t_dailyRound = ref({});
|
||||
// const result = ref({})
|
||||
const iduser = ref("");
|
||||
const searchname = ref("");
|
||||
|
||||
const onSubmit = () => {
|
||||
emit("searchClose");
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
emit('searchClose')
|
||||
}
|
||||
onMounted(() => {
|
||||
axiosApiInstance
|
||||
.get(`api/general_vacation/dailyload/?id=${props.idpos}`)
|
||||
.then((data) => {
|
||||
t_dailyRound.value = data.data.daily;
|
||||
});
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${props.idpos}`).then(data => {
|
||||
|
||||
t_dailyRound.value = data.data.daily
|
||||
const getcard = async (idus) => {
|
||||
iduser.value = idus;
|
||||
};
|
||||
|
||||
})
|
||||
const result = computed({
|
||||
get() {
|
||||
let ob = {};
|
||||
Object.keys(t_dailyRound.value).map((el1) => {
|
||||
let myarr = t_dailyRound.value[el1].filter((el) =>
|
||||
el.fio.toLowerCase().includes(searchname.value.toLowerCase())
|
||||
);
|
||||
|
||||
})
|
||||
if (myarr.length > 0) {
|
||||
ob[el1] = myarr;
|
||||
}
|
||||
});
|
||||
return ob;
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
onSubmit,
|
||||
checkremote,
|
||||
searchname,
|
||||
spravURL,
|
||||
t_dailyRound,
|
||||
result,
|
||||
|
||||
const getcard = async (idus) => {
|
||||
|
||||
iduser.value = idus
|
||||
}
|
||||
|
||||
const result = computed({
|
||||
get() {
|
||||
let ob={}
|
||||
Object.keys(t_dailyRound.value).map(el1 => {
|
||||
let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(searchname.value.toLowerCase()))
|
||||
|
||||
if(myarr.length>0)
|
||||
{
|
||||
ob[el1] = myarr
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
return ob
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
return {
|
||||
onSubmit,
|
||||
checkremote,
|
||||
searchname,
|
||||
spravURL,
|
||||
t_dailyRound,
|
||||
result,
|
||||
|
||||
getcard,
|
||||
iduser
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
getcard,
|
||||
iduser,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
Reference in new issue
Block a user