From 9868802a3c92776217d9eb3a82e54effba4c569e Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Wed, 4 May 2016 17:49:19 +0200 Subject: [PATCH] Liste des clients --- index.html | 40 ++++++++++++++++++++++++++++++++++++++-- js/init.js | 24 +++++++++++++++++++++--- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 13bb29e..340eabb 100644 --- a/index.html +++ b/index.html @@ -133,6 +133,17 @@ +
+ Découvert autorisé +
+ +
+
@@ -197,12 +208,37 @@

Liste des clients

+ +
    +
  • +
    + perm_identity {{ client.idCarte }} : {{ client.solde }} € +
    +
    +
      +
    • + Découvert autorisé +
      + +
      +
    • +
    +
    Transactions
    +

    TODO

    +
    +
  • +

Liste des transactions

    -
  • +
  • trending_flat {{ transaction.client }} : {{ transaction.montant }} € @@ -228,7 +264,7 @@ Vidange
  • - Date : {{ transaction.date }} + Date :
  • Utilisateur : {{ transaction.utilisateur }} diff --git a/js/init.js b/js/init.js index fccdb7a..8c73a3d 100644 --- a/js/init.js +++ b/js/init.js @@ -31,8 +31,13 @@ var app = new Vue({ erreurTitre: '', erreurMessage: '', // Session + login: '', + droit: '', + jeton: '', connecte: false, date: 1, + // Données + clients: [], transactions: [], }, methods: { @@ -46,12 +51,25 @@ var app = new Vue({ donnees['jeton'] = this.jeton this.apiBrute(chemin, donnees, cb) }, + actuClients: function() { + var that = this + this.api("client/liste", {}, function(retour, donnees) { + switch(retour) { + case "ok": + that.clients = donnees.clients + break; + + default: + that.erreur(retour, donnees); + break; + } + }) + }, actuTransactions: function() { var that = this this.api("transactions", {}, function(retour, donnees) { switch(retour) { case "ok": - console.log(donnees.transactions[0].type, TRANSACTION_CREATION) that.transactions = donnees.transactions break; @@ -60,8 +78,8 @@ var app = new Vue({ break; } }) - }, + // Affichage toast: function(texte) { Materialize.toast(texte, 4000); @@ -116,7 +134,7 @@ var app = new Vue({ }, creer: function() { var that = this - this.api("client/ajouter", {idCarte: this.idCarte, solde: this.solde}, function(retour, donnees) { + this.api("client/ajouter", {idCarte: this.idCarte, solde: this.solde, decouvert: this.decouvert}, function(retour, donnees) { switch(retour) { case "ok": that.transaction(donnees.idTransaction, "Client " + that.idCarte + " crée avec un solde de " + that.solde + " €") -- libgit2 0.21.2