From 10cae386cf5846c5c2da5ef7988f16276e4ac944 Mon Sep 17 00:00:00 2001 From: Matt Marcha Date: Fri, 19 Oct 2018 16:21:52 +0200 Subject: [PATCH 1/7] =?UTF-8?q?=C3=89bauche=20des=20mod=C3=A8les=20user=20?= =?UTF-8?q?et=20transaction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/models/Transaction.ts | 5 +++++ src/app/models/user.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/app/models/Transaction.ts create mode 100644 src/app/models/user.ts diff --git a/src/app/models/Transaction.ts b/src/app/models/Transaction.ts new file mode 100644 index 0000000..0d61b00 --- /dev/null +++ b/src/app/models/Transaction.ts @@ -0,0 +1,5 @@ +export class Transaction { + from: string + to: string + amount: number +} diff --git a/src/app/models/user.ts b/src/app/models/user.ts new file mode 100644 index 0000000..0f849b7 --- /dev/null +++ b/src/app/models/user.ts @@ -0,0 +1,10 @@ +import { Transaction } from "./Transaction"; + +export class User { + name: string + firstName: string + email: string + balance: number + lastTransactions: Array + +} From a0ce13e23fddd8ad1432c1fdc65d2ec8f5e1da85 Mon Sep 17 00:00:00 2001 From: GME Date: Fri, 19 Oct 2018 16:33:38 +0200 Subject: [PATCH 2/7] json test and modification to disconnect button --- resources/raw/config.json | 55 +++++++++++++++++++++++++++++++++++++++ src/pages/home/home.html | 11 +++----- src/pages/home/home.ts | 4 --- src/pages/send/send.html | 3 ++- src/pages/send/send.ts | 5 ++++ 5 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 resources/raw/config.json diff --git a/resources/raw/config.json b/resources/raw/config.json new file mode 100644 index 0000000..076189b --- /dev/null +++ b/resources/raw/config.json @@ -0,0 +1,55 @@ +{ + "users":[ + { + "name": "Test", + "firstName":"Toto", + "email": "toto@mail.com", + "password": "totopwd", + "balance": 500.0, + "lastTransactions": [ + { + "from":"toto@mail.com", + "to": "bic@mail.com", + "amount": 10.0, + "timestamp": 1539861600 + } + ] + }, + { + "name": "lePen", + "firstName":"Bic", + "email": "bic@mail.com", + "password": "bicpwd", + "balance": 10.0, + "lastTransactions": [ + { + "from": "toto@mail.com", + "to": "bic@mail.com", + "amount": 10.0, + "timestamp": 1539861900 + }, + { + "from":"bic@mail.com", + "to":"tata@mail.com", + "amount": 200.0, + "timestamp": 1539600000 + } + ] + }, + { + "name": "tata", + "firstName":"", + "email": "tata@mail.com", + "password": "tataPwd", + "balance": 235.0, + "lastTransactions": [ + { + "from":"bic@mail.com", + "to": "tata@mail.com", + "amount": 200, + "timestamp": 1539601200 + } + ] + } + ] +} diff --git a/src/pages/home/home.html b/src/pages/home/home.html index 3734968..9f9f2a8 100644 --- a/src/pages/home/home.html +++ b/src/pages/home/home.html @@ -8,19 +8,16 @@ home - - - - - - - + + + + diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index 4ed1d2d..31fd644 100644 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -33,10 +33,6 @@ export class HomePage { this.navCtrl.push(BuyPage); break; } - case 'contact':{ - this.navCtrl.push(ContactsPage); - break; - } case 'send':{ this.navCtrl.push(SendPage); break; diff --git a/src/pages/send/send.html b/src/pages/send/send.html index e0d7e8a..ab51b22 100644 --- a/src/pages/send/send.html +++ b/src/pages/send/send.html @@ -15,6 +15,7 @@ - + + diff --git a/src/pages/send/send.ts b/src/pages/send/send.ts index ecb2924..9da3329 100644 --- a/src/pages/send/send.ts +++ b/src/pages/send/send.ts @@ -1,6 +1,7 @@ import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import {SearchPage} from "../search/search"; +import {ContactsPage} from "../contacts/contacts"; /** * Generated class for the SendPage page. @@ -29,6 +30,10 @@ export class SendPage { this.navCtrl.push(SearchPage); break; } + case 'contact':{ + this.navCtrl.push(ContactsPage); + break; + } } } From 5a4237ec81f3f92f4115ea6ee36120e540127f46 Mon Sep 17 00:00:00 2001 From: Matt Marcha Date: Fri, 19 Oct 2018 17:00:53 +0200 Subject: [PATCH 3/7] Remplissage des pages --- src/pages/buy/buy.html | 33 ++++++++++++++++++++++++++++++++- src/pages/buy/buy.ts | 18 +++++++++++++++++- src/pages/home/home.html | 15 +++++++++++++-- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/pages/buy/buy.html b/src/pages/buy/buy.html index 5cd9a3e..ab46543 100644 --- a/src/pages/buy/buy.html +++ b/src/pages/buy/buy.html @@ -7,12 +7,43 @@ - buy + Échange de monnaie + + + + Montant + + + + + N° de carte + + + + + Titulaire de la carte + + + + + Date d'expiration + + + + + Cryptogramme + + + + + + + diff --git a/src/pages/buy/buy.ts b/src/pages/buy/buy.ts index aa84818..fe6213d 100644 --- a/src/pages/buy/buy.ts +++ b/src/pages/buy/buy.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; +import { AlertController } from 'ionic-angular'; /** * Generated class for the BuyPage page. @@ -15,11 +16,26 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular'; }) export class BuyPage { - constructor(public navCtrl: NavController, public navParams: NavParams) { + constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController) { } ionViewDidLoad() { console.log('ionViewDidLoad BuyPage'); } + sendTransaction($amount) { + //TODO : Contacter l'API et proposer la transaction. L'API répondra true ou False + if (true) { + this.navCtrl.popToRoot(); + } + else { + const alert = this.alertCtrl.create({ + title: 'Erreur', + subTitle: 'La transaction a échoué. Vérifiez les données saisies et réessayez.', + buttons: ['OK'] + }); + alert.present(); + } + } + } diff --git a/src/pages/home/home.html b/src/pages/home/home.html index 3734968..866c668 100644 --- a/src/pages/home/home.html +++ b/src/pages/home/home.html @@ -7,15 +7,26 @@ - home + Mon compte - + +

Bonjour, François Pignon

+ + + Solde actuel + + +

567,38

+

Gonettes

+
+
+ From 96cf776642a4807359a724690c38050c93f20614 Mon Sep 17 00:00:00 2001 From: Matt Marcha Date: Thu, 8 Nov 2018 09:16:45 +0100 Subject: [PATCH 4/7] corrections mineures --- src/pages/buy/buy.ts | 2 +- src/pages/home/home.html | 2 +- src/pages/send/send.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/buy/buy.ts b/src/pages/buy/buy.ts index fe6213d..58b2b96 100644 --- a/src/pages/buy/buy.ts +++ b/src/pages/buy/buy.ts @@ -25,7 +25,7 @@ export class BuyPage { sendTransaction($amount) { //TODO : Contacter l'API et proposer la transaction. L'API répondra true ou False - if (true) { + if (true === true) { this.navCtrl.popToRoot(); } else { diff --git a/src/pages/home/home.html b/src/pages/home/home.html index 866c668..977b105 100644 --- a/src/pages/home/home.html +++ b/src/pages/home/home.html @@ -30,7 +30,7 @@ - + diff --git a/src/pages/send/send.html b/src/pages/send/send.html index e0d7e8a..7267531 100644 --- a/src/pages/send/send.html +++ b/src/pages/send/send.html @@ -7,7 +7,7 @@ - send + Effectuer un virement From ed777afc54e16e6c2a72d3222384a475a2e0a856 Mon Sep 17 00:00:00 2001 From: GME Date: Thu, 8 Nov 2018 09:17:52 +0100 Subject: [PATCH 5/7] Prout --- src/app/models/Transaction.ts | 1 + src/app/models/{user.ts => User.ts} | 1 - src/pages/transactions/transactions.html | 9 +++++++++ src/pages/transactions/transactions.ts | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) rename src/app/models/{user.ts => User.ts} (99%) diff --git a/src/app/models/Transaction.ts b/src/app/models/Transaction.ts index 0d61b00..291f273 100644 --- a/src/app/models/Transaction.ts +++ b/src/app/models/Transaction.ts @@ -2,4 +2,5 @@ export class Transaction { from: string to: string amount: number + timestamp: number } diff --git a/src/app/models/user.ts b/src/app/models/User.ts similarity index 99% rename from src/app/models/user.ts rename to src/app/models/User.ts index 0f849b7..7dc78b5 100644 --- a/src/app/models/user.ts +++ b/src/app/models/User.ts @@ -6,5 +6,4 @@ export class User { email: string balance: number lastTransactions: Array - } diff --git a/src/pages/transactions/transactions.html b/src/pages/transactions/transactions.html index e41d248..84f972c 100644 --- a/src/pages/transactions/transactions.html +++ b/src/pages/transactions/transactions.html @@ -14,5 +14,14 @@ + + + + + {{transactionTest}} + + + + diff --git a/src/pages/transactions/transactions.ts b/src/pages/transactions/transactions.ts index a15b2e2..284b37f 100644 --- a/src/pages/transactions/transactions.ts +++ b/src/pages/transactions/transactions.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; +import {Transaction} from "../../app/models/Transaction"; /** * Generated class for the TransactionsPage page. @@ -14,12 +15,26 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular'; templateUrl: 'transactions.html', }) export class TransactionsPage { + listTransactions:Array; + transactionTest:Transaction; constructor(public navCtrl: NavController, public navParams: NavParams) { + } ionViewDidLoad() { console.log('ionViewDidLoad TransactionsPage'); + this.init(); + } + + init(){ + this.transactionTest.from="toto"; + this.transactionTest.to="tata"; + this.transactionTest.amount=200; + this.transactionTest.timestamp=1539600000; + + this.listTransactions.push(this.transactionTest); + } } From bcd5d2330ac361011273dbbff11827322781843c Mon Sep 17 00:00:00 2001 From: GME Date: Thu, 8 Nov 2018 09:58:09 +0100 Subject: [PATCH 6/7] Correction Transaction test Affichage de l'historique de transaction avec quelques variables de test --- src/app/models/Transaction.ts | 1 + src/pages/transactions/transactions.html | 8 +++++++- src/pages/transactions/transactions.ts | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/app/models/Transaction.ts b/src/app/models/Transaction.ts index 291f273..a6009e8 100644 --- a/src/app/models/Transaction.ts +++ b/src/app/models/Transaction.ts @@ -3,4 +3,5 @@ export class Transaction { to: string amount: number timestamp: number + date: string } diff --git a/src/pages/transactions/transactions.html b/src/pages/transactions/transactions.html index 84f972c..24118e1 100644 --- a/src/pages/transactions/transactions.html +++ b/src/pages/transactions/transactions.html @@ -18,7 +18,13 @@ - {{transactionTest}} + From : {{transactionTest.from}} +
+ To : {{transactionTest.to}} +
+ Amount : {{transactionTest.amount}} +
+ Date : {{transactionTest.date}}
diff --git a/src/pages/transactions/transactions.ts b/src/pages/transactions/transactions.ts index 284b37f..43f1645 100644 --- a/src/pages/transactions/transactions.ts +++ b/src/pages/transactions/transactions.ts @@ -15,8 +15,9 @@ import {Transaction} from "../../app/models/Transaction"; templateUrl: 'transactions.html', }) export class TransactionsPage { - listTransactions:Array; - transactionTest:Transaction; + listTransactions = []; + transactionTest = new Transaction(); + transactionTest2 = new Transaction(); constructor(public navCtrl: NavController, public navParams: NavParams) { @@ -32,9 +33,18 @@ export class TransactionsPage { this.transactionTest.to="tata"; this.transactionTest.amount=200; this.transactionTest.timestamp=1539600000; + this.transactionTest.date= new Date(this.transactionTest.timestamp*1000).toDateString() this.listTransactions.push(this.transactionTest); + this.transactionTest2.from="tata"; + this.transactionTest2.to="toto"; + this.transactionTest2.amount=40; + this.transactionTest2.timestamp=1539900000; + this.transactionTest2.date= new Date(this.transactionTest2.timestamp*1000).toDateString() + + this.listTransactions.push(this.transactionTest2); + } } From d03fcc8dd136d300339d78854e048976a358f4e0 Mon Sep 17 00:00:00 2001 From: GME Date: Thu, 8 Nov 2018 11:40:53 +0100 Subject: [PATCH 7/7] Update - Transactions, Contact, Search, Home --- src/pages/contacts/contacts.html | 21 +++++++++++++++++++++ src/pages/contacts/contacts.ts | 4 ++++ src/pages/home/home.ts | 4 ++++ src/pages/search/search.html | 8 ++++++++ src/pages/search/search.ts | 4 ++++ src/pages/send/send.html | 19 ++++++++++++++++--- src/pages/transactions/transactions.html | 2 -- src/pages/transactions/transactions.ts | 1 + 8 files changed, 58 insertions(+), 5 deletions(-) diff --git a/src/pages/contacts/contacts.html b/src/pages/contacts/contacts.html index d370b04..b71bb12 100644 --- a/src/pages/contacts/contacts.html +++ b/src/pages/contacts/contacts.html @@ -14,5 +14,26 @@ + + + Name : tata +
+ Address : 75438973HJFBSDFZ989024 +
+
+ + + Name : test +
+ Address : 754389IHGOERG989324JIJ +
+
+ + + Name : toaster +
+ Address : 780U8GEOKNOKSQDU974328 +
+
diff --git a/src/pages/contacts/contacts.ts b/src/pages/contacts/contacts.ts index c48b919..7da9d05 100644 --- a/src/pages/contacts/contacts.ts +++ b/src/pages/contacts/contacts.ts @@ -22,4 +22,8 @@ export class ContactsPage { console.log('ionViewDidLoad ContactsPage'); } + selectContact(contact) { + console.log('toto - '+contact) + } + } diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index 31fd644..4ed1d2d 100644 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -33,6 +33,10 @@ export class HomePage { this.navCtrl.push(BuyPage); break; } + case 'contact':{ + this.navCtrl.push(ContactsPage); + break; + } case 'send':{ this.navCtrl.push(SendPage); break; diff --git a/src/pages/search/search.html b/src/pages/search/search.html index b19dd37..e7afd22 100644 --- a/src/pages/search/search.html +++ b/src/pages/search/search.html @@ -14,5 +14,13 @@ + + + Recipient + + +
+ +
diff --git a/src/pages/search/search.ts b/src/pages/search/search.ts index 3b707d4..63b9828 100644 --- a/src/pages/search/search.ts +++ b/src/pages/search/search.ts @@ -22,4 +22,8 @@ export class SearchPage { console.log('ionViewDidLoad SearchPage'); } + searchUser($user){ + console.log('prout') + } + } diff --git a/src/pages/send/send.html b/src/pages/send/send.html index fbf9023..7f5f8c4 100644 --- a/src/pages/send/send.html +++ b/src/pages/send/send.html @@ -14,8 +14,21 @@ - - + - + + + + Recipient + + + + + Montant + + + + + + diff --git a/src/pages/transactions/transactions.html b/src/pages/transactions/transactions.html index 24118e1..fa2c467 100644 --- a/src/pages/transactions/transactions.html +++ b/src/pages/transactions/transactions.html @@ -20,8 +20,6 @@ From : {{transactionTest.from}}
- To : {{transactionTest.to}} -
Amount : {{transactionTest.amount}}
Date : {{transactionTest.date}} diff --git a/src/pages/transactions/transactions.ts b/src/pages/transactions/transactions.ts index 43f1645..f81b801 100644 --- a/src/pages/transactions/transactions.ts +++ b/src/pages/transactions/transactions.ts @@ -29,6 +29,7 @@ export class TransactionsPage { } init(){ + this.transactionTest.from="toto"; this.transactionTest.to="tata"; this.transactionTest.amount=200;