Commit c450b12e7e49d95ac1446eadc8cc62ecf0167d9f
1 parent
1dc9797d
Annulation + ombres
Showing
5 changed files
with
36 additions
and
15 deletions
Show diff stats
api/annuler.php
... | ... | @@ -83,6 +83,6 @@ if (!$requete->execute()) { |
83 | 83 | } |
84 | 84 | $requete->close(); |
85 | 85 | |
86 | -retour("ok", ["soldeAncien" => $soldeAncien, "soldeNouveau" => $soldeNouveau]); | |
86 | +retour("ok", ["client" => $client, "soldeAncien" => $soldeAncien, "soldeNouveau" => $soldeNouveau]); | |
87 | 87 | |
88 | 88 | ?> | ... | ... |
api/refaire.php
... | ... | @@ -83,6 +83,6 @@ if (!$requete->execute()) { |
83 | 83 | } |
84 | 84 | $requete->close(); |
85 | 85 | |
86 | -retour("ok", ["soldeAncien" => $soldeAncien, "soldeNouveau" => $soldeNouveau]); | |
86 | +retour("ok", ["client" => $client, "soldeAncien" => $soldeAncien, "soldeNouveau" => $soldeNouveau]); | |
87 | 87 | |
88 | 88 | ?> | ... | ... |
index.html
... | ... | @@ -64,17 +64,15 @@ |
64 | 64 | </a> |
65 | 65 | </li> |
66 | 66 | </ul> |
67 | - <ul class="side-nav"> | |
68 | - <li><a>TODO</a></li> | |
69 | - </ul> | |
70 | - </div> | |
71 | - <div class="col s12" v-show="page == 'operations'"> | |
72 | - <ul class="tabs"> | |
67 | + <ul class="tabs" v-show="page == 'operations'"> | |
73 | 68 | <li class="tab col s3"><a href="#creation">Création</a></li> |
74 | 69 | <li class="tab col s3"><a href="#rechargement">Rechargement</a></li> |
75 | 70 | <li class="tab col s3"><a class="active" href="#paiement">Paiement</a></li> |
76 | 71 | <li class="tab col s3"><a href="#vidange">Vidange</a></li> |
77 | 72 | </ul> |
73 | + <ul class="side-nav"> | |
74 | + <li><a>TODO</a></li> | |
75 | + </ul> | |
78 | 76 | </div> |
79 | 77 | </nav> |
80 | 78 | ... | ... |
js/init.js
... | ... | @@ -54,6 +54,27 @@ var app = new Vue({ |
54 | 54 | this.erreurMessage = donnees['message'] |
55 | 55 | $("#modalErreur").openModal(); |
56 | 56 | }, |
57 | + annuler(id) { | |
58 | + var that = this | |
59 | + this.api("annuler", {idTransaction: id}, function(retour, donnees) { | |
60 | + switch(retour) { | |
61 | + case "ok": | |
62 | + that.toast("Client " + donnees.client + " : " + donnees.soldeAncien + " → " + donnees.soldeNouveau) | |
63 | + break; | |
64 | + | |
65 | + default: | |
66 | + that.erreur(retour, donnees); | |
67 | + break; | |
68 | + } | |
69 | + }); | |
70 | + }, | |
71 | + transaction(id, texte) { | |
72 | + var that = this | |
73 | + var interieur = $('<span>').text(texte + ' ').append($('<a>').text('Annuler').one('click', function() { | |
74 | + that.annuler(id) | |
75 | + })) | |
76 | + that.toast(interieur); | |
77 | + }, | |
57 | 78 | // Fonctionnement |
58 | 79 | connecter: function() { |
59 | 80 | var that = this; |
... | ... | @@ -67,7 +88,7 @@ var app = new Vue({ |
67 | 88 | that.connecte = that.date |
68 | 89 | that.toast("Correctement identifié en tant que " + that.login + " pour " + JETON_DUREE/60+ " minutes") |
69 | 90 | that.page = 'operations' |
70 | - break; | |
91 | + break; | |
71 | 92 | |
72 | 93 | default: |
73 | 94 | that.erreur(retour, donnees); |
... | ... | @@ -81,7 +102,7 @@ var app = new Vue({ |
81 | 102 | this.api("client/ajouter", {idCarte: this.idCarte, solde: this.solde}, function(retour, donnees) { |
82 | 103 | switch(retour) { |
83 | 104 | case "ok": |
84 | - that.toast("Client " + that.idCarte + " crée avec un solde de " + that.solde + " €") | |
105 | + that.transaction(donnees.idTransaction, "Client " + that.idCarte + " crée avec un solde de " + that.solde + " €") | |
85 | 106 | break; |
86 | 107 | |
87 | 108 | default: |
... | ... | @@ -95,7 +116,7 @@ var app = new Vue({ |
95 | 116 | this.api("client/recharger", {idCarte: this.idCarte, montant: this.credit}, function(retour, donnees) { |
96 | 117 | switch(retour) { |
97 | 118 | case "ok": |
98 | - that.toast("Client " + that.idCarte + " rechargé : " + donnees.soldeAncien + " + " + that.credit + " → " + donnees.soldeNouveau + " €") | |
119 | + that.transaction(donnees.idTransaction, "Client " + that.idCarte + " rechargé : " + donnees.soldeAncien + " + " + that.credit + " → " + donnees.soldeNouveau + " €") | |
99 | 120 | break; |
100 | 121 | |
101 | 122 | default: |
... | ... | @@ -115,7 +136,7 @@ var app = new Vue({ |
115 | 136 | this.api("client/payer", options, function(retour, donnees) { |
116 | 137 | switch(retour) { |
117 | 138 | case "ok": |
118 | - that.toast("Client " + that.idCarte + " débité : " + donnees.soldeAncien + " - " + donnees.montant + " → " + donnees.soldeNouveau + " €") | |
139 | + that.transaction(donnees.idTransaction, "Client " + that.idCarte + " débité : " + donnees.soldeAncien + " - " + donnees.montant + " → " + donnees.soldeNouveau + " €") | |
119 | 140 | break; |
120 | 141 | |
121 | 142 | default: |
... | ... | @@ -129,7 +150,7 @@ var app = new Vue({ |
129 | 150 | this.api("client/vidange", {idCarte: this.idCarte}, function(retour, donnees) { |
130 | 151 | switch(retour) { |
131 | 152 | case "ok": |
132 | - that.toast("Client " + that.idCarte + " vidé : " + donnees.soldeAncien + " → 0 €") | |
153 | + that.transaction(donnees.idTransaction, "Client " + that.idCarte + " vidé : " + donnees.soldeAncien + " → 0 €") | |
133 | 154 | break; |
134 | 155 | |
135 | 156 | default: | ... | ... |
scss/style.scss
... | ... | @@ -42,11 +42,13 @@ footer.page-footer { |
42 | 42 | padding-top: 0; |
43 | 43 | } |
44 | 44 | |
45 | -// Suppression de l'espace entre les onglets | |
45 | +// Adaptation de la nav aux onglets | |
46 | 46 | nav { |
47 | - line-height: $navbar-height-mobile; | |
47 | + height: initial; | |
48 | + min-height: $navbar-height; | |
48 | 49 | } |
49 | 50 | |
51 | + | |
50 | 52 | // Affichage correct des icônes dans le header |
51 | 53 | nav i.material-icons { |
52 | 54 | display: inline; | ... | ... |