Commit 981aa286 authored by Muhammad Zubair's avatar Muhammad Zubair
Browse files

Update SimpleWebApp/.gitkeep, SimpleWebApp/screenshot/w01/halaman_home.png,...

Update SimpleWebApp/.gitkeep, SimpleWebApp/screenshot/w01/halaman_home.png, SimpleWebApp/screenshot/w01/halaman_product_id_0.png, SimpleWebApp/screenshot/w01/halaman_product_id_1.png, SimpleWebApp/screenshot/w01/halaman_product_id_2.png, SimpleWebApp/screenshot/w01/halaman_product_id_3.png, SimpleWebApp/screenshot/w01/halaman_product_id_4.png, SimpleWebApp/screenshot/w01/halaman_product_id_5.png, SimpleWebApp/screenshot/w01/halaman_product_id_6.png, SimpleWebApp/index.php, SimpleWebApp/index.js, SimpleWebApp/jsonObj.js, SimpleWebApp/product.php, SimpleWebApp/routingProduct.js, SimpleWebApp/style.css, SimpleWebApp/style_index.css, SimpleWebApp/style_product.css, SimpleWebApp/listShoppingCart.php, SimpleWebApp/login.php, SimpleWebApp/style_listShoppingCart.css, SimpleWebApp/style_login.css, SimpleWebApp/userData.txt, SimpleWebApp/screenshot/w02/home_2.png, SimpleWebApp/screenshot/w02/login_page.png, SimpleWebApp/screenshot/w02/shopping_cart_empty.png, SimpleWebApp/screenshot/w02/shopping_cart.png, SimpleWebApp/screenshot/w02/home_checkbox_selected_book_2_4_6.png, SimpleWebApp/screenshot/w02/home_full.png files
parent 124685de
for (const key in objBooks) {
const book = objBooks[key];
document.getElementById("products").insertAdjacentHTML("beforeend",
`
<div class="box-product">
<a href="./product.php?id=${key}">
<div id="product${key}" class="products-item">
<img class="products-cover" src=` + book["primer"]["url-foto"] + ' alt="book image" height=200>' + `
<h2 class="products-title">`+ book["judul"] + `</h2>
<p class="products-price">Rp` + book['primer']["harga"] + `,00</p>
</div>
</a>
<input type="checkbox" name="book${key}" value="${key}">
</div>
`
);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shopping Cart</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="./style_listShoppingCart.css">
</head>
<body>
<script type="text/javascript" src="jsonObj.js"></script>
<a id="back-to-home" class="btn-top" href="./">Back to Home</a>
<div class="container">
<h1>Shopping Cart</h1>
<?php
$jsonObj = '
{
"books": [
{
"judul": "Untuk Apa Seni",
"primer": {
"url_foto": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1392706216l/20837627.jpg",
"harga": 60000
},
"deskripsi": {
"penulis": "Bambang Sugiharto, dkk",
"penerbit": "Pustaka Matahari",
"penyunting": "Bambang Sugiharto"
}
},
{
"judul": "Warisan Sejarah Arianisme",
"primer": {
"url_foto": "https://pustaka.iainbukittinggi.ac.id/wp-content/uploads/2018/12/arian-198x300.jpg",
"harga": 97000
},
"deskripsi": {
"judul-asli": "Archetypal Heresy: Arianism Through the Centuries",
"penulis": "Maurice Wiles",
"penerjemah": "Zaenal Muttaqin",
"penerbit": "Pustaka Matahari",
"penerbit-asli": "Oxford University Press, Inc."
}
},
{
"judul": "Sejarah Filsafat Kontemporer: Jerman dan Inggris",
"primer": {
"url_foto": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1551165807l/4309628._SX318_.jpg",
"harga": 70000
},
"deskripsi": {
"penulis": "K. Bertens",
"penerbit": "PT Gramedia Pustaka Utama"
}
},
{
"judul": "Sejarah Filsafat Kontemporer: Prancis",
"primer": {
"url_foto": "https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1243418656l/6498943.jpg",
"harga": 63000
},
"deskripsi": {
"penulis": "K. Bertens",
"penerbit": "PT Gramedia Pustaka Utama"
}
},
{
"judul": "Semiotika dan Hipersemiotika",
"primer": {
"url_foto": "https://s2.bukalapak.com/img/7734600261/large/IMG_20170912_134621_scaled.jpg",
"harga": 120000
},
"deskripsi": {
"penulis": "Yasraf Amir Piliang",
"penerbit": "Pustaka Matahari"
}
},
{
"judul": "Epistemologi Dasar",
"primer": {
"url_foto": "https://togamas.com/css/images/items/potrait/JPEGG_5905_Epistemologi_Dasar.jpg",
"harga": 60000
},
"deskripsi": {
"penulis": "J. Sudarminta",
"penerbit": "Penerbit Kanisius"
}
},
{
"judul": "Teori-Teori Etika",
"primer": {
"url_foto": "https://s2.bukalapak.com/img/2027491742/large/Buku_Teori_Teori_Etika_karya_Gordon_Graham.jpg",
"harga": 96000
},
"deskripsi": {
"penulis": "Nusamedia",
"penerbit": "Gordon Graham"
}
}
]
}';
session_start();
$objBooks = json_decode($jsonObj);
foreach ($_POST as $postKey => $postValue) {
if (substr_count($postKey, "book") >= 1){
$_SESSION[$postKey] = $postValue;
}
}
$isBookExist = false;
foreach ($_SESSION as $sessionKey => $sessionValue) {
if (substr_count($sessionKey, "book") >= 1) {
echo
"<div class=\"cart\">" .
"<h3>". $objBooks->books[$sessionValue]->judul ."</h3>" .
"<img src=" .
$objBooks->books[$sessionValue]->primer->url_foto .
" alt=\"book img\"> ".
"</div>";
$isBookExist = true;
}
}
if (!$isBookExist) {
echo "<p>You haven't added any book</p>";
}
?>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="./style_login.css">
<style>
</style>
</head>
<body>
<?php
session_start();
?>
<form class="form-wrap" action="./" method="post">
<h1>Login</h1>
<div class="form-group">
<label for="Username">Username</label>
<input type="text" name="username" id="username">
</div>
<div class="form-group">
<label for="Password">Password</label>
<input type="password" name="password" id="password">
</div>
<input id="btn" type="submit" value="Login">
</form>
</body>
</html>
\ No newline at end of file
......@@ -9,6 +9,9 @@
<link rel="stylesheet" href="./style_product.css">
</head>
<body>
<?php
session_start();
?>
<div id="product-container-details">
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment