Calendar can now only view and delete task

This commit is contained in:
sosokker 2023-11-28 11:52:03 +07:00
parent 275738d902
commit c2824ec383

View File

@ -5,6 +5,7 @@ import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
import { getEvents, createEventId } from "./TaskDataHandler";
import { axiosInstance } from "src/api/AxiosConfig";
export class Calendar extends React.Component {
state = {
@ -25,13 +26,13 @@ export class Calendar extends React.Component {
right: "dayGridMonth,timeGridWeek,timeGridDay",
}}
initialView="dayGridMonth"
editable={true}
selectable={true}
editable={false}
selectable={false}
selectMirror={true}
dayMaxEvents={true}
weekends={this.state.weekendsVisible}
initialEvents={getEvents}
select={this.handleDateSelect}
// select={this.handleDateSelect}
eventContent={renderEventContent}
eventClick={this.handleEventClick}
eventsSet={this.handleEvents}
@ -85,22 +86,22 @@ export class Calendar extends React.Component {
});
};
handleDateSelect = (selectInfo) => {
let title = prompt("Please enter a new title for your event");
let calendarApi = selectInfo.view.calendar;
// handleDateSelect = (selectInfo) => {
// let title = prompt("Please enter a new title for your event");
// let calendarApi = selectInfo.view.calendar;
calendarApi.unselect(); // clear date selection
// calendarApi.unselect(); // clear date selection
if (title) {
calendarApi.addEvent({
id: createEventId(),
title,
start: selectInfo.startStr,
end: selectInfo.endStr,
allDay: selectInfo.allDay,
});
}
};
// if (title) {
// calendarApi.addEvent({
// id: createEventId(),
// title,
// start: selectInfo.startStr,
// end: selectInfo.endStr,
// allDay: selectInfo.allDay,
// });
// }
// };
handleEventClick = (clickInfo) => {
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {