Compare commits
10 Commits
feature/aj
...
main
Author | SHA1 | Date |
---|---|---|
Sana EL HIRI | adfd1db2ff | |
HarmandI | d09b147af2 | |
HarmandI | 4aced57191 | |
Vincent Ramiere | a2ddf52c88 | |
Vincent Ramiere | 200221dc5c | |
Sana | 4f5e6cd180 | |
Sana EL HIRI | 33c431921d | |
Vincent Ramiere | bd4468a9d6 | |
Vincent Ramiere | 983533e4e1 | |
HarmandI | a2cf4f55ed |
189
db.json
189
db.json
|
@ -1,107 +1,104 @@
|
|||
{
|
||||
"list_products": [
|
||||
{
|
||||
"id": "801427",
|
||||
"product_name": "Strelitzia Nicolai : D.21-H.75",
|
||||
"product_price": "59,99",
|
||||
"product_instock": "disponible",
|
||||
"product_discount_code": "",
|
||||
"product_color": "Blanc",
|
||||
"product_unitprice_ati": "59.99",
|
||||
"product_unitprice_tf": "54.5",
|
||||
"product_discount_tf": "0.00",
|
||||
"product_discount_ati": "0.00",
|
||||
"product_qty": 0,
|
||||
"product_rating": 3,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_url_page": "https://www.truffaut.com/strelitzia-nicolai-d-21-h-75-801427.html",
|
||||
"product_url_picture": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0801000/801427_001.jpg",
|
||||
"product_shipping_method": null,
|
||||
"product_image_source": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0801000/801427_001.jpg",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non"
|
||||
},
|
||||
{
|
||||
"id": "910744",
|
||||
"product_name": "Spathiphyllum 'Sweet Lauretta' Pot déco foncé D24cm",
|
||||
"product_price": "84,99",
|
||||
"product_instock": "disponible",
|
||||
"product_name": "bibi",
|
||||
"product_price": "5",
|
||||
"product_qty": 5,
|
||||
"product_rating": 5,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_instock": [
|
||||
[
|
||||
[
|
||||
[
|
||||
"disponible"
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
"product_url_picture": "https//picsum.photos/id/18/200/300",
|
||||
"product_discount_code": "",
|
||||
"product_color": "",
|
||||
"product_unitprice_ati": "84.99",
|
||||
"product_unitprice_tf": "77.3",
|
||||
"product_discount_tf": "0.00",
|
||||
"product_discount_ati": "0.00",
|
||||
"product_qty": 0,
|
||||
"product_rating": 3,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_url_page": "https://www.truffaut.com/spathiphyllum-sweet-lauretta-pot-deco-fonce-d24cm-910744.html",
|
||||
"product_url_picture": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0910000/910744_001.jpg",
|
||||
"product_unitprice_ati": "",
|
||||
"product_unitprice_tf": "",
|
||||
"product_discount_tf": "",
|
||||
"product_discount_ati": "",
|
||||
"product_url_page": "",
|
||||
"product_shipping_method": null,
|
||||
"product_image_source": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0910000/910744_001.jpg",
|
||||
"product_image_source": "",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non"
|
||||
},
|
||||
{
|
||||
"id": "910743",
|
||||
"product_name": "Spathiphyllum 'Sweet Lauretta' Pot déco clair D24cm",
|
||||
"product_price": "84,99",
|
||||
"product_instock": "disponible",
|
||||
"product_name": "Baba",
|
||||
"product_price": "5",
|
||||
"product_qty": 5,
|
||||
"product_rating": 5,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_instock": [
|
||||
[
|
||||
"disponible"
|
||||
]
|
||||
],
|
||||
"product_url_picture": "https//picsum.photos/id/18/200/300",
|
||||
"product_discount_code": "",
|
||||
"product_color": "",
|
||||
"product_unitprice_ati": "84.99",
|
||||
"product_unitprice_tf": "77.3",
|
||||
"product_discount_tf": "0.00",
|
||||
"product_discount_ati": "0.00",
|
||||
"product_qty": 0,
|
||||
"product_rating": 3,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_url_page": "https://www.truffaut.com/spathiphyllum-sweet-lauretta-pot-deco-clair-d24cm-910743.html",
|
||||
"product_url_picture": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0910000/910743_001.jpg",
|
||||
"product_unitprice_ati": "",
|
||||
"product_unitprice_tf": "",
|
||||
"product_discount_tf": "",
|
||||
"product_discount_ati": "",
|
||||
"product_url_page": "",
|
||||
"product_shipping_method": null,
|
||||
"product_image_source": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0910000/910743_001.jpg",
|
||||
"product_image_source": "",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non"
|
||||
},
|
||||
{
|
||||
"id": "63158",
|
||||
"product_name": "Spathiphyllum: d.14cm, pot grand modèle",
|
||||
"product_price": "7,95",
|
||||
"product_instock": "disponible",
|
||||
"product_name": "boubou",
|
||||
"product_price": "5",
|
||||
"product_qty": 5,
|
||||
"product_rating": 5,
|
||||
"product_breadcrumb_label": "cactus et plantes grasses",
|
||||
"product_instock": [
|
||||
"partiellement disponible"
|
||||
],
|
||||
"product_url_picture": "https//picsum.photos/id/18/200/300",
|
||||
"product_discount_code": "",
|
||||
"product_color": "Blanc",
|
||||
"product_unitprice_ati": "7.95",
|
||||
"product_unitprice_tf": "7.2",
|
||||
"product_discount_tf": "0.00",
|
||||
"product_discount_ati": "0.00",
|
||||
"product_qty": 1,
|
||||
"product_rating": 3,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_url_page": "https://www.truffaut.com/spathiphyllum-d-14cm-pot-grand-modele-63158.html",
|
||||
"product_url_picture": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0063000/63158_005.jpg",
|
||||
"product_color": "",
|
||||
"product_unitprice_ati": "",
|
||||
"product_unitprice_tf": "",
|
||||
"product_discount_tf": "",
|
||||
"product_discount_ati": "",
|
||||
"product_url_page": "",
|
||||
"product_shipping_method": null,
|
||||
"product_image_source": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0063000/63158_005.jpg",
|
||||
"product_seller": "Truffaut",
|
||||
"product_web_only": "oui"
|
||||
"product_image_source": "",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non"
|
||||
},
|
||||
{
|
||||
"id": "910674",
|
||||
"product_name": "Spathiphyllum 'Sweet Lauretta' pot D24cm",
|
||||
"product_price": "69,99",
|
||||
"product_instock": "disponible",
|
||||
"product_qty": 3,
|
||||
"product_rating": 4,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_instock": [
|
||||
[
|
||||
"disponible"
|
||||
]
|
||||
],
|
||||
"product_url_picture": "https//picsum.photos/id/18/200/300",
|
||||
"product_discount_code": "",
|
||||
"product_color": "",
|
||||
"product_unitprice_ati": "69.99",
|
||||
"product_unitprice_tf": "63.6",
|
||||
"product_discount_tf": "0.00",
|
||||
"product_discount_ati": "0.00",
|
||||
"product_qty": 0,
|
||||
"product_rating": 3,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_url_page": "https://www.truffaut.com/spathiphyllum-sweet-lauretta-pot-d24cm-910674.html",
|
||||
"product_url_picture": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0910000/910674_001.jpg",
|
||||
"product_unitprice_ati": "",
|
||||
"product_unitprice_tf": "",
|
||||
"product_discount_tf": "",
|
||||
"product_discount_ati": "",
|
||||
"product_url_page": "",
|
||||
"product_shipping_method": null,
|
||||
"product_image_source": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0910000/910674_001.jpg",
|
||||
"product_image_source": "",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non"
|
||||
},
|
||||
|
@ -109,20 +106,22 @@
|
|||
"id": "801429",
|
||||
"product_name": "Strelitzia Nicolai Cache-pot Anthracite: D.21-H.75",
|
||||
"product_price": "64,99",
|
||||
"product_instock": "disponible",
|
||||
"product_discount_code": "",
|
||||
"product_color": "Blanc",
|
||||
"product_unitprice_ati": "64.99",
|
||||
"product_unitprice_tf": "59.1",
|
||||
"product_discount_tf": "0.00",
|
||||
"product_discount_ati": "0.00",
|
||||
"product_qty": 0,
|
||||
"product_rating": 3,
|
||||
"product_qty": 5,
|
||||
"product_rating": 4.5,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_url_page": "https://www.truffaut.com/strelitzia-nicolai-cache-pot-gris-d-21-h-75-801429.html",
|
||||
"product_url_picture": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0801000/801429_001.jpg",
|
||||
"product_instock": [
|
||||
"disponible"
|
||||
],
|
||||
"product_url_picture": "https//picsum.photos/id/18/200/300",
|
||||
"product_discount_code": "",
|
||||
"product_color": "",
|
||||
"product_unitprice_ati": "",
|
||||
"product_unitprice_tf": "",
|
||||
"product_discount_tf": "",
|
||||
"product_discount_ati": "",
|
||||
"product_url_page": "",
|
||||
"product_shipping_method": null,
|
||||
"product_image_source": "https://images.truffaut.com/media/catalog/product/cdn:///Articles/jpg/0801000/801429_001.jpg",
|
||||
"product_image_source": "",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non"
|
||||
},
|
||||
|
@ -5986,13 +5985,16 @@
|
|||
"product_web_only": "oui"
|
||||
},
|
||||
{
|
||||
"product_name": "Belle plante",
|
||||
"product_price": "35",
|
||||
"product_qty": 1,
|
||||
"product_rating": 3,
|
||||
"product_breadcrumb_label": "orchides",
|
||||
"id": "JbdahUA",
|
||||
"product_name": "bibi",
|
||||
"product_price": "8",
|
||||
"product_qty": 5,
|
||||
"product_rating": 5,
|
||||
"product_breadcrumb_label": "plantes fleuries",
|
||||
"product_instock": [
|
||||
"non disponible"
|
||||
[
|
||||
"non disponible"
|
||||
]
|
||||
],
|
||||
"product_url_picture": "https//picsum.photos/id/18/200/300",
|
||||
"product_discount_code": "",
|
||||
|
@ -6005,8 +6007,7 @@
|
|||
"product_shipping_method": null,
|
||||
"product_image_source": "",
|
||||
"product_seller": "market place",
|
||||
"product_web_only": "non",
|
||||
"id": "Fcq4EWk"
|
||||
"product_web_only": "non"
|
||||
}
|
||||
],
|
||||
"users": [
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light shadow ">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">🪴 La Belle Plante</a>
|
||||
<button class="navbar-toggler"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
<button class="navbar-toggler"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarNavAltMarkup"
|
||||
aria-controls="navbarNavAltMarkup"
|
||||
aria-expanded="false"
|
||||
aria-controls="navbarNavAltMarkup"
|
||||
aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
@ -21,6 +21,7 @@
|
|||
<a class="nav-link disabled" *ngIf="likeCounter == 0"> Pas de plante likée</a>
|
||||
<a class="nav-link disabled" *ngIf="likeCounter == 1">Plante likée : {{ likeCounter }}</a>
|
||||
<a class="nav-link disabled" *ngIf="likeCounter > 1">Plantes likées : {{ likeCounter }}</a>
|
||||
<a routerLink="admin" routerLinkActive="active-custom" class="nav-link">Page administrateur</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
margin-right: auto;
|
||||
border: solid 1px;
|
||||
border-radius: 10px;
|
||||
background-color: #64c982;
|
||||
border-color: #64c982;
|
||||
background-color: #306340;
|
||||
border-color: #306340;
|
||||
}
|
||||
|
||||
.form-plant .checkbox {
|
||||
|
@ -70,6 +70,6 @@
|
|||
.btn-outline-success {
|
||||
margin-top: 10px;
|
||||
background-color: #ffff;
|
||||
color: #64c982 !important;
|
||||
border-color: #64c982 !important;
|
||||
color: #306340 !important;
|
||||
border-color: #306340 !important;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { Category } from "./category";
|
||||
|
||||
export class Plant {
|
||||
constructor(
|
||||
public name: string='',
|
||||
|
@ -9,6 +7,6 @@ export class Plant {
|
|||
public category:string[]=['plantes fleuries','orchides','cactus et plantes grasses','bonsas','plantes vertes','palmier dintrieur'],
|
||||
public urlPicture: string = "https//picsum.photos/id/18/200/300",
|
||||
public rating: number = 0,
|
||||
public id?: string
|
||||
public id: string = ''
|
||||
){}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
h1{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: rgba(0, 0, 0, 0.658);
|
||||
font-size: 28px;
|
||||
margin-top: 20px;
|
||||
|
|
|
@ -60,7 +60,8 @@ export class PageAjouterComponent implements OnInit {
|
|||
};
|
||||
|
||||
this.adminService.addPlant(plante)?.subscribe((resp)=>{
|
||||
this.router.navigate(['admin']);
|
||||
})
|
||||
this.router.navigate(['admin']);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
h1{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: rgba(0, 0, 0, 0.658);
|
||||
font-size: 28px;
|
||||
margin-top: 20px;
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
<table class="table" *ngIf="subCollection$ | async as collection">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Id</th>
|
||||
<th scope="col">Nom</th>
|
||||
<th scope="col">Prix</th>
|
||||
<th scope="col">Quantité</th>
|
||||
<th scope="col">En stock</th>
|
||||
<th scope="col">Catégorie</th>
|
||||
<th scope="col">Note</th>
|
||||
<th scope="col">Modifier</th>
|
||||
<th scope="col">Supprimer</th>
|
||||
<div id="container">
|
||||
<div id="button">
|
||||
<button class="w-100 btn btn-lg btn-outline-success" routerLink="../ajouter">Ajouter une plante </button>
|
||||
</div>
|
||||
<table class="table" *ngIf="subCollection$ | async as collection">
|
||||
<thead class="thead-dark" style="background-color: #306340 ; color:#f3f7f4 ;">
|
||||
<tr>
|
||||
<th scope="col">Id</th>
|
||||
<th scope="col">Nom</th>
|
||||
<th scope="col">Prix</th>
|
||||
<th scope="col">Quantité</th>
|
||||
<th scope="col">En stock</th>
|
||||
<th scope="col">Catégorie</th>
|
||||
<th scope="col">Note</th>
|
||||
<th scope="col">Modifier</th>
|
||||
<th scope="col">Supprimer</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let products of collection">
|
||||
<td>{{products.id}}</td>
|
||||
<td>{{products.name}}</td>
|
||||
<td>{{products.price}}</td>
|
||||
<td>{{products.quantity}}</td>
|
||||
<td>{{products.inStock}}</td>
|
||||
<td>{{products.category}}</td>
|
||||
<td>{{products.rating}}</td>
|
||||
<td><a class="bi-pencil-square" style="color: #5472b1;" routerLink="../modifier/{{products.id}}"></a></td>
|
||||
<td class="bi-trash-fill" style="color: rgb(231, 73, 73); cursor: pointer;" (click)="onClickDelete(products.id)"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let products of collection">
|
||||
<th scope="row">{{products.id}}</th>
|
||||
<td>{{products.name}}</td>
|
||||
<td>{{products.price}}</td>
|
||||
<td>{{products.quantity}}</td>
|
||||
<td>{{products.inStock}}</td>
|
||||
<td>{{products.category}}</td>
|
||||
<td>{{products.rating}}</td>
|
||||
<td><a class="bi-pencil-square" routerLink="../modifier/{{products.id}}"></a></td>
|
||||
<td class="bi-trash-fill" style="color: red; cursor: pointer;" (click)="onClickDelete(products.id)"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button routerLink="../ajouter">Ajouter une plante </button>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#container{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 5rem;
|
||||
}
|
||||
table{
|
||||
width: 75%;
|
||||
margin-left: 2rem;
|
||||
}
|
||||
button{
|
||||
background-color: #306340;
|
||||
color: #f3f7f4 !important;
|
||||
border-color: #306340 !important;
|
||||
}
|
||||
#button{
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
|
|
@ -28,8 +28,7 @@ export class PageTableauComponent implements OnInit {
|
|||
// })
|
||||
}
|
||||
|
||||
onClickDelete(id: any){
|
||||
console.log(id);
|
||||
onClickDelete(id: string){
|
||||
this.adminService.onClickDelete(id).subscribe((resp) => {
|
||||
console.log("Suppression successful : ", resp);
|
||||
});
|
||||
|
|
|
@ -31,7 +31,6 @@ export class AdminService {
|
|||
public refreshCollection(): void {
|
||||
// On se sert de notre flux de donnée type observable froid
|
||||
this.collection$.subscribe((listPlant: Plant[]) => {
|
||||
this.plantCollection = [...listPlant];
|
||||
// Utiliser un observable chaud (subject) pour nexter nos données recues de notre observable froid
|
||||
this.subCollection$.next(listPlant);
|
||||
})
|
||||
|
@ -40,7 +39,7 @@ export class AdminService {
|
|||
addPlant(plant: Plant): Observable<any> | void {
|
||||
return this.httpClient.post(`${this.apiUrl}/list_products`, plant);
|
||||
}
|
||||
onClickDelete(id: number): Observable<any> {
|
||||
onClickDelete(id: string): Observable<any> {
|
||||
return this.httpClient.delete<any>(`${this.apiUrl}/list_products/${id}`).pipe(
|
||||
tap(() => this.refreshCollection())
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue