Commit 33a27ead39cebe47bcd5619a47bde1391902c0c6
1 parent
03dafff9
Reset des champs après transaction
Showing
2 changed files
with
11 additions
and
4 deletions
Show diff stats
index.php
... | ... | @@ -253,7 +253,7 @@ |
253 | 253 | <h4>Liste des clients</h4> |
254 | 254 | <button @click="actuClients">Rafraîchir</button> |
255 | 255 | <ul class="collapsible popout" data-collapsible="accordion"> |
256 | - <li v-for="client in clients"> | |
256 | + <li v-for="client in clients" @click="idCarte = client.idCarte"> | |
257 | 257 | <div class="collapsible-header"> |
258 | 258 | <i class="material-icons">perm_identity</i> {{ client.idCarte }} : {{ client.solde }} € |
259 | 259 | </div> | ... | ... |
js/init.js
... | ... | @@ -42,9 +42,9 @@ var app = new Vue({ |
42 | 42 | // Champs (à remplacer par des objets) |
43 | 43 | mdp: '', |
44 | 44 | idCarte: '', |
45 | - solde: 0, | |
46 | - credit: 0, | |
47 | - prix: 0, | |
45 | + solde: '', | |
46 | + credit: '', | |
47 | + prix: '', | |
48 | 48 | moi: {}, |
49 | 49 | u_nouveau: {}, |
50 | 50 | // Données |
... | ... | @@ -301,6 +301,8 @@ var app = new Vue({ |
301 | 301 | this.api("client/ajouter", {idCarte: this.idCarte, solde: this.solde, decouvert: this.decouvert}, function(retour, donnees) { |
302 | 302 | switch(retour) { |
303 | 303 | case "ok": |
304 | + that.idCarte = '' | |
305 | + that.solde = '' | |
304 | 306 | that.transaction(donnees.idTransaction, "Client " + that.idCarte + " crée avec un solde de " + that.solde + " €") |
305 | 307 | break; |
306 | 308 | |
... | ... | @@ -315,6 +317,8 @@ var app = new Vue({ |
315 | 317 | this.api("client/recharger", {idCarte: this.idCarte, montant: this.credit}, function(retour, donnees) { |
316 | 318 | switch(retour) { |
317 | 319 | case "ok": |
320 | + that.idCarte = '' | |
321 | + that.credit = '' | |
318 | 322 | that.transaction(donnees.idTransaction, "Client " + that.idCarte + " rechargé : " + donnees.soldeAncien + " + " + that.credit + " → " + donnees.soldeNouveau + " €") |
319 | 323 | break; |
320 | 324 | |
... | ... | @@ -335,6 +339,8 @@ var app = new Vue({ |
335 | 339 | this.api("client/payer", options, function(retour, donnees) { |
336 | 340 | switch(retour) { |
337 | 341 | case "ok": |
342 | + that.idCarte = '' | |
343 | + that.prix = '' | |
338 | 344 | that.transaction(donnees.idTransaction, "Client " + that.idCarte + " débité : " + donnees.soldeAncien + " - " + donnees.montant + " → " + donnees.soldeNouveau + " €") |
339 | 345 | break; |
340 | 346 | |
... | ... | @@ -349,6 +355,7 @@ var app = new Vue({ |
349 | 355 | this.api("client/vidange", {idCarte: this.idCarte}, function(retour, donnees) { |
350 | 356 | switch(retour) { |
351 | 357 | case "ok": |
358 | + that.idCarte = '' | |
352 | 359 | that.transaction(donnees.idTransaction, "Client " + that.idCarte + " vidé : " + donnees.soldeAncien + " → 0 €") |
353 | 360 | break; |
354 | 361 | ... | ... |