P-47 time

This commit is contained in:
iriska-gri committed 2024-07-12 11:33:50 +03:00
1 parent bd04bd6d08
commit 48a66002ef
4 files changed
+68 -16

No files matched your search

@@ -23,7 +23,7 @@
color="btn_text"
block
elevation="1"
@click="showDialog = true"
@click="createEvent()"
>Создать событие</v-btn
>
<!-- {{eventFromCalendar}} -->
@@ -92,6 +92,7 @@
<event-create
@closeDialog = "showDialog = false"
:eventCalendar="eventFromCalendar"
@getCalendar="$emit('getCalendar')"
/>
</v-dialog>
</v-row>
@@ -108,7 +109,7 @@ import { useAccountStore } from "@/store/AccountStore";
export default {
components: { EventCreate, CalendarMy },
setup() {
setup(props, {emit}) {
const accountStore = useAccountStore();
const showDialog = ref(false);
const week = useWeekendsStore();
@@ -119,8 +120,8 @@ export default {
const MyMonth = ref(selectdate.value.getMonth() + 1);
const calendarForMy = ref([]);
const eventFromCalendar = ref({})
// const idEvent = ref(null)
const idEvent = ref(1)
const idEvent = ref(null)
// const idEvent = ref(1)
const getMonth = (month) => {
MyMonth.value = month + 1;
@@ -161,6 +162,11 @@ export default {
getEvents();
const createEvent = () => {
showDialog.value = true
emit("getCalendar");
}
const weekendsData = () => {
cal.value.$el
@@ -221,7 +227,8 @@ export default {
calendarForMy,
accountStore,
getCalendar,
eventFromCalendar
eventFromCalendar,
createEvent
};
},
};
@@ -39,8 +39,11 @@ export default {
(propsDateEvent.value.date_start = new Date(
new Date(propsDateEvent.value.date_start).setHours(0, 0, 0)
))
: (propsDateEvent.value.date_end = new Date());
: (propsDateEvent.value.date_end = new Date())&&(propsDateEvent.value.date_start = new Date())
console.log(propsDateEvent.value.date_start, 'propsDateEvent.value.date_start');
},
});
const propsDateEvent = computed({
@@ -111,6 +111,27 @@ export default {
set: (value) => emit("update:dateEvent", value),
});
const minEnd = (val) => {
// console.log(val, '111')
// console.log( new Date(formatDash(modelDate.value) + "T" + val) >
// propsDateEvent.value.date_start);
// console.log( new Date(formatDash(modelDate.value) + "T" + val),
// propsDateEvent.value.date_start);
if (
new Date(formatDash(modelDate.value) + "T" + val) >
propsDateEvent.value.date_start
) {
if (props.order[0] == 4)
propsDateEvent.value.date_end = new Date(
formatDash(modelDate.value) + "T" + val
);
}
else {
if (props.order[0] == 4)
propsDateEvent.value.date_end = propsDateEvent.value.date_start
}
}
const modelDate = computed({
get() {
let date =
@@ -128,6 +149,7 @@ export default {
).getHours()}:${String(
new Date(propsDateEvent.value.date_end).getMinutes()
).padStart(2, "0")}`;
disbleTime.value =
clockStart == "0:00" &&
clockEnd == "23:59" &&
@@ -139,17 +161,37 @@ export default {
return date;
},
set(newValue) {
if (
new Date(formatDash(newValue) + "T" + timeEvent.value) >
propsDateEvent.value.date_start
) {
if (props.order[0] == 4)
propsDateEvent.value.date_end = new Date(
formatDash(newValue) + "T" + timeEvent.value
);
}
else {
if (props.order[0] == 4)
propsDateEvent.value.date_end = propsDateEvent.value.date_start
}
if (props.order[0] == 2)
propsDateEvent.value.date_start = new Date(
formatDash(newValue) + "T" + timeEvent.value
);
if (props.order[0] == 4)
propsDateEvent.value.date_end = new Date(
formatDash(newValue) + "T" + timeEvent.value
);
// if (props.order[0] == 4)
// propsDateEvent.value.date_end = new Date(
// formatDash(newValue) + "T" + timeEvent.value
// );
},
});
const timeEvent = computed({
get() {
let time =
@@ -163,14 +205,13 @@ export default {
},
set(newValue) {
minEnd(newValue)
if (props.order[0] == 2)
propsDateEvent.value.date_start = new Date(
formatDash(modelDate.value) + "T" + newValue
);
if (props.order[0] == 4)
propsDateEvent.value.date_end = new Date(
formatDash(modelDate.value) + "T" + newValue
);
},
});
@@ -267,7 +267,7 @@ export default {
feedalert.text = result.data.mess;
feedalert.ico = "mdi-check";
feedalert.color = "orange-accent-1";
emit("getCalendar");
});
emit("closeDialog");
}
@@ -298,7 +298,7 @@ export default {
id: propsEvent.value.mycalendars[0].id,
});
}
propsEvent.value.event.calendar = propsEvent.value.mycalendars[0].id;
if(propsEvent.value.event.calendar==null) propsEvent.value.event.calendar = propsEvent.value.mycalendars[0].id;
return selected;
},
@@ -394,6 +394,7 @@ export default {
feedalert.text = result.data.mess;
feedalert.ico = "mdi-check";
feedalert.color = "green-darken-4";
emit("getCalendar");
emit("closeDialog");
});
}