diff --git a/Controller/AthleteController.js b/Controller/AthleteController.js index 4676077..c5fc8a1 100644 --- a/Controller/AthleteController.js +++ b/Controller/AthleteController.js @@ -426,7 +426,7 @@ module.exports.goalOfAthletes = async function (req, res) { let first = new Date(goal.startdate); while (first.getTime() < new Date(goal.targetdate).getTime()) { - first.setTime(first.getTime() + 60000); + first.setTime(first.getTime() + 3600000); setReminder( new Date(first), // Ensure you pass a new Date object to setReminder diff --git a/Controller/ComplaintController.js b/Controller/ComplaintController.js index 9d9ce48..3db1723 100644 --- a/Controller/ComplaintController.js +++ b/Controller/ComplaintController.js @@ -1,6 +1,7 @@ const ComplaintModel = require("../Model/ComplaintModel"); const athleteModel = require("../Model/athleteModel"); const { sendPushNotification } = require("../PushNotification"); +const { setReminder } = require("../SetReminder"); module.exports.addComplaint = async function (req, res) { // console.log("file detail => " + req.file); @@ -28,15 +29,15 @@ module.exports.addComplaintApp = async function (req, res) { let Complaint = new ComplaintModel(req.body); let data = await Complaint.save(); - let Supervisor = await athleteModel - .findOne({ userId: req.body.userId }) - .populate("createdBy"); - if (Supervisor.createdBy.notificationtoken) { - sendPushNotification( - Supervisor.createdBy.notificationtoken, - "Athlete Raised Complaint", - "Click to View.." - ); + if (req.body.level === 0) { + let Supervisor = await athleteModel + .findOne({ userId: req.body.userId }) + .populate("createdBy"); + if (Supervisor.createdBy !== undefined) { + setReminder(Date.now(), "Click to View..", "Athlete Raised Complaint", [ + Supervisor.createdBy, + ]); + } } console.log(data); @@ -93,24 +94,22 @@ module.exports.updateComplaint = async function (req, res) { if (req.body.status !== undefined) { Complaint.status = req.body.status; if (req.body.status === 1) { - if (Complaint.userId.notificationtoken) { - sendPushNotification( - Complaint.userId.notificationtoken, - "Your Complaint Solved", - "Let us know about are you satisfied or not!" - ); - } + setReminder( + Date.now(), + "Let us know about are you satisfied or not!", + "Your Complaint Solved", + [Complaint.userId] + ); } } if (req.body.level !== undefined) { Complaint.level = req.body.level; - if (Complaint.userId.notificationtoken) { - sendPushNotification( - Complaint.userId.notificationtoken, - "Your Complaint Forwarded", - "Click here..." - ); + + if (req.body.level > 0 && Complaint.status === 0) { + setReminder(Date.now(), "Click here...", "Your Complaint Forwarded", [ + Complaint.userId, + ]); } } try { diff --git a/Controller/UserController.js b/Controller/UserController.js index 7ee3047..6fdc3d3 100644 --- a/Controller/UserController.js +++ b/Controller/UserController.js @@ -6,7 +6,6 @@ const InstructorModel = require("../Model/instructorModel"); const jwt = require("jsonwebtoken"); const { default: mongoose } = require("mongoose"); const athleteModel = require("../Model/athleteModel"); -const { sendPushNotification } = require("../PushNotification"); require("dotenv").config(); const { ACCESS_TOKEN_SECRET } = process.env; diff --git a/client-app/screens/Athelte/Complaint.js b/client-app/screens/Athelte/Complaint.js index 6c8eff0..9556ad6 100644 --- a/client-app/screens/Athelte/Complaint.js +++ b/client-app/screens/Athelte/Complaint.js @@ -172,10 +172,8 @@ const Complaint = ({ navigation }) => { Upload Photo - - - Submit - + + Submit diff --git a/client-app/screens/Athelte/ViewComplaint.js b/client-app/screens/Athelte/ViewComplaint.js index 550a5dd..b6e22c5 100644 --- a/client-app/screens/Athelte/ViewComplaint.js +++ b/client-app/screens/Athelte/ViewComplaint.js @@ -115,9 +115,12 @@ function ViewComplaint({ route, navigation }) { {dateBodyTemplate(item.date)} - - {RemarkBy(item, data.status, data.level)} - + + Remarks: {item.remark} + + {RemarkBy(item, data.status, data.level)} + + ))} @@ -199,6 +202,11 @@ const styles = StyleSheet.create({ width: "25%", borderRightWidth: 1, }, + column23: { + width: "70%", + marginLeft: "4%", + fontWeight: "bold", + }, column2: { width: "70%", marginLeft: "4%", diff --git a/client-app/screens/General/Main.js b/client-app/screens/General/Main.js index 6d93bf5..6714ec0 100644 --- a/client-app/screens/General/Main.js +++ b/client-app/screens/General/Main.js @@ -75,7 +75,7 @@ const Main = ({ navigation }) => { messaging() .getToken() .then(async (token) => { - console.log(token); + console.log("token = " + token); dispatch(NotificationActions.gettoken(token)); // dispatch(setFCM(token)); }); diff --git a/client-app/screens/General/RatingReview.js b/client-app/screens/General/RatingReview.js index f2aadeb..e37ac66 100644 --- a/client-app/screens/General/RatingReview.js +++ b/client-app/screens/General/RatingReview.js @@ -93,6 +93,9 @@ const RatingReview = ({ complexId }) => { style={styles.starContainer} /> + + {" " + review.createdAt.split("T")[0]} + {review.remarks} @@ -178,12 +181,13 @@ const styles = StyleSheet.create({ helpfulText: { fontSize: 16, fontWeight: "bold", + // alignItems: "center", // color: "#666", }, helpfulButton1: { flexDirection: "row", // alignItems: "center", - marginTop: 10, + // marginTop: 10, borderWidth: 1, borderRadius: 5, padding: 4, diff --git a/client-app/screens/Supervisor/SupervisorMain.js b/client-app/screens/Supervisor/SupervisorMain.js index e041773..3ee561c 100644 --- a/client-app/screens/Supervisor/SupervisorMain.js +++ b/client-app/screens/Supervisor/SupervisorMain.js @@ -33,8 +33,8 @@ const SupervisorMain = ({ navigation }) => { tabBarStyle: { backgroundColor: "#d7a592" }, // Background color of the tab bar })} > - + ); diff --git a/eas.json b/eas.json new file mode 100644 index 0000000..e69de29 diff --git a/public/complaints/3d7a8be9-d757-4fa8-beb8-7222a502984a.jpeg b/public/complaints/3d7a8be9-d757-4fa8-beb8-7222a502984a.jpeg new file mode 100644 index 0000000..5ff0adf Binary files /dev/null and b/public/complaints/3d7a8be9-d757-4fa8-beb8-7222a502984a.jpeg differ diff --git a/public/complaints/4c0352da-b9bd-4a05-bb97-f8a1aecabdbe.jpeg b/public/complaints/4c0352da-b9bd-4a05-bb97-f8a1aecabdbe.jpeg new file mode 100644 index 0000000..8a838a8 Binary files /dev/null and b/public/complaints/4c0352da-b9bd-4a05-bb97-f8a1aecabdbe.jpeg differ diff --git a/public/complaints/95499926-4c63-43da-a329-38af97e49dd4.jpeg b/public/complaints/95499926-4c63-43da-a329-38af97e49dd4.jpeg new file mode 100644 index 0000000..3218bd4 Binary files /dev/null and b/public/complaints/95499926-4c63-43da-a329-38af97e49dd4.jpeg differ diff --git a/public/complaints/f4cf77c4-b818-4552-8427-15f9cbe746c1.jpeg b/public/complaints/f4cf77c4-b818-4552-8427-15f9cbe746c1.jpeg new file mode 100644 index 0000000..17b7b7d Binary files /dev/null and b/public/complaints/f4cf77c4-b818-4552-8427-15f9cbe746c1.jpeg differ