diff --git a/back-end/src/main/java/com/example/demo/appuser/AppUser.java b/back-end/src/main/java/com/example/demo/appuser/AppUser.java index 66910687..63d65b16 100644 --- a/back-end/src/main/java/com/example/demo/appuser/AppUser.java +++ b/back-end/src/main/java/com/example/demo/appuser/AppUser.java @@ -62,7 +62,7 @@ public class AppUser implements UserDetails { // @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class , property = "id") // @JsonBackReference @JsonIgnore - @JsonIgnoreProperties("task") + @JsonIgnoreProperties("Task") private Set assignedTasks = new HashSet<>(); diff --git a/back-end/src/main/java/com/example/demo/task/Task.java b/back-end/src/main/java/com/example/demo/task/Task.java index 66b1d230..84691c95 100644 --- a/back-end/src/main/java/com/example/demo/task/Task.java +++ b/back-end/src/main/java/com/example/demo/task/Task.java @@ -26,7 +26,7 @@ public class Task { private String Subtasks; private float Progress; - @ManyToMany(fetch = FetchType.LAZY,cascade = CascadeType.ALL) + @ManyToMany(fetch = FetchType.LAZY,cascade = CascadeType.PERSIST) @JoinTable( name = "assigned_tasks", joinColumns = @JoinColumn (name = "Task_ID"), diff --git a/back-end/src/main/java/com/example/demo/task/TaskController.java b/back-end/src/main/java/com/example/demo/task/TaskController.java index ec3c536a..bb4f9d04 100644 --- a/back-end/src/main/java/com/example/demo/task/TaskController.java +++ b/back-end/src/main/java/com/example/demo/task/TaskController.java @@ -44,14 +44,12 @@ public void updateTask(@RequestBody Task updateTask){ taskService.updateTask(updateTask); } - @DeleteMapping("/{id}") -// @RequestMapping(method= RequestMethod.DELETE,value="/task/{id}") + @DeleteMapping("/{taskID}") public void deleteTask(@PathVariable Integer taskID){ taskService.deleteTask(taskID); } @PutMapping("/{taskID}/users/{userID}") -// @RequestMapping (method= RequestMethod.PUT,value="/task/{taskID}/users/{userID}") public void addUserToTask(@PathVariable Integer taskID,@PathVariable Long userID){ taskService.addUserToTask(taskID,userID); diff --git a/front-end/src/Pages/ProjectManagement.jsx b/front-end/src/Pages/ProjectManagement.jsx index 298dccf9..99517066 100644 --- a/front-end/src/Pages/ProjectManagement.jsx +++ b/front-end/src/Pages/ProjectManagement.jsx @@ -6,9 +6,10 @@ import {appUserRole,userID} from "../Pages/Login"; import style from "../components/ProjectManagement.module.css"; import AddTaskIcon from '@mui/icons-material/AddTask'; import CloseIcon from '@mui/icons-material/Close'; -import { Dialog, DialogActions, DialogContent, DialogTitle, Stack, TextField,Slider, Input } from "@mui/material"; -import { alignProperty } from "@mui/material/styles/cssUtils"; -import { Form } from "react-router-dom"; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faPen, faEye, faTrash } from '@fortawesome/free-solid-svg-icons'; +import { Dialog, DialogActions, DialogContent, Stack,Slider } from "@mui/material"; + const ProjectManagement = () => { const [users,setUsers] = useState([]); @@ -56,8 +57,8 @@ const onInputChange=(e)=>{ //When 'Add New' button is clicked : Only For Add New const onAddNewClicked=()=>{ setShowInterface(true); - // setAddRow(true); - // setEditRow(false); + setAddRow(true); + setEditRow(false); // setViewRow(false); setTask({ task_Name:"", @@ -72,11 +73,11 @@ const onAddNewClicked=()=>{ const onAddSubmit = async (e) => { e.preventDefault(); // Prevent default form submission try { - await axios.post("http://localhost:8080/tasks", task); + await axios.post("http://localhost:8080/api/v1/tasks", task); // reload the data after successful submission RefreshTasks(); // Clear the form fields after successful submission if needed - // setAddRow(false); + setAddRow(false); setShowInterface(false); } catch (error) { console.error("Error adding deliverable:", error); @@ -88,8 +89,8 @@ const onAddSubmit = async (e) => { const onEditClick = (task) => { setTask(task); setShowInterface(true); - // setAddRow(false); - // setEditRow(true); + setAddRow(false); + setEditRow(true); // setViewRow(false); } @@ -97,10 +98,10 @@ const onEditClick = (task) => { const onUpdateSubmit = async (e) => { e.preventDefault(); // Prevent default form submission try { - await axios.put(`http://localhost:8080/task/update/${task.task_ID}`, task); + await axios.put(`http://localhost:8080/api/v1/task/update/${task.task_ID}`, task); // Optionally, reload the data after successful submission RefreshTasks(); - // setEditRow(false); + setEditRow(false); setShowInterface(false); } catch (error) { console.error("Error editing tasks:", error); @@ -112,7 +113,8 @@ const onDeleteClick = async (task_ID) => { // console.log("Delete button clicked"); // console.log(deliverableRelatedNo); try { - await axios.delete(`http://localhost:8080/tasks/delete/${task_ID}`); + + await axios.delete(`http://localhost:8080/api/v1/tasks/${task_ID}`); RefreshTasks(); } catch (error) { console.error("Error deleting tasks:", error); @@ -190,42 +192,58 @@ const onDeleteClick = async (task_ID) => { {/* // a popup to add a new task */} - New Task - + {/* */} {/*
*/} - - - - - - - - - - - - - - - - - - { - users.map((user) => ( -
- - +
+
+
+

{editRow ? "Edit Entry" : "Add a New Entry"}

- )) - } - +
+ + +
+
+ + +
+
+ + +
+
+ + {/* */} +
+ +
+ + + {/*
*/} +
+
+ +
+ { + users.map((user) => ( +
+ + +
+ )) + } +
+
+
+
@@ -251,11 +269,11 @@ const onDeleteClick = async (task_ID) => { {/* link storing financial report location */} - {/*
- - - -
*/} + {isAdmin && +
+ + +
}
)) @@ -266,30 +284,6 @@ const onDeleteClick = async (task_ID) => { } - {/* //personal tasks */} - {/*
- - { - tasks.map((item) => ( -
-

{item.task_Name}

-

{item.newsDescription}

-

Start Date: {item.start_Date}

-

End Date: {item.end_Date}

-

Progress: {item.progress}

- Financial Report -
- )) - } - { - !taskListNotEmpty && -

No tasks assigned yet

- } - - -
*/} ); // } diff --git a/front-end/src/components/ProjectManagement.module.css b/front-end/src/components/ProjectManagement.module.css index fc3a559d..036b4bec 100644 --- a/front-end/src/components/ProjectManagement.module.css +++ b/front-end/src/components/ProjectManagement.module.css @@ -32,4 +32,68 @@ a:hover{ margin-right: 5%; margin-bottom: 2%; text-align: center; -} \ No newline at end of file +} + +/* Data input boxes and their topics */ +.inputbox { + display: flex; + align-items: center; + margin: 15px 20px; + } + .inputbox label{ + padding: 15px; + font-size: 16px; + width: 15% ; + } + + /* Inside the data input boxes */ + .inputbox .field { + width: 40%; + position: absolute; + left: 20%; + background: transparent; + border: 2px solid #c9e1ef; + outline: none; + padding: 15px; + font-size: 16px; + color: #333; + + } + + .inputbox .integerField { + width: 5%; + position: absolute; + right: 40%; + background: transparent; + border: 2px solid #c9e1ef; + outline: none; + padding: 15px; + font-size: 16px; + color: #333; + + } + + /* New Entry Interface */ +/* Form title */ +.formTitle { + text-align: center; + color:hsl(226, 64%, 35%); + font-size: 20px; + margin-top: 0px; + } + /* Form */ + .dataForm form { + margin-right: 20px; + margin-left: 20px; + justify-items: center; + } + + .checkBoxContainer { + border:2px solid #ccc; + width:300px; + height: 100px; + overflow-y: scroll; + scrollbar-color: white black; + background: transparent; + border: 2px solid #c9e1ef; +}