Skip to content

Commit

Permalink
Hunar (#50)
Browse files Browse the repository at this point in the history
* Add folder for student register

issue: There was a router problem for student register
resolve: always make page.js for route just separate them by making different folders.

* database

* - Created useContext for user (uid)
- Added service folder with functions to read and write data from the database
- Added authentication for student/homepage and student/information
- Updated student/login page to fix email and password authentication issues

* starting login page

* login page design

* signup page complete

* adding colors

* file change

* forget password

* add modal

* add conditions

* login page

* add posst function for menu and restaurant details

* meging with main

* adding restaurant information page

* fetching and adding data for restaurants

* merging from origin

* merge from orign

* adding emails status in database

* add and create function for adding new email with active status
add and create function for getting email names where active status is true
make changes in register page to check that email is in database for register

* chengin import sttement

* adding terms condition

* adding logos facility

* merge from master

* update database
sait-staff

* adding search option

* commit

* connecting sait-staff with database

* merging form master

* changes on sait

* mege from master to origin

* changing restaurant info table

* adding data to database

* updating cards

* adding logc for increase and decrease arrow

* adding databse changes

* updating datasbe function to getting student information

* adding authentication for restaurants

* changing Searching bar

* adding search bar in sait-staff

* updating restaurant login page

* adding update,delete and change password features

* adding fuctionality of deleting user's information from database including user data and restaurant menu, delete data from storage and from authentication

* update edit functionallity in sait-staff and add delete functionality in restaurant

* add add functionality for admins

* Hunar (#46)

* Add folder for student register

issue: There was a router problem for student register
resolve: always make page.js for route just separate them by making different folders.

* database

* - Created useContext for user (uid)
- Added service folder with functions to read and write data from the database
- Added authentication for student/homepage and student/information
- Updated student/login page to fix email and password authentication issues

* starting login page

* login page design

* signup page complete

* adding colors

* file change

* forget password

* add modal

* add conditions

* login page

* add posst function for menu and restaurant details

* meging with main

* adding restaurant information page

* fetching and adding data for restaurants

* merging from origin

* merge from orign

* adding emails status in database

* add and create function for adding new email with active status
add and create function for getting email names where active status is true
make changes in register page to check that email is in database for register

* chengin import sttement

* adding terms condition

* adding logos facility

* merge from master

* update database
sait-staff

* adding search option

* commit

* connecting sait-staff with database

* merging form master

* changes on sait

* mege from master to origin

* changing restaurant info table

* adding data to database

* updating cards

* adding logc for increase and decrease arrow

* adding databse changes

* updating datasbe function to getting student information

* adding authentication for restaurants

* changing Searching bar

* adding search bar in sait-staff

* updating restaurant login page

* adding update,delete and change password features

* adding fuctionality of deleting user's information from database including user data and restaurant menu, delete data from storage and from authentication

---------

Co-authored-by: Abdel Mouzahir <[email protected]>

* trying to show username in saitstaff

* console log

* small change

* remove azure

* adding loading animation

* loading in all login pages

* trying to fetch the name

* fetch data in login

* comment to hunar

* problem solved mentioned by abdel

* updatinf sait-login

---------

Co-authored-by: Abdel Mouzahir <[email protected]>
Co-authored-by: abdel mouzahir <[email protected]>
  • Loading branch information
3 people authored Jul 4, 2024
1 parent c9fc02d commit a1968a7
Show file tree
Hide file tree
Showing 3 changed files with 2,259 additions and 7,907 deletions.
9 changes: 3 additions & 6 deletions app/sait-staff/login/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ const SignIn = () => {
const user = auth.currentUser;
if (user) {
const uid = user.uid;
console.log('user ',uid)
const q = query(collection(db, "saitStaff"), where("uid", "==", uid));
const querySnapshot = await getDocs(q);
const employeeData = querySnapshot.docs.map((doc) => doc.data().name);
console.log('name: ',employeeData);

if (!employeeData.empty) {
const saitStaffData = employeeData[0];
const name = saitStaffData || "SAIT Staff"; // Use default name if 'name' is not available
setSaitStaffName(name);
console.log("user name: ",name)
} else {
console.log("No SAIT Staff data found for current user");
setSaitStaffName("SAIT Staff"); // Set default name
Expand All @@ -58,7 +57,6 @@ const SignIn = () => {
try {
const userCredential = await signInWithEmailAndPassword(email, password);
const user = userCredential.user;
console.log(user);

// Update display name with SAIT Staff name
await updateProfile(user, { displayName: saitStaffName });
Expand All @@ -67,12 +65,11 @@ const SignIn = () => {
sessionStorage.setItem("name", saitStaffName);
sessionStorage.setItem("email", user.email || ""); // Store the user's email
sessionStorage.setItem("uid", user.uid || ""); // Store the user's UID
console.log(saitStaffName);
router.push("/sait-staff"); // Redirect after successful sign-in
setEmail("");
setPassword("");
setLoginError("");
setLoading(false);
router.push("/sait-staff"); // Redirect after successful sign-in
// setLoading(false);
} catch (error) {
setLoading(false);
setLoginError("Invalid email or password");
Expand Down
6 changes: 6 additions & 0 deletions merging from master
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Merge remote-tracking branch 'origin/master' into hunar
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
Loading

0 comments on commit a1968a7

Please sign in to comment.