diff --git a/backend/boards/views.py b/backend/boards/views.py
index 8b3fd47..d405c87 100644
--- a/backend/boards/views.py
+++ b/backend/boards/views.py
@@ -1,11 +1,13 @@
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework import status
+from rest_framework.permissions import IsAuthenticated
from boards.models import Board, ListBoard
from boards.serializers import BoardSerializer, ListBoardSerializer
class BoardViewSet(viewsets.ModelViewSet):
+ permission_classes = (IsAuthenticated,)
queryset = Board.objects.all()
serializer_class = BoardSerializer
http_method_names = ['get']
@@ -16,6 +18,7 @@ class BoardViewSet(viewsets.ModelViewSet):
class ListBoardViewSet(viewsets.ModelViewSet):
+ permission_classes = (IsAuthenticated,)
serializer_class = ListBoardSerializer
def get_queryset(self):
diff --git a/frontend/src/components/calendar/calendar.jsx b/frontend/src/components/calendar/calendar.jsx
index a85ea2d..79dae97 100644
--- a/frontend/src/components/calendar/calendar.jsx
+++ b/frontend/src/components/calendar/calendar.jsx
@@ -1,11 +1,10 @@
-import React from "react";
+import React, { useState } from "react";
import { formatDate } from "@fullcalendar/core";
import FullCalendar from "@fullcalendar/react";
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 = {
@@ -62,10 +61,13 @@ export class Calendar extends React.Component {
type="checkbox"
checked={this.state.weekendsVisible}
onChange={this.handleWeekendsToggle}
- className="mr-2"
+ className="mr-2 mb-4"
/>
Toggle weekends
+
{/* Show all task */}
diff --git a/frontend/src/components/kanbanBoard/kanbanBoard.jsx b/frontend/src/components/kanbanBoard/kanbanBoard.jsx
index b79cf50..2bda08b 100644
--- a/frontend/src/components/kanbanBoard/kanbanBoard.jsx
+++ b/frontend/src/components/kanbanBoard/kanbanBoard.jsx
@@ -224,30 +224,24 @@ export function KanbanBoard() {
const isActiveATask = active.data.current?.type === "Task";
const isOverAColumn = over.data.current?.type === "Column";
- const isOverATask = over.data.current?.type === "Task";
-
- // Reorder logic for Tasks within the same column
- if (isActiveATask && isOverATask) {
- setTasks((tasks) => {
- const activeIndex = tasks.findIndex((t) => t.id === activeId);
- const overIndex = tasks.findIndex((t) => t.id === overId);
-
- const reorderedTasks = arrayMove(tasks, activeIndex, overIndex);
-
- return reorderedTasks;
- });
- }
// Move tasks between columns and update columnId
if (isActiveATask && isOverAColumn) {
setTasks((tasks) => {
const activeIndex = tasks.findIndex((t) => t.id === activeId);
- tasks[activeIndex].columnId = overId;
+ // Extract the column ID from overId
+ const columnId = extractColumnId(overId);
+
+ tasks[activeIndex].columnId = columnId;
// API call to update task's columnId
axiosInstance
- .put(`todo/change_task_list_board/`, { todo_id: activeId, new_list_board_id: overId, new_index: 0 })
+ .put(`todo/change_task_list_board/`, {
+ todo_id: activeId,
+ new_list_board_id: over.data.current.task.columnId,
+ new_index: 0,
+ })
.then((response) => {})
.catch((error) => {
console.error("Error updating task columnId:", error);
@@ -258,6 +252,14 @@ export function KanbanBoard() {
}
}
+ // Helper function to extract the column ID from the element ID
+ function extractColumnId(elementId) {
+ // Implement logic to extract the column ID from elementId
+ // For example, if elementId is in the format "column-123", you can do:
+ const parts = elementId.split("-");
+ return parts.length === 2 ? parseInt(parts[1], 10) : null;
+ }
+
// Handle the drag-over event
function onDragOver(event) {
const { active, over } = event;
@@ -284,7 +286,16 @@ export function KanbanBoard() {
tasks[activeIndex].columnId = tasks[overIndex].columnId;
return arrayMove(tasks, activeIndex, overIndex - 1);
}
-
+ axiosInstance
+ .put(`todo/change_task_list_board/`, {
+ todo_id: activeId,
+ new_list_board_id: over.data.current.task.columnId,
+ new_index: 0,
+ })
+ .then((response) => {})
+ .catch((error) => {
+ console.error("Error updating task columnId:", error);
+ });
return arrayMove(tasks, activeIndex, overIndex);
});
}
@@ -294,7 +305,16 @@ export function KanbanBoard() {
if (isActiveATask && isOverAColumn && tasks.some((task) => task.columnId !== overId)) {
setTasks((tasks) => {
const activeIndex = tasks.findIndex((t) => t.id === activeId);
-
+ axiosInstance
+ .put(`todo/change_task_list_board/`, {
+ todo_id: activeId,
+ new_list_board_id: over.data.current.task.columnId,
+ new_index: 0,
+ })
+ .then((response) => {})
+ .catch((error) => {
+ console.error("Error updating task columnId:", error);
+ });
tasks[activeIndex].columnId = overId;
return arrayMove(tasks, activeIndex, activeIndex);
});
diff --git a/frontend/src/components/kanbanBoard/kanbanPage.jsx b/frontend/src/components/kanbanBoard/kanbanPage.jsx
index 399bfc3..92a8536 100644
--- a/frontend/src/components/kanbanBoard/kanbanPage.jsx
+++ b/frontend/src/components/kanbanBoard/kanbanPage.jsx
@@ -19,12 +19,12 @@ export const KanbanPage = () => {
onClick={() => handleTabClick("kanban")}>
Kanban
- handleTabClick("table")}>
Table
-
+ */}
diff --git a/frontend/src/components/navigations/IconSideNav.jsx b/frontend/src/components/navigations/IconSideNav.jsx
index c5d1708..9f9ad4b 100644
--- a/frontend/src/components/navigations/IconSideNav.jsx
+++ b/frontend/src/components/navigations/IconSideNav.jsx
@@ -9,9 +9,9 @@ const menuItems = [
{ id: 0, path: "/", icon: