mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-19 22:14:07 +01:00
Calendar can now only view and delete task
This commit is contained in:
parent
275738d902
commit
c2824ec383
@ -5,6 +5,7 @@ import dayGridPlugin from "@fullcalendar/daygrid";
|
|||||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||||
import interactionPlugin from "@fullcalendar/interaction";
|
import interactionPlugin from "@fullcalendar/interaction";
|
||||||
import { getEvents, createEventId } from "./TaskDataHandler";
|
import { getEvents, createEventId } from "./TaskDataHandler";
|
||||||
|
import { axiosInstance } from "src/api/AxiosConfig";
|
||||||
|
|
||||||
export class Calendar extends React.Component {
|
export class Calendar extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
@ -25,13 +26,13 @@ export class Calendar extends React.Component {
|
|||||||
right: "dayGridMonth,timeGridWeek,timeGridDay",
|
right: "dayGridMonth,timeGridWeek,timeGridDay",
|
||||||
}}
|
}}
|
||||||
initialView="dayGridMonth"
|
initialView="dayGridMonth"
|
||||||
editable={true}
|
editable={false}
|
||||||
selectable={true}
|
selectable={false}
|
||||||
selectMirror={true}
|
selectMirror={true}
|
||||||
dayMaxEvents={true}
|
dayMaxEvents={true}
|
||||||
weekends={this.state.weekendsVisible}
|
weekends={this.state.weekendsVisible}
|
||||||
initialEvents={getEvents}
|
initialEvents={getEvents}
|
||||||
select={this.handleDateSelect}
|
// select={this.handleDateSelect}
|
||||||
eventContent={renderEventContent}
|
eventContent={renderEventContent}
|
||||||
eventClick={this.handleEventClick}
|
eventClick={this.handleEventClick}
|
||||||
eventsSet={this.handleEvents}
|
eventsSet={this.handleEvents}
|
||||||
@ -85,22 +86,22 @@ export class Calendar extends React.Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handleDateSelect = (selectInfo) => {
|
// handleDateSelect = (selectInfo) => {
|
||||||
let title = prompt("Please enter a new title for your event");
|
// let title = prompt("Please enter a new title for your event");
|
||||||
let calendarApi = selectInfo.view.calendar;
|
// let calendarApi = selectInfo.view.calendar;
|
||||||
|
|
||||||
calendarApi.unselect(); // clear date selection
|
// calendarApi.unselect(); // clear date selection
|
||||||
|
|
||||||
if (title) {
|
// if (title) {
|
||||||
calendarApi.addEvent({
|
// calendarApi.addEvent({
|
||||||
id: createEventId(),
|
// id: createEventId(),
|
||||||
title,
|
// title,
|
||||||
start: selectInfo.startStr,
|
// start: selectInfo.startStr,
|
||||||
end: selectInfo.endStr,
|
// end: selectInfo.endStr,
|
||||||
allDay: selectInfo.allDay,
|
// allDay: selectInfo.allDay,
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
handleEventClick = (clickInfo) => {
|
handleEventClick = (clickInfo) => {
|
||||||
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
|
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user