Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hunar #49

Merged
merged 90 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
13c1be6
Add folder for student register
hunardeep720 May 16, 2024
d66f17a
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 May 27, 2024
4efbd63
database
hunardeep720 May 28, 2024
a604a4a
- Created useContext for user (uid)
hunardeep720 May 28, 2024
8cf80bc
Merge branch 'master' into hunar
Abdelmouzahir May 28, 2024
8546781
merge master into hunar
hunardeep720 May 30, 2024
130b7ef
starting login page
hunardeep720 May 31, 2024
1c987cc
login page design
hunardeep720 Jun 1, 2024
1450ea9
Merge branch 'master' into hunar
hunardeep720 Jun 1, 2024
dfb88a9
signup page complete
hunardeep720 Jun 1, 2024
0697f9a
Merge branch 'hunar' of https://github.com/Abdelmouzahir/studentscoop…
hunardeep720 Jun 1, 2024
0b25395
adding colors
hunardeep720 Jun 1, 2024
393e812
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 1, 2024
3e1fcbc
file change
hunardeep720 Jun 1, 2024
edd54b4
forget password
hunardeep720 Jun 2, 2024
19b93f1
add modal
hunardeep720 Jun 2, 2024
f393bcb
Merge branch 'master' into hunar
hunardeep720 Jun 2, 2024
29019ae
merge from origin/master
hunardeep720 Jun 2, 2024
2a44982
add conditions
hunardeep720 Jun 2, 2024
527518c
Merge branch 'hunar' of https://github.com/Abdelmouzahir/studentscoop…
hunardeep720 Jun 2, 2024
63b866f
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 2, 2024
2d9c7f6
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 2, 2024
5bef163
login page
hunardeep720 Jun 2, 2024
e1d59cf
Merge branch 'master' into hunar
hunardeep720 Jun 2, 2024
aa37123
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 2, 2024
40dcf8c
Merge branch 'hunar' of https://github.com/Abdelmouzahir/studentscoop…
hunardeep720 Jun 2, 2024
b5cba7e
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 3, 2024
cb573dc
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 4, 2024
7d531f2
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 4, 2024
47e8ed3
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 4, 2024
ed9eaf9
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 4, 2024
b4f9723
add posst function for menu and restaurant details
hunardeep720 Jun 5, 2024
dfe8f69
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 5, 2024
2450c3c
meging with main
hunardeep720 Jun 5, 2024
101ab8d
adding restaurant information page
hunardeep720 Jun 5, 2024
f29a768
fetching and adding data for restaurants
hunardeep720 Jun 5, 2024
47c0ad7
Merge branch 'master' into hunar
hunardeep720 Jun 5, 2024
0d2cfc5
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 6, 2024
65d3839
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 8, 2024
e3bf978
merging from origin
hunardeep720 Jun 8, 2024
42ddda5
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 10, 2024
af61dcf
merge from orign
hunardeep720 Jun 10, 2024
4b43ac0
adding emails status in database
hunardeep720 Jun 11, 2024
be86cf2
add and create function for adding new email with active status
hunardeep720 Jun 11, 2024
94bdae6
Merge branch 'master' into hunar
hunardeep720 Jun 11, 2024
b77dddb
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 11, 2024
5dce3a2
chengin import sttement
hunardeep720 Jun 11, 2024
eae2c42
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 11, 2024
92fe4c8
to solve the colflicts with master branch and add new changes from ma…
hunardeep720 Jun 11, 2024
e80ed5c
adding terms condition
hunardeep720 Jun 11, 2024
ea1f24f
for merging from master
hunardeep720 Jun 11, 2024
72a8dbf
adding logos facility
hunardeep720 Jun 12, 2024
488c105
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 12, 2024
6c02f31
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 12, 2024
ca77b7f
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 13, 2024
161a4f1
merge from master
hunardeep720 Jun 13, 2024
46344ae
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 17, 2024
1c00471
update database
hunardeep720 Jun 18, 2024
3648b10
Merge branch 'master' into hunar
hunardeep720 Jun 18, 2024
a098cb2
adding search option
hunardeep720 Jun 18, 2024
a452058
commit
hunardeep720 Jun 18, 2024
b8eaa27
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 18, 2024
5c109c0
connecting sait-staff with database
hunardeep720 Jun 18, 2024
59c9a3f
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 18, 2024
985b984
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 20, 2024
1c9d654
merging form master
hunardeep720 Jun 20, 2024
5eecf46
changes on sait
hunardeep720 Jun 20, 2024
90bca74
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 22, 2024
c91c166
mege from master to origin
hunardeep720 Jun 22, 2024
e1d40d5
changing restaurant info table
hunardeep720 Jun 22, 2024
848d1de
adding data to database
hunardeep720 Jun 22, 2024
9c14400
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 23, 2024
d67e543
updating cards
hunardeep720 Jun 23, 2024
668b217
adding logc for increase and decrease arrow
hunardeep720 Jun 24, 2024
67b1db7
Merge branch 'master' into hunar
hunardeep720 Jun 24, 2024
057f92a
adding databse changes
hunardeep720 Jun 25, 2024
660f3ba
updating datasbe function to getting student information
hunardeep720 Jun 25, 2024
641b7d8
adding authentication for restaurants
hunardeep720 Jun 25, 2024
53e27e3
Merge remote-tracking branch 'origin/master' into hunar
hunardeep720 Jun 25, 2024
84b7141
changing Searching bar
hunardeep720 Jun 25, 2024
9f5f777
adding search bar in sait-staff
hunardeep720 Jun 25, 2024
09da5ee
updating restaurant login page
hunardeep720 Jun 25, 2024
f582af6
Merge branch 'master' into hunar
hunardeep720 Jun 25, 2024
3200e21
adding update,delete and change password features
hunardeep720 Jun 28, 2024
b30515c
Merge branch 'hunar' of https://github.com/Abdelmouzahir/studentscoop…
hunardeep720 Jun 28, 2024
7d5b791
Merge branch 'master' into hunar
hunardeep720 Jun 28, 2024
6be5807
adding fuctionality of deleting user's information from database incl…
hunardeep720 Jun 29, 2024
4ca06e8
Merge branch 'master' into hunar
hunardeep720 Jun 30, 2024
c6d2c64
update edit functionallity in sait-staff and add delete functionality…
hunardeep720 Jul 1, 2024
55a1df3
add add functionality for admins
hunardeep720 Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/auth/sign-in/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { auth } from "@/app/firebase/config";
import { useRouter } from "next/navigation";
import Link from "next/link";
import { sendPasswordResetEmail } from "firebase/auth";
import Modal from "@/components/Modal";
import Modal from "@/Components/Modal";
import { BiSolidCommentError } from "react-icons/bi";

