Ca commence à fonctionner

This commit is contained in:
2023-11-13 22:53:12 +01:00
parent 6feedc24c2
commit f958d0918b
5 changed files with 152 additions and 37 deletions

View File

@@ -11,7 +11,7 @@
</head>
<body>
<div class="container mt-4">
<div class="mt-4 p-5 bg-primary text-white rounded">
<div class="mt-4 p-5 bg-danger text-white rounded">
<h1>Liste des cadeaux de Noël pour Louisa</h1>
<p>{{ message }}</p>
</div>
@@ -24,12 +24,13 @@
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>Réservé par</li>
<li>Qui va l'offrir ?</li>
<li>&nbsp;</li>
<li>Qui l'achète ?</li>
</ul>
{{#each cadeaux}}
<ul>
<li><a href="{{this.lien}}" target="_blank">Voir le produit</a></li>
<li>
<figure class="figure">
<img src="{{this.photo}}" class="figure-img img-fluid rounded" alt="Pas d'image" ob>
@@ -37,9 +38,8 @@
</figure>
</li>
<li>{{this.prix}} €</li>
<li><a href="{{this.lien}}" target="_blank">Voir le produit</a></li>
<li>{{#if this.acheteur}}{{this.acheteur}}
{{else}}<a href="/reserve?id={{this.id}}" class="btn btn-primary">Le réserver</a>{{/if}}
{{else}}<a href="/choix-offrant?cadeau={{this.id}}" class="btn btn-primary">Le réserver</a>{{/if}}
</li>
<li>
<div class="form-check form-switch">

30
views/offrant.hbs Normal file
View File

@@ -0,0 +1,30 @@
<!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>Qui êtes-vous ?</title>
<link rel="stylesheet" href="/styles.css">
<link href="/css/bootstrap.min.css" rel="stylesheet">
</head>
</head>
<body>
<div class="container mt-4">
<div class="mt-4 p-5 bg-danger text-white rounded">
<h1>Qui êtes-vous ?</h1>
<p>{{ message }}</p>
</div>
<input type="hidden" name="cadeau" id="cadeau-reg" value="{{cadeau}}">
<div class="card" style="width: 30rem;">
<div class="card-body">
{{#each listeOffrants}}
<div class="mb-3">
<a href="reservation?cadeau={{../cadeau}}&offrant={{this.id}}" class="btn btn-primary offrants">{{this.prenom}}</a>
</div>
{{/each}}
</div>
<a href="/" class="btn btn-secondary">Retour aux cadeaux</a>
</div>
</body>
</html>

View File

@@ -11,49 +11,58 @@
</head>
<body>
<div class="container mt-4">
<div class="mt-4 p-5 bg-primary text-white rounded">
<div class="mt-4 p-5 bg-danger text-white rounded">
<h1>Réserver ce cadeau</h1>
<p>{{ message }}</p>
</div>
</div>
<div class="container mt-4">
<input type="hidden" name="id" id="id-reg" value="{{id}}">
<div class="card" style="width: 30rem;">
<div class="card-header">{{libelle}}</div>
<div class="card" style="width: 30rem;">
<div class="card-header">{{infosCadeaux.libelle}}</div>
<div class="card-body">
<form action="/confirm-reservation" method="POST">
<input type="hidden" name="cadeau" id="cadeau-id" value="{{infosCadeaux.id}}">
<input type="hidden" name="offrant" id="offrant-id" value="{{offrant.id}}">
<div class="mb-3">
<img src="{{photo}}" class="image">
<img src="{{infosCadeaux.photo}}" class="image">
</div>
<div class="mb-3">
<label for="responsable-reg" class="form-label">Qui es-tu ?</label>
<select name="responsable" id="responsable-reg" class="">
<option value="" disabled selected>Choisir dans la liste</option>
{{#each responsable}}
<option value="{{this.id}}">{{this.prenom}}</option>
{{/each}}
</select>
<input type="text" disabled id="offrant-reg" name="offrant" value="{{offrant.prenom}}">
<p class="depenses">Pour l'instant, tu as déjà dépensé : {{totalAchats}}€</p>
</div>
<br>
<div class="mb-3">
<label for="password-reg" class="form-label">Le cadeau a-t-il déjà été acheté ?</label>
<label class="form-label">Le cadeau a-t-il déjà été acheté ?</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="1">
<label class="form-check-label" for="inlineRadio1">Oui</label>
<input class="form-check-input" type="radio" name="achete" id="achete1" value="1" {{#if infosCadeaux.achete}}checked{{/if}}>
<label class="form-check-label" for="achete1">Oui</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="0" checked>
<label class="form-check-label" for="inlineRadio2">Non</label>
<input class="form-check-input" type="radio" name="achete" id="achete2" value="0" {{#unless infosCadeaux.achete}}checked{{/unless}}>
<label class="form-check-label" for="achete2">Non</label>
</div>
</div>
<div class="mb-3">
<label for="responsable-reg" class="form-label">Qui doit s'occuper de l'achat ?</label>
<select name="acheteur" id="acheteur-reg" class="">
<select name="responsableAchat" id="acheteur-reg" required class="form-select" aria-label="Default select example">
<option value="" disabled selected>Choisir dans la liste</option>
{{#each responsable}}
{{#each listeResponsables}}
<option value="{{this.id}}">{{this.prenom}}</option>
{{/each}}
</select>
</div>
<div class="mb-3">
<label class="form-label">Le cadeau a-t-il déjà été payé ?</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="paye" id="paye1" value="1" {{#if infosCadeaux.paye}}checked{{/if}}>
<label class="form-check-label" for="paye1">Oui</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="paye" id="paye2" value="0" {{#unless infosCadeaux.paye}}checked{{/unless}}>
<label class="form-check-label" for="paye2">Non</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Enregistrer</button>
<a href="/" class="btn btn-secondary">Retour aux cadeaux</a>
</form>