События запрашиваются по текущему дню календаря

This commit is contained in:
Daria Golova
2022-12-23 12:09:25 +03:00
parent b1237fbed4
commit 48860c454f
3 changed files with 13 additions and 10 deletions

View File

@@ -167,7 +167,15 @@ export default {
},
fetchEventsData() {
fetchWrapper
.get("registry/event/?limit=100")
.get(
`registry/event/?limit=100&start=${this.currentDate.format(
"YYYY-MM-DD"
)}T${
this.timeInformation.dayStartTime
}:00Z&end=${this.currentDate.format("YYYY-MM-DD")}T${
this.timeInformation.dayEndTime
}:00Z`
)
.then((res) => this.saveEventsData(res));
},
changeWidth(value) {
@@ -210,6 +218,7 @@ export default {
},
currentDate() {
this.fetchSchedulesData();
this.fetchEventsData();
},
},
mounted() {

View File

@@ -207,12 +207,12 @@ export default {
startDate() {
return this.selectedEventData.start
? moment.parseZone(this.selectedEventData.start)
: moment();
: this.currentDate;
},
endDate() {
return this.selectedEventData.end
? moment.parseZone(this.selectedEventData.end)
: moment();
: this.currentDate;
},
eventEmployee() {
if (this.selectedEventData.employees) {

View File

@@ -185,12 +185,6 @@ export default {
ownersCount() {
return this.filteredOwners.length;
},
filteredEventsByDate() {
return this.eventsData.filter(
({ start }) =>
start.slice(0, 10) === this.currentDate.format("YYYY-MM-DD")
);
},
columnHeight() {
return (
(this.timeCoil.length - 1) * this.pixelsPerHour +
@@ -301,7 +295,7 @@ export default {
},
filterEventsByOwner(owner) {
let filteredArray = [];
this.filteredEventsByDate.forEach((item) => {
this.eventsData.forEach((item) => {
let foundEvent = item.employees.find(
(elem) => elem.employee.id === owner.id && elem.role === "owner"
);