forked from lordvkrum/LETS-mobile-Application
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from lordvkrum/10-want-page
adding want services
- Loading branch information
Showing
35 changed files
with
583 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export class Want { | ||
[property: string]: any; | ||
id?: string; | ||
title: string; | ||
description: string; | ||
user_id: string; | ||
name: string; | ||
expires: string; | ||
uri?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<h2 class="ui header">New Want</h2> | ||
<ion-buttons start> | ||
<button ion-button (click)="dismiss()"> | ||
<span color="primary" showWhen="ios">Cancel</span> | ||
<ion-icon name="md-close" showWhen="android,windows"></ion-icon> | ||
</button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content padding> | ||
<form-builder-component [fields]="fields" (created)="onCreated($event)"></form-builder-component> | ||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
page-add-want { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ViewController } from 'ionic-angular'; | ||
import { WantService } from '../../services/WantService'; | ||
import { AlertService } from '../../services/AlertService'; | ||
import { Want } from '../../domain/Want'; | ||
|
||
@Component({ | ||
selector: 'page-add-want', | ||
templateUrl: 'addWant.html' | ||
}) | ||
export class AddWantPage implements OnInit { | ||
private definitionWant: any; | ||
private fields: Array<any>; | ||
private want: Want; | ||
|
||
constructor(private viewCtrl: ViewController, | ||
private wantService: WantService, | ||
private alertService: AlertService) { } | ||
|
||
ngOnInit(): void { | ||
this.wantService.describe() | ||
.subscribe( | ||
response => { | ||
this.definitionWant = response; | ||
this.fields = this.definitionWant.POST; | ||
}, | ||
error => this.alertService.showError('Connection problem!') | ||
); | ||
} | ||
|
||
onCreated(want: Want) { | ||
this.want = want; | ||
this.wantService.post(this.want) | ||
.subscribe( | ||
response => this.viewCtrl.dismiss({ | ||
success: true | ||
}), | ||
error => this.alertService.showError(error) | ||
); | ||
} | ||
|
||
dismiss() { | ||
this.viewCtrl.dismiss(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.