diff --git a/back-end/src/main/java/com/example/demo/notification/NotificationService.java b/back-end/src/main/java/com/example/demo/notification/NotificationService.java index baa448a..de77ae7 100644 --- a/back-end/src/main/java/com/example/demo/notification/NotificationService.java +++ b/back-end/src/main/java/com/example/demo/notification/NotificationService.java @@ -26,7 +26,9 @@ public NotificationService(NotificationRepository notificationRepository, AppUse public Notification createNotification(String message, AppUser user, String notificationType) { Notification notification = new Notification(message, user, notificationType); notification = notificationRepository.save(notification); - sendNotificationEmail(user.getEmail(), message); // Send email after saving notification + if ("typeTask".equals(notificationType)) { + sendNotificationEmail(user.getEmail(), message); + } return notification; } diff --git a/front-end/package-lock.json b/front-end/package-lock.json index 7af7540..28f8a4e 100644 --- a/front-end/package-lock.json +++ b/front-end/package-lock.json @@ -27,6 +27,7 @@ "react-router-dom": "^6.23.1", "react-simple-maps": "^3.0.0", "react-slideshow-image": "^4.3.1", + "react-spinners": "^0.14.1", "react-switch": "^7.0.0" }, "devDependencies": { @@ -5116,6 +5117,15 @@ "react": ">=15" } }, + "node_modules/react-spinners": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/react-spinners/-/react-spinners-0.14.1.tgz", + "integrity": "sha512-2Izq+qgQ08HTofCVEdcAQCXFEYfqTDdfeDQJeo/HHQiQJD4imOicNLhkfN2eh1NYEWVOX4D9ok2lhuDB0z3Aag==", + "peerDependencies": { + "react": "^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-switch": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/react-switch/-/react-switch-7.0.0.tgz", diff --git a/front-end/package.json b/front-end/package.json index 260e07c..d1603a8 100644 --- a/front-end/package.json +++ b/front-end/package.json @@ -29,6 +29,7 @@ "react-router-dom": "^6.23.1", "react-simple-maps": "^3.0.0", "react-slideshow-image": "^4.3.1", + "react-spinners": "^0.14.1", "react-switch": "^7.0.0" }, "devDependencies": { diff --git a/front-end/src/Pages/ProjectManagement.jsx b/front-end/src/Pages/ProjectManagement.jsx index e954a80..ad27515 100644 --- a/front-end/src/Pages/ProjectManagement.jsx +++ b/front-end/src/Pages/ProjectManagement.jsx @@ -9,6 +9,7 @@ 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"; import {loggedInUser} from '../components/Header.jsx' +import { ClipLoader } from "react-spinners"; const ProjectManagement = () => { const [users,setUsers] = useState([]); @@ -22,6 +23,8 @@ const ProjectManagement = () => { const [appUserRole, setAppUserRole] = useState(loggedInUser.userRole); const [userID, setUserID] = useState(loggedInUser.userID); + const [isLoading, setIsLoading] = useState(false); + //to load for the first time on page visit useEffect(() => { if (appUserRole=="ADMIN") { @@ -110,6 +113,7 @@ const onAddNewClicked=()=>{ //When 'Add' button is clicked in the interface : Only For Add New const onAddSubmit = async (e) => { e.preventDefault(); // Prevent default form submission +setIsLoading(true); const { assignedUsers, ...newtaskFormat } = task; console.log("aaa ",assignedUsers) try { @@ -122,6 +126,8 @@ console.log("aaa ",assignedUsers) setShowInterface(false); } catch (error) { console.error("Error adding deliverable:", error); + }finally { + setIsLoading(false); // Hide loading indicator } }; @@ -225,7 +231,7 @@ const onDeleteClick = async (task_ID) => { {/* // a popup to add a new task */} - +
@@ -273,6 +279,7 @@ const onDeleteClick = async (task_ID) => {
{addRow? : } + {isLoading && }