Skip to content

Commit

Permalink
Hunar (#47)
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

---------

Co-authored-by: Abdel Mouzahir <[email protected]>
  • Loading branch information
hunardeep720 and Abdelmouzahir authored Jul 1, 2024
1 parent bb4d2cc commit a81b51a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
46 changes: 21 additions & 25 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 @@ -69,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 @@ -84,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 @@ -142,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
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
2 changes: 1 addition & 1 deletion app/sait-staff/overviewDash/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getAllStudentsInformation, getRestaurantInformation } from "@/services/

import { FaUsers, FaChartLine } from "react-icons/fa";
import { AiOutlineShop, AiOutlineTeam } from "react-icons/ai";
import {useSpring, animated} from "react-spring";
import { useSpring, animated } from "react-spring";

function NumberChange({n}){
const {number} = useSpring({
Expand Down
6 changes: 6 additions & 0 deletions merge 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.

0 comments on commit a81b51a

Please sign in to comment.