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/app/models/Transaction.ts b/src/app/models/Transaction.ts new file mode 100644 index 0000000..a6009e8 --- /dev/null +++ b/src/app/models/Transaction.ts @@ -0,0 +1,7 @@ +export class Transaction { + from: string + to: string + amount: number + timestamp: number + date: string +} diff --git a/src/app/models/User.ts b/src/app/models/User.ts new file mode 100644 index 0000000..7dc78b5 --- /dev/null +++ b/src/app/models/User.ts @@ -0,0 +1,9 @@ +import { Transaction } from "./Transaction"; + +export class User { + name: string + firstName: string + email: string + balance: number + lastTransactions: Array +} 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..58b2b96 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 === 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/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.html b/src/pages/home/home.html index 3734968..977b105 100644 --- a/src/pages/home/home.html +++ b/src/pages/home/home.html @@ -7,19 +7,30 @@ - home + Mon compte - + +

Bonjour, François Pignon

+ + + Solde actuel + + +

567,38

+

Gonettes

+
+
+ - + 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 e0d7e8a..7f5f8c4 100644 --- a/src/pages/send/send.html +++ b/src/pages/send/send.html @@ -7,14 +7,28 @@ - send + Effectuer un virement - - - + + + + + + Recipient + + + + + Montant + + + + + + 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; + } } } diff --git a/src/pages/transactions/transactions.html b/src/pages/transactions/transactions.html index e41d248..fa2c467 100644 --- a/src/pages/transactions/transactions.html +++ b/src/pages/transactions/transactions.html @@ -14,5 +14,18 @@ + + + + + From : {{transactionTest.from}} +
+ Amount : {{transactionTest.amount}} +
+ Date : {{transactionTest.date}} +
+
+
+
diff --git a/src/pages/transactions/transactions.ts b/src/pages/transactions/transactions.ts index a15b2e2..f81b801 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,37 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular'; templateUrl: 'transactions.html', }) export class TransactionsPage { + listTransactions = []; + transactionTest = new Transaction(); + transactionTest2 = new 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.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); + } }