Commit 5841ece4 authored by Cédric Moreau's avatar Cédric Moreau

[enh] Ajout du logo de vendeur

parent 4c042246
......@@ -44,7 +44,7 @@ const appRoutes: Routes = [
data: { creation: true }
},
{
path: 'mon_compte/edit/:pub',
path: 'account/edit/:pub',
component: AccountEditPage
},
{
......
......@@ -2,6 +2,7 @@
<ion-row>
<ion-col col-12 col-sm-12 col-lg-6>
<img src="{{ accountService.acc.logo }}">
<h2>{{ accountService.acc.title }}</h2>
<pre>{{ accountService.acc.desc }}</pre>
<h3>Annonces</h3>
......@@ -18,6 +19,10 @@
<h3 clear item-right>{{ a.price }} Ğ1</h3>
</button>
</ion-list>
<p *ngIf="accountService.acc.pub == loginService.pub">
<button ion-button [routerLink]="['/account/edit', accountService.acc.pub]">Modifier votre fiche</button>
</p>
</ion-col>
</ion-row>
......
announce {
account {
img {
padding-right: 30px;
float: left;
max-width: 100px;
margin-top: 1.8rem;
padding-right: 15px;
}
}
......@@ -5,7 +5,7 @@ import {ActivatedRoute} from "@angular/router";
import {AnnounceService} from "../../services/announce-service";
@Component({
selector: 'announce',
selector: 'account',
template: require('../../app/topbar.html') + require('./account.html')
})
export class AccountPage implements OnInit {
......
......@@ -90,6 +90,13 @@
<span [hidden]="!link.errors || !link.errors.maxlength">Au plus 100 caractères.</span>
</ion-label>
<ion-item class="item-input">
<ion-label>Logo :</ion-label>
<button ion-button item-right (click)="accountService.setLogo()">Changer de logo</button>
</ion-item>
<img src="{{ accountService.acc.logo }}">
<ion-item *ngFor="let lien of accountService.acc.links">
<ion-label>{{ lien }}</ion-label>
<button ion-button item-right color="danger" (click)="accountService.retirerLien(lien)">Retirer</button>
......
......@@ -9,18 +9,21 @@
<!-- Compte inexistant -->
<ng-container *ngIf="!accountService.acc">
<p>
<ion-badge item-left class="warn">Inexistant</ion-badge>
<ion-badge item-left class="warn">Compte inexistant</ion-badge>
</p>
<p>
Ce compte n'existe pas encore, car il n'a pas été créé.
Ce porte-monnaie n'a pas encore de compte de vendeur. Si vous possédez ce porte-monnaie, alors vous pouvez l'utiliser pour lui associer un compte de vendeur sur ğchange.
</p>
<p *ngIf="loginService.enoughMoney">
<button ion-button color="primary" routerLink="/mon_compte/creer">Créer le compte maintenant</button>
<p>
Si vous n'êtes pas le possesseur de ce porte-monnaie, vous ne pourrez pas créer le compte.
</p>
<p *ngIf="enoughMoney">
<button ion-button color="primary" routerLink="/mon_compte/creer">Créer le compte de vendeur maintenant</button>
</p>
<p *ngIf="!loginService.enoughMoney">
<p *ngIf="!enoughMoney">
<ion-badge class="warn">Solde insuffisant</ion-badge>
</p>
<p *ngIf="!loginService.enoughMoney">
<p *ngIf="!enoughMoney">
Ce compte ne peut pas être créé pour le moment, car le porte-monnaie associé doit posséder au moins 1,00 Ğ1 pour réaliser cette opération.
</p>
</ng-container>
......@@ -34,7 +37,7 @@
Ce compte est actif.
</p>
<p>
<button ion-button color="primary" [routerLink]="['/mon_compte/edit', loginService.pub]">Modifier le compte</button>
<button ion-button color="primary" [routerLink]="['/account/edit', loginService.pub]">Modifier le compte de vendeur</button>
</p>
</ng-container>
<h2>Porte-monnaie associé</h2>
......@@ -42,9 +45,7 @@
<ion-badge item-left color="secondary">{{ loginService.pub }}</ion-badge>
</p>
<p>
Il s'agit d'une clé publique valide.
Il s'agit d'une clé publique valide, l'adresse d'un portefeuille Ğ1.
</p>
<h2>Activité</h2>
<p>Ce compte n'a aucune activité pour le moment.</p>
</ng-container>
</ion-content>
import {Component} from "@angular/core";
import {LoginService} from "../../services/login-service";
import {AccountService} from "../../services/account-service";
import {co} from "co";
@Component({
selector: 'profil',
......@@ -9,11 +10,25 @@ import {AccountService} from "../../services/account-service";
export class ProfilPage {
title:string = "Mon profil"
enoughMoney:Boolean
constructor(
public accountService: AccountService,
public loginService:LoginService) {
loginService.reload()
// let loader = this.loadingCtrl.create({
// content: "Chargement du compte...",
// duration: 3000
// });
const that = this
// loader.present();
co(function*() {
const body = yield that.accountService.getAccountInfos(that.loginService.pub)
that.accountService.acc = body.acc
that.enoughMoney = body.enoughMoney
console.log(that.enoughMoney)
// loader.dismissAll();
})
}
}
......@@ -4,6 +4,8 @@ import {AlertController} from "ionic-angular";
import {Router} from "@angular/router";
import {NgForm} from "@angular/forms";
import {AuthService} from "./auth-service";
import {ImageService} from "./image-service";
import {LoginService} from "./login-service";
const co = require('co')
const uuid = require('uuid')
const tweetnacl = require('tweetnacl')
......@@ -22,6 +24,8 @@ export class AccountService {
private http: Http,
private router: Router,
private alertCtrl: AlertController,
private imageService: ImageService,
public loginService: LoginService,
public authService: AuthService,
) {
this.acc = {}
......@@ -34,6 +38,15 @@ export class AccountService {
this.link = ''
}
setLogo() {
this.imageService.getNew()
.then(img => {
if (img) {
this.acc.logo = img
}
})
}
retirerLien(lien:string) {
const index = this.acc.links.indexOf(lien)
if (index !== -1) {
......@@ -110,7 +123,7 @@ export class AccountService {
accountForm.reset()
that.router.navigate([`/mon_compte`])
that.router.navigate([`/account`, that.acc.pub])
}
} catch (e) {
......
import { co } from 'co';
import {Injectable} from '@angular/core';
import {AlertController, LoadingController, ToastController} from "ionic-angular";
import {AccountService} from "./account-service";
import {Injectable} from "@angular/core";
import {AlertController, ToastController} from "ionic-angular";
@Injectable()
export class LoginService {
pub:string
estIdentifie:Boolean
enoughMoney:Boolean
constructor(
public accountService: AccountService,
public alertCtrl: AlertController,
public toastCtrl: ToastController,
public loadingCtrl: LoadingController) {
public toastCtrl: ToastController) {
this.pub = localStorage.getItem('pub')
this.estIdentifie = !!this.pub
......@@ -91,21 +86,4 @@ export class LoginService {
});
confirm.present();
}
reload() {
// let loader = this.loadingCtrl.create({
// content: "Chargement du compte...",
// duration: 3000
// });
const that = this
// loader.present();
co(function*() {
const body = yield that.accountService.getAccountInfos(that.pub)
that.accountService.acc = body.acc
that.enoughMoney = body.enoughMoney
console.log(that.enoughMoney)
// loader.dismissAll();
})
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment