Skip to content

Commit

Permalink
Merge pull request #141 from e20178dulanga/main
Browse files Browse the repository at this point in the history
Email sending with notification updated
  • Loading branch information
e20178dulanga authored Oct 14, 2024
2 parents 524e66b + 3fbc601 commit 25648dc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 10 additions & 0 deletions front-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
9 changes: 8 additions & 1 deletion front-end/src/Pages/ProjectManagement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand All @@ -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") {
Expand Down Expand Up @@ -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 {
Expand All @@ -122,6 +126,8 @@ console.log("aaa ",assignedUsers)
setShowInterface(false);
} catch (error) {
console.error("Error adding deliverable:", error);
}finally {
setIsLoading(false); // Hide loading indicator
}
};

Expand Down Expand Up @@ -225,7 +231,7 @@ const onDeleteClick = async (task_ID) => {
{/* // a popup to add a new task */}
<Dialog open={showInterface} onClose={closePopUp} fullWidth maxWidth="md" >
<DialogContent >

<div className = "dataForm">
<form onSubmit={editRow ? onUpdateSubmit : onAddSubmit}>
<div className = {style["formTitle"]}>
Expand Down Expand Up @@ -273,6 +279,7 @@ const onDeleteClick = async (task_ID) => {
</div>
</div>
{addRow? <button type = "submit">Add</button> : <button type = "submit">Update</button> }
{isLoading && <ClipLoader size={20} color={"#123abc"}/>}
</form>
</div>
</DialogContent>
Expand Down

0 comments on commit 25648dc

Please sign in to comment.