This commit is contained in:
iriska-gri committed 2024-07-17 12:33:48 +03:00
1 parent ebc1445a18
commit 5b942ba862
2 files changed
+36 -55

No files matched your search

@@ -128,7 +128,7 @@ export default {
const calendarForMy = ref([]); const calendarForMy = ref([]);
const eventFromCalendar = ref({}); const eventFromCalendar = ref({});
const idEvent = ref(null); const idEvent = ref(null);
// const idEvent = ref(4) // const idEvent = ref(27)
// const rule = new RRule({ // const rule = new RRule({
// freq: RRule.WEEKLY, // freq: RRule.WEEKLY,
@@ -151,7 +151,7 @@ export default {
}; };
const getCalendar = () => { const getCalendar = () => {
console.log(idEvent.value,' idEvent.value'); console.log(idEvent.value, " idEvent.value");
axiosApiInstance axiosApiInstance
.get(`api/calendar_of_events/my_calendars/`) .get(`api/calendar_of_events/my_calendars/`)
.then((res) => { .then((res) => {
@@ -167,7 +167,7 @@ export default {
getCalendar(); getCalendar();
const getEvents = () => { const getEvents = () => {
console.log(idEvent.value, "idEvent.value----------------");
axiosApiInstance axiosApiInstance
.get( .get(
`api/calendar_of_events/my_events/${ `api/calendar_of_events/my_events/${
@@ -175,7 +175,6 @@ export default {
}` }`
) )
.then((res) => { .then((res) => {
console.log(eventFromCalendar.value, 'eventFromCalendar.value')
eventFromCalendar.value = res.data; eventFromCalendar.value = res.data;
if (idEvent.value == null) { if (idEvent.value == null) {
@@ -190,22 +189,14 @@ export default {
calendar: null, calendar: null,
}; };
} }
});
}
);
}; };
getEvents(); getEvents();
const createEvent = () => { const createEvent = (idEv) => {
showDialog.value = true; showDialog.value = true;
getCalendar(); // getEvents();
console.log('1');
// emit("getCalendar");
}; };
const weekendsData = () => { const weekendsData = () => {
@@ -90,7 +90,6 @@
</v-col> </v-col>
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
<v-row no-gutters class="gap"> <v-row no-gutters class="gap">
<time-select <time-select
:chek="allDay" :chek="allDay"
:order="[2, 1]" :order="[2, 1]"
@@ -108,7 +107,6 @@
:limitation="propsEvent.event.date_start" :limitation="propsEvent.event.date_start"
@update:dateEvent="propsEvent.event.date_end = $event" @update:dateEvent="propsEvent.event.date_end = $event"
/> />
</v-row> </v-row>
<v-row no-gutters> <v-row no-gutters>
<period-events <period-events
@@ -116,18 +114,17 @@
:dateEventStart="propsEvent.event" :dateEventStart="propsEvent.event"
@update:dateEventStart="propsEvent.event = $event" @update:dateEventStart="propsEvent.event = $event"
/> />
<v-col lg=7 class="pt-2 ml-5"> <v-col lg="7" class="pt-2 ml-5">
<v-autocomplete <v-autocomplete
v-model="returnPeriod" v-model="returnPeriod"
:items="repeatRules" :items="repeatRules"
variant="outlined" variant="outlined"
density="compact" density="compact"
return-object return-object
item-title="type" item-title="type"
item-id="type" item-id="type"
/> />
</v-col> </v-col>
</v-row> </v-col </v-row> </v-col
></v-row> ></v-row>
</v-col> </v-col>
@@ -218,36 +215,28 @@ export default {
{ type: "Каждый год", rule: { freq: 0 } }, { type: "Каждый год", rule: { freq: 0 } },
]; ];
const dateEventsRules = ref({});
const returnPeriod = computed({ const returnPeriod = computed({
get() { get() {
console.log(propsEvent.value, 'propsEvent.value');
let select = []; let select = [];
let objRule = JSON.parse(propsEvent.value.event.period); let objRule = JSON.parse(propsEvent.value.event.period);
if (objRule != null) { if (objRule != null) {
repeatRules.findIndex(e=> e.rule.freq == objRule.origOptions.freq) repeatRules.findIndex((e) => e.rule.freq == objRule.origOptions.freq);
// let rule = new RRule({
// freq: objRule.origOptions.freq,
// dtstart: new Date(objRule.origOptions.dtstart),
// until: new Date(objRule.origOptions.until),
// });
// dateEventsRules.value = rule.all();
} }
// let rule = new RRule({ select.push(
// dtstart: objRule.origOptions.dtstart repeatRules[
// // ...objRule.origOptions objRule != null
// new Date( ? repeatRules.findIndex(
// new Date().setDate( (e) => e.rule.freq == objRule.origOptions.freq
// new Date().getDate() - 3 )
// }) : 0
select.push(repeatRules[objRule != null?repeatRules.findIndex(e=> e.rule.freq == objRule.origOptions.freq): 0]); ]
);
return select; return select;
}, },
set(newValue) { set(newValue) {
@@ -256,12 +245,15 @@ export default {
dtstart: new Date(propsEvent.value.event.date_start), dtstart: new Date(propsEvent.value.event.date_start),
until: new Date(propsEvent.value.event.date_end), until: new Date(propsEvent.value.event.date_end),
}); });
Object.keys(newValue.rule).length == 0 Object.keys(newValue.rule).length == 0
? null ? null
: JSON.stringify(newRulse); : (propsEvent.value.event.period = JSON.stringify(
dateEventsRules.value = newRulse.all(); newRulse
));
// : (propsEvent.value.event.period = JSON.stringify(
// newRulse.origOptions
// ));
}, },
}); });
@@ -351,7 +343,6 @@ export default {
const files = ref([]); const files = ref([]);
const postFiles = (f) => { const postFiles = (f) => {
files.value = f; files.value = f;
}; };
const calendar = computed({ const calendar = computed({
@@ -434,7 +425,6 @@ export default {
const dateEvent = computed({ const dateEvent = computed({
get() { get() {
return formatComa(new Date(propsEvent.value.event.date_start)); return formatComa(new Date(propsEvent.value.event.date_start));
}, },