const sign_in = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/restraunt/AddMenu/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Page = () => {
);
return;
}
await addRestaurantMenu(user, name, price, description, image[0]).then(() => {
await addRestaurantMenu(user, name, price, description, image[0],user).then(() => {
router.push("/restraunt/home");
}
);
Expand Down
49 changes: 21 additions & 28 deletions app/restraunt/home/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useTable, useGlobalFilter } from "react-table";
import Image from "next/image";
import { MoreHorizontal } from "lucide-react";
import { useUserAuth } from "@/services/utils";
import { db } from "@/app/firebase/config";
import { deleteDoc, doc } from "firebase/firestore";
import {
getMenuInformation,
getRestaurantInformationByUser,
Expand Down Expand Up @@ -39,17 +41,14 @@ import Link from "next/link";

export default function SettingsRestaurant() {
const { user } = useUserAuth();
const [restaurantData, setRestaurantData] = useState([]);
const [menuData, setMenuData] = useState(null);
const route = useRouter();
const [selectedProduct, setSelectedProduct] = useState(null);
const [globalFilter, setGlobalFilter] = useState("");

useEffect(() => {
console.log("user: ", user);
async function gettingRestaurantMenu() {
const data = await getMenuInformation(user);
console.log("data: ", data);
if (data.length <= 0) {
}
setMenuData(data);
Expand All @@ -72,13 +71,14 @@ export default function SettingsRestaurant() {
setSelectedProduct(product);
};

const handleProductDelete = (productId) => {
setMenuData(menuData.filter((product) => product.id !== productId));
const handleProductDelete = async (productId) => {
await deleteDoc(doc(db, "restaurant_menu", productId)).then(() => {
setMenuData(menuData.filter((product) => product.id !== productId));
});
};

const columns = React.useMemo(
() => [
/*
{
Header: "Image",
accessor: "imageUrl",
Expand All @@ -87,25 +87,25 @@ export default function SettingsRestaurant() {
alt={`Product image - ${original.name}`}
className="aspect-square rounded-md object-cover"
height="64"
src={"url(/assets/images/restCover.jpg)"}
width="64"
/>
),
},
*/
{
Header: 'Image',
accessor: 'imageUrl',
Cell: ({ row: { original } }) => (
<img
alt={`Product image - ${original.name}`}
className="aspect-square rounded-md object-cover"
height="64"
src="/assets/images/food.png" // Correct path to the image
src={original.imageUrl}
width="64"
/>
),
},

// {
// Header: 'Image',
// accessor: 'imageUrl',
// Cell: ({ row: { original } }) => (
// <img
// alt={`Product image - ${original.name}`}
// className="aspect-square rounded-md object-cover"
// height="64"
// src="/assets/images/food.png" // Correct path to the image
// width="64"
// />
// ),
// },
{
Header: "Name",
accessor: "name",
Expand Down Expand Up @@ -145,13 +145,6 @@ export default function SettingsRestaurant() {
},
className: "hidden md:table-cell",
},

// {
// Header: "Total Sales",
// accessor: "totalSales",
// Cell: () => "0",
// className: "hidden md:table-cell",
// },
{
Header: "Actions",
accessor: "actions",
Expand Down
13 changes: 1 addition & 12 deletions app/restraunt/setting/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";
import { useState, useEffect } from "react";
import { auth } from "@/app/firebase/config";
import { deleteUser } from "firebase/auth";
import { useUserAuth } from "@/services/utils";
import { useRouter } from "next/navigation";
import { getRestaurantInformationByUser } from "@/services/GetRequest/getRequest";
Expand Down Expand Up @@ -33,9 +32,7 @@ import {
Dialog,
DialogContent,
DialogFooter,
DialogClose,
} from "@/components/ui/dialog";
import { useActionData } from "react-router-dom";

export default function Component() {
const { user } = useUserAuth();
Expand All @@ -44,15 +41,9 @@ export default function Component() {
const [address, setAddress] = useState("");
const [id, setId] = useState('');
const [email, setEmail] = useState('');
const [showCurrentPassword, setShowCurrentPassword] = useState(false);
const [showNewPassword, setShowNewPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const [showPasswordResetModal, setShowPasswordResetModal] = useState(false);
const [currentUser, setCurrentUser] = useState(null);
const route = useRouter();
const handlePasswordReset = () => {
setShowPasswordResetModal(true);
};
useEffect(() => {
async function gettingUserInformation() {
const data = await getRestaurantInformationByUser(user);
Expand All @@ -61,7 +52,6 @@ export default function Component() {
if (user) {
setCurrentUser(auth.currentUser);
gettingUserInformation();
console.log(auth.currentUser);
}
if (user == false) {
route.push("/");
Expand All @@ -71,7 +61,6 @@ export default function Component() {
useEffect(() => {
if (userData) {
userData.map((information)=>{
console.log("information: ",typeof information.id)
setName(information.name);
setId(information.id);
setAddress(information.address);
Expand All @@ -86,7 +75,7 @@ export default function Component() {


async function deleteCurrentUser() {
await deleteRestaurantUser(currentUser,id).then(()=>alert("Your account has been deleted successfully!"))
await deleteRestaurantUser(currentUser,id,user);
}

async function passwordChange(){
Expand Down
5 changes: 2 additions & 3 deletions app/sait-staff/RDashboard/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ const Edit = ({ restaurants, selectedRestaurant, setRestaurants, setIsEditing, g
<input
id="email"
type="email"
name="email"
value={email}
onChange={e => setEmail(e.target.value)}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
// onChange={(e) => setEmail(e.target.value)}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none sm:text-sm cursor-not-allowed bg-black/20"
/>
</div>
<div>
Expand Down
4 changes: 2 additions & 2 deletions app/sait-staff/SDashboard/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const Edit = ({ selectedStudent, setIsEditing }) => {
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
// onChange={(e) => setEmail(e.target.value)}
className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none sm:text-sm cursor-not-allowed bg-black/20"
/>
</div>
<div>
Expand Down
Loading
Loading