Merge branch 'guillaume' into dev
This commit is contained in:
commit
57bd7d141a
55
resources/raw/config.json
Normal file
55
resources/raw/config.json
Normal file
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
7
src/app/models/Transaction.ts
Normal file
7
src/app/models/Transaction.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export class Transaction {
|
||||
from: string
|
||||
to: string
|
||||
amount: number
|
||||
timestamp: number
|
||||
date: string
|
||||
}
|
9
src/app/models/User.ts
Normal file
9
src/app/models/User.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { Transaction } from "./Transaction";
|
||||
|
||||
export class User {
|
||||
name: string
|
||||
firstName: string
|
||||
email: string
|
||||
balance: number
|
||||
lastTransactions: Array<Transaction>
|
||||
}
|
|
@ -7,12 +7,43 @@
|
|||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>buy</ion-title>
|
||||
<ion-title>Échange de monnaie</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
<ion-list>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Montant</ion-label>
|
||||
<ion-input [(ngModel)]="amount" name="amount" type="number" value="10"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>N° de carte</ion-label>
|
||||
<ion-input type="number"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Titulaire de la carte</ion-label>
|
||||
<ion-input type="text"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Date d'expiration</ion-label>
|
||||
<ion-input type="number"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Cryptogramme</ion-label>
|
||||
<ion-input type="number"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<button ion-button (click)="sendTransaction(amount)">Payer {{amount}} €</button>
|
||||
|
||||
|
||||
</ion-list>
|
||||
|
||||
</ion-content>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,5 +14,26 @@
|
|||
|
||||
|
||||
<ion-content padding>
|
||||
<ion-card (click)="selectContact('tata')">
|
||||
<ion-card-content>
|
||||
Name : tata
|
||||
<br>
|
||||
Address : 75438973HJFBSDFZ989024
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
<ion-card (click)="selectContact('test')">
|
||||
<ion-card-content>
|
||||
Name : test
|
||||
<br>
|
||||
Address : 754389IHGOERG989324JIJ
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
<ion-card (click)="selectContact('toaster')">
|
||||
<ion-card-content>
|
||||
Name : toaster
|
||||
<br>
|
||||
Address : 780U8GEOKNOKSQDU974328
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
</ion-content>
|
||||
|
|
|
@ -22,4 +22,8 @@ export class ContactsPage {
|
|||
console.log('ionViewDidLoad ContactsPage');
|
||||
}
|
||||
|
||||
selectContact(contact) {
|
||||
console.log('toto - '+contact)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,19 +7,30 @@
|
|||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>home</ion-title>
|
||||
<ion-title>Mon compte</ion-title>
|
||||
<ion-buttons>
|
||||
<button ion-item (click)="closeConnexion()">Disconnect</button>
|
||||
<button ion-item (click)="closeConnexion()">Se déconnecter</button>
|
||||
</ion-buttons>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
<ion-content padding>
|
||||
<p class="welcome-text">Bonjour, François Pignon</p>
|
||||
<ion-card>
|
||||
<ion-card-header>
|
||||
Solde actuel
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<p class="balance">567,38</p>
|
||||
<p>Gonettes</p>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
<ion-buttons>
|
||||
<button ion-item (click)="changePage('contact')">Contacts</button>
|
||||
<button ion-item (click)="changePage('buy')">Acheter de la monnaie locale</button>
|
||||
<button ion-item (click)="changePage('send')">Payer</button>
|
||||
<button ion-item (click)="changePage('send')">Faire un virement</button>
|
||||
<button ion-item (click)="changePage('history')">Historique des transactions</button>
|
||||
</ion-buttons>
|
||||
|
||||
|
|
|
@ -14,5 +14,13 @@
|
|||
|
||||
|
||||
<ion-content padding>
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-label stacked>Recipient</ion-label>
|
||||
<ion-input [(ngModel)]="user" name="recipient" type="text"></ion-input>
|
||||
</ion-item>
|
||||
<br>
|
||||
<button ion-button (click)="searchUser(user)">Rechercher</button>
|
||||
</ion-list>
|
||||
|
||||
</ion-content>
|
||||
|
|
|
@ -22,4 +22,8 @@ export class SearchPage {
|
|||
console.log('ionViewDidLoad SearchPage');
|
||||
}
|
||||
|
||||
searchUser($user){
|
||||
console.log('prout')
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,14 +7,28 @@
|
|||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>send</ion-title>
|
||||
<ion-title>Effectuer un virement</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
<ion-buttons>
|
||||
<button ion-item (click)="changePage('search')">Chercher un contact</button>
|
||||
</ion-buttons>
|
||||
<ion-list>
|
||||
<button ion-button (click)="changePage('contact')">Contacts</button>
|
||||
<button ion-button (click)="changePage('search')">Chercher un contact</button>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Recipient</ion-label>
|
||||
<ion-input [(ngModel)]="recipient" name="recipient" type="text"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label stacked>Montant</ion-label>
|
||||
<ion-input [(ngModel)]="amount" name="amount" type="number" value="10"></ion-input>
|
||||
</ion-item>
|
||||
|
||||
<button ion-button (click)="t">Envoyer</button>
|
||||
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,5 +14,18 @@
|
|||
|
||||
|
||||
<ion-content padding>
|
||||
<ion-list>
|
||||
<ion-item *ngFor="let transactionTest of listTransactions">
|
||||
<ion-card>
|
||||
<ion-card-content>
|
||||
From : {{transactionTest.from}}
|
||||
<br>
|
||||
Amount : {{transactionTest.amount}}
|
||||
<br>
|
||||
Date : {{transactionTest.date}}
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
</ion-content>
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue