-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFavoris.php
131 lines (99 loc) · 4.5 KB
/
Favoris.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
session_start();
require_once "./req/verify.php";
?>
<!DOCTYPE html>
<html lang="en">
<?php
require_once "./req/verify.php";
?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Favoris</title>
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/navbar.css" rel="stylesheet">
<script src="../js/jquery-3.5.1.slim.min.js"></script>
<script src="../js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="../css/bootstrap-icons.css">
<link rel="stylesheet" href="../css/admin/sidebar.css">
<style>
</style>
</head>
<body>
<?php
require_once "req/navbar.php";
?>
<div class="container-fluid mt-5 pt-5">
<div class="jumbotron">
<div class="card">
<h1 class="text-warning text-center" style="font-family: Comic Sans MS">My wishlist</h1>
<div class="card-body" id="card-body">
</div>
</div>
</div>
</div>
<div class="container-fluid">
<?php
require_once "req/footbar.php";
?>
</div>
<!-- Modal del -->
<div class="modal fade" id="modal_del" tabindex="-1" aria-labelledby="modal_del" aria-hidden="true">
<div class="modal-dialog modal-md ">
<div class="modal-content" id="modal_content_del">
</div>
</div>
</div>
<script>
function read() {
fetch("../php/Favoris/read_wishlist").then(resp => resp.json()).then(json => {
const data = json.data;
console.log(data);
data.forEach(element => {
$("#card-body").append(`
<div class="card mx-5">
<div class="card-body">
<div class="row">
<div class="col col-md-2">
<img class="card-img-right" src="http://fakeimg.pl/150x150/" alt="Card image cap">
</div>
<div class="col col-md-6 pl-5">
<div class="row">
<div>
<h3 style="font-family: Comic Sans MS">${element.label}</h3>
<ul class="list-inline pull-right">
<li><i class="bi bi-star-fill" style="color: yellow;"></i><i class="bi bi-star-fill" style="color: yellow;"></i><i class="bi bi-star-fill" style="color: yellow;"></i><i class="bi bi-star-half" style="color: yellow;"></i><i class="bi bi-star" style="color: yellow;"></i></li>
</ul>
<h5 class="text-danger">${element.prix_produit}<br>
<button type="button" class="btn btn-warning btn-sm mt-2"style="border-radius: 5px;">Acheter maintenant</button>
</div>
</div>
</div>
<div class="col col-md-4 ">
<span><div class="d-flex justify-content-end px-3">
<button type="button" style="border-radius: 5px;" class="h-50 w-25 btn-success"><a href="produit?id_produit=${element.id_produit}" class="text-white">view</a></button>
<button type="button" style="border-radius: 5px;" class="h-50 w-25 ml-1 btn-danger" onclick="del(${element.id_produit},${element.id_client})">remove</button>
</div></span>
</div>
</div>
</div>
</div>
<br>
<hr>
<br>
`);
});
});
}
function del(id_produit, id_client) {
fetch("../php/Favoris/delp?id_produit=" + id_produit + "&id_client=" + id_client).then(resp => resp.json()).then(json => {
const data = json.data;
}).catch(err => {
console.log(err);
});
};
read();
</script>
</body>
</html>