Rajout de la colonne Emballé et modifs de style

This commit is contained in:
2023-12-09 14:52:36 +01:00
parent 9729a1d43c
commit d670d26bd5
5 changed files with 64 additions and 36 deletions

2
.env
View File

@@ -1,5 +1,5 @@
DATABASE = wishlist DATABASE = wishlist
DATABASE_HOST = db.thecoredev.fr DATABASE_HOST = nas.thecoredev.fr
DATABASE_PORT = 3306 DATABASE_PORT = 3306
DATABASE_USER = wishlist DATABASE_USER = wishlist
DATABASE_PASSWORD = 7/yvv9JA[RomOkLe DATABASE_PASSWORD = 7/yvv9JA[RomOkLe

View File

@@ -1,5 +0,0 @@
DATABASE = wishlist
DATABASE_HOST = db.thecoredev.fr
DATABASE_PORT = 3306
DATABASE_USER = wishlist
DATABASE_PASSWORD = 7/yvv9JA[RomOkLe

View File

@@ -4,27 +4,53 @@
text-align: left; text-align: left;
} }
/* .tableau li {
.tableau li:nth-child(2), width: 80px;
.tableau li:nth-child(3), }
.tableau li:nth-child(4), .tableau li:nth-child(2) {
.tableau li:nth-child(5) { width: 200px;
width: 100px; }
.tableau li:nth-child(3) {
width: 20px;
} }
*/
.tableau li { .tableau li {
flex: auto; flex: auto;
list-style-type: none; list-style-type: none;
width: min-content; padding: 0px 4px;
padding: 8px;
align-self: center; align-self: center;
text-align: left;
}
figure {
margin: 4px 0px !important;
}
.tableau ul:nth-child(even) {
background-color: #f47f7f;
}
.tableau ul:nth-child(odd) {
background-color: white;
}
.tableau figcaption {
font-weight: bold;
}
.tableau ul:nth-child(even) figcaption{
color: white;
}
.tableau ul:nth-child(odd) figcaption {
color: #f47f7f;
} }
.tableau ul:nth-child(even) { .tableau ul:nth-child(even) {
background-color: aliceblue; color: white;
} }
.tableau ul:nth-child(odd) {
color: #f47f7f;
}
.tableau ul:first-child li { .tableau ul:first-child li {
font-weight: bold; font-weight: bold;
} }

View File

@@ -20,14 +20,14 @@
<br> <br>
<div class="tableau"> <div class="tableau">
<ul> <ul style="display: none">
<li>&nbsp;</li> <li>&nbsp;</li>
<li>&nbsp;</li> <li>&nbsp;</li>
<li>&nbsp;</li> <li>&nbsp;</li>
<li>Qui va l'offrir ?</li> <li>Qui va l'offrir ?</li>
<li>&nbsp;</li> <li>Statut</li>
<li>Qui l'achète ?</li>
<li>Noël ou son anniv' ?</li> <li>Noël ou son anniv' ?</li>
<li>Emballé ?</li>
</ul> </ul>
{{#each cadeaux}} {{#each cadeaux}}
<ul> <ul>
@@ -45,24 +45,19 @@
<li> <li>
<div class="form-check form-switch"> <div class="form-check form-switch">
{{#if this.achete}} {{#if this.achete}}
<input class="form-check-input" type="checkbox" id="flexAcheteCheckedDisabled-{{this.id}}" checked disabled> <label class="form-check-label">Déja acheté{{#equals this.responsableAchat "Les parents"}}{{#unless this.paye}}<br>A rembourser{{/unless}}{{/equals}}</label>
<label class="form-check-label" for="flexAcheteCheckedDisabled-{{this.id}}">Déja acheté</label>
{{else}} {{else}}
<input class="form-check-input" type="checkbox" id="flexAcheteDisabled-{{this.id}}" disabled> <label class="form-check-label">A acheter{{#equals this.responsableAchat "Les parents"}}{{#unless this.paye}}<br>A rembourser{{/unless}}{{/equals}}</label>
<label class="form-check-label" for="flexAcheteDisabled-{{this.id}}">A acheter</label>
{{/if}} {{/if}}
</div> </div>
<div class="form-check form-switch">
{{#if this.paye}}
<input class="form-check-input" type="checkbox" id="flexPayeCheckedDisabled-{{this.id}}" checked disabled>
<label class="form-check-label" for="flexPayeCheckedDisabled-{{this.id}}">Déja payé</label>
{{else}}
<input class="form-check-input" type="checkbox" id="flexPayeDisabled-{{this.id}}" disabled>
<label class="form-check-label" for="flexPayeDisabled-{{this.id}}">A payer</label>
{{/if}}
</div>
<li>{{#if this.responsable_achat}}{{this.responsableAchat}}{{/if}}</li>
<li>{{#if this.pourNoel}}Noël{{else}}Anniversaire{{/if}}</li> <li>{{#if this.pourNoel}}Noël{{else}}Anniversaire{{/if}}</li>
<li>
{{#if this.emballe}}
<label class="form-check-label">Déja emballé</label>
{{else}}
<label class="form-check-label">A emballer</label>
{{/if}}
</li>
</ul> </ul>
{{/each}} {{/each}}
</div> </div>

View File

@@ -34,9 +34,21 @@ app.use(bodyParser.urlencoded({extended: false}));
app.use(express.json()) app.use(express.json())
const isEqual = function(a, b, opts) {
if (a == b) {
return opts.fn(this)
} else {
return opts.inverse(this)
}
}
var hbs = require('hbs');
hbs.registerHelper('equals', isEqual);
app.get("/", (req, res) => { app.get("/", (req, res) => {
db.query('SELECT c.id as "id", c.libelle as "libelle", c.prix, c.photo as "photo", c.lien, p.prenom as "acheteur", c.achete as "achete", c.paye as "paye", p2.prenom as "responsableAchat", c.pour_noel as "pourNoel" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id LEFT OUTER JOIN participant p on p.id = pc.offrant LEFT OUTER JOIN participant p2 on p2.id = pc.responsable_achat ORDER BY c.prix', async (error, resultCadeaux) => { db.query('SELECT c.id as "id", c.libelle as "libelle", c.prix, c.photo as "photo", c.lien, p.prenom as "acheteur", c.achete as "achete", c.paye as "paye", p2.prenom as "responsableAchat", c.pour_noel as "pourNoel", c.emballe as "emballe" FROM cadeau c LEFT OUTER JOIN participations pc on pc.cadeau = c.id LEFT OUTER JOIN participant p on p.id = pc.offrant LEFT OUTER JOIN participant p2 on p2.id = pc.responsable_achat ORDER BY c.prix', async (error, resultCadeaux) => {
let message; let message;
if(error){ if(error){