Skip to content

Commit

Permalink
merge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoobGoda committed Jun 14, 2022
2 parents 6b5193c + 89ac163 commit 967b839
Show file tree
Hide file tree
Showing 50 changed files with 443 additions and 483 deletions.
53 changes: 46 additions & 7 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ main article {
word-break: break-all;
}

#restaurants li {
padding: 0.3em;
}

/*__________ retaurant _________________________*/

#main-restaurants {
Expand Down Expand Up @@ -151,6 +147,20 @@ main article {
grid-row-end: 3;
}

#add-to-favourites {
width: 3em;
height: 3em;
display: flex;
justify-content: center;
align-items: center;
margin-left: 11em;
}

#add-to-favourites ion-icon {
width: 2.5em;
height: 2.5em;
}

#restaurant #edit-restaurant {
grid-column-start: 2;
grid-column-end: 3;
Expand Down Expand Up @@ -222,7 +232,7 @@ main article {
font-size: 1.2em;
}

#category-and-plates article img{
#category-and-plates article img {
width: 14em;
}

Expand All @@ -234,13 +244,14 @@ main article {
#item-number {
display: none;
}

.dishID {
display: none;
}

/*__________ reviews ____________________________*/

#reviews{
#reviews {
background-color: var(--background-color);
color:black;
padding: 0.5em;
Expand All @@ -253,11 +264,31 @@ main article {
margin: 1em 0em;
}

.review-response{
.review-response {
margin: 0em;
padding: 0em 1em;
}

#add-comment {
margin-top: 3em;
}

#add-comment-form {
display: grid;
}

#add-comment-form textarea {
width: 75%;
}

#add-response-form {
display: grid;
}

#add-response-form textarea {
width: 75%;
}

/*__________ form _______________________________*/

main form {
Expand Down Expand Up @@ -328,6 +359,14 @@ main input{
padding: 1em;
}

#restaurants li {
padding: 0.3em;
}

#favourite-restaurants li {
padding: 0.3em
}

/*__________ footer _____________________________*/

footer {
Expand Down
30 changes: 30 additions & 0 deletions database/data-fetching/favourites.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
function getAllFavourites($db, $userID) {
$stmt = $db->prepare(
'SELECT Restaurant.restaurantID, name
FROM Favourite JOIN Restaurant ON Favourite.restaurantID = Restaurant.restaurantID
WHERE userID = :userID
ORDER BY name'
);
$stmt->bindParam(':userID', $userID);
$stmt->execute();
$favourites = $stmt->fetchAll();
return $favourites;
}

function checkIfFavourite($db, $userID, $restaurantID) {
$stmt = $db->prepare(
'SELECT * FROM Favourite
WHERE userID = :userID
AND restaurantID = :restaurantID'
);
$stmt->bindParam(':userID', $userID);
$stmt->bindParam(':restaurantID', $restaurantID);
$stmt->execute();
$favourites = $stmt->fetchAll();

if (sizeof($favourites) === 0)
return false;
return true;
}
?>
16 changes: 16 additions & 0 deletions database/data-fetching/user-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,20 @@ function getUserOrders($db) {
$orders = $stmt->fetchAll();
return $orders;
}

function checkIfOrderExists($db, $userID, $restaurantID) {
$stmt = $db->prepare(
'SELECT * FROM FoodOrder
WHERE customerID = :customerID
AND restaurantID = :restaurantID'
);
$stmt->bindParam(':customerID', $userID);
$stmt->bindParam(':restaurantID', $restaurantID);
$stmt->execute();
$orders = $stmt->fetchAll();

if (sizeof($orders) === 0)
return false;
return true;
}
?>
35 changes: 35 additions & 0 deletions database/data-insertion/insert-new-comment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
function addCommentToDatabase($db, $comment, $date, $custommerID, $restaurantID) {
$stmt = $db->prepare(
'INSERT INTO Review (comment, date, customerID, restaurantID) VALUES (
:comment,
:date,
:customerID,
:restaurantID
)'
);
$stmt->bindParam(':comment', $comment);
$stmt->bindParam(':date', $date);
$stmt->bindParam(':customerID', $custommerID);
$stmt->bindParam(':restaurantID', $restaurantID);

$stmt->execute();
}

function addResponseToDatabase($db, $comment, $date, $reviewID, $ownerID) {
$stmt = $db->prepare(
'INSERT INTO ReviewResponse (comment, date, reviewID, ownerID) VALUES (
:comment,
:date,
:reviewID,
:ownerID
)'
);
$stmt->bindParam(':comment', $comment);
$stmt->bindParam(':date', $date);
$stmt->bindParam(':reviewID', $reviewID);
$stmt->bindParam(':ownerID', $ownerID);

$stmt->execute();
}
?>
24 changes: 24 additions & 0 deletions database/data-insertion/update-favourite-status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
function addToFavourties($db, $userID, $restaurantID) {
$stmt = $db->prepare(
'INSERT INTO Favourite VALUES(
:userID,
:restaurantID
)'
);
$stmt->bindParam(':userID', $userID);
$stmt->bindParam(':restaurantID', $restaurantID);
$stmt->execute();
}

function removeFromFavourites($db, $userID, $restaurantID) {
$stmt = $db->prepare(
'DELETE FROM Favourite
WHERE userID = :userID
AND restaurantID = :restaurantID'
);
$stmt->bindParam(':userID', $userID);
$stmt->bindParam(':restaurantID', $restaurantID);
$stmt->execute();
}
?>
Binary file modified database/restaurants.db
Binary file not shown.
7 changes: 7 additions & 0 deletions database/restaurants.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PRAGMA foreign_keys = ON;

DROP TABLE IF EXISTS Favourite;
DROP TABLE if EXISTS DishFoodOrder;
DROP TABLE if EXISTS ReviewResponse;
DROP TABLE if EXISTS Review;
Expand Down Expand Up @@ -74,6 +75,12 @@ CREATE TABLE DishFoodOrder(

);

CREATE TABLE Favourite(
userID INTEGER REFERENCES User(userID),
restaurantID INTEGER REFERENCES Restaurant(restaurantID),
PRIMARY KEY(userID, restaurantID)
);

--INSERTS-------------------------------------------------------------

--USERS---------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion dish-info-edit-page.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
session_start();
require_once('php/output-functions/draw-dish-edit-form.php');
require_once('php/output-functions/forms/draw-dish-edit-form.php');
require_once('php/output-functions/draw-header.php');
require_once('php/output-functions/draw-footer.php');

Expand Down
2 changes: 1 addition & 1 deletion dish-register-page.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
session_start();
require_once('php/output-functions/draw-dish-register-form.php');
require_once('php/output-functions/forms/draw-dish-register-form.php');
require_once('php/output-functions/draw-header.php');
require_once('php/output-functions/draw-footer.php');

Expand Down
39 changes: 0 additions & 39 deletions html/changeDishInfo.html

This file was deleted.

67 changes: 0 additions & 67 deletions html/index.html

This file was deleted.

Loading

0 comments on commit 967b839

Please sign in to comment.