-
Notifications
You must be signed in to change notification settings - Fork 1
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 #1 from GoogolApp/events
Events
- Loading branch information
Showing
17 changed files
with
170 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
export class User{ | ||
username: string; | ||
email: string; | ||
password: string; | ||
token: string; | ||
|
||
constructor(_id: string, username: string, email: string){ | ||
constructor(username: string, email: string, password: string){ | ||
this.username = username; | ||
this.token = ""; | ||
this.email = email; | ||
this.password = password; | ||
} | ||
} |
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,35 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient, HttpHeaders } from '@angular/common/http'; | ||
import { Observable } from 'rxjs/observable'; | ||
import 'rxjs/add/operator/map'; | ||
|
||
import { User } from '../_models/user'; | ||
import { appConfig } from '../app/app.config'; | ||
|
||
@Injectable() | ||
export class UsersService{ | ||
|
||
private url: string = appConfig.apiUrl + '/users'; | ||
private httpOptions = {headers: new HttpHeaders({ 'Content-Type': 'application/json' })}; | ||
|
||
constructor(private http: HttpClient) {} | ||
|
||
/** | ||
* Cria um novo usuário | ||
* @param user | ||
*/ | ||
create(user : User) : Observable<User>{ | ||
|
||
let body = { | ||
"username" : user.username, | ||
"email" : user.email, | ||
"password": user.password | ||
} | ||
|
||
return this.http.post<User>( this.url, body, this.httpOptions) | ||
.map( user => { | ||
return user; | ||
}) | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const appConfig = { | ||
apiUrl: 'http://10.0.0.9:4040' | ||
apiUrl: 'http://localhost:4040/api' | ||
}; |
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,4 @@ | ||
<ion-content padding> | ||
<p *ngIf="events.length === 0" class="text-default-medium" text-center> Não existem eventos cadastrados!</p> | ||
<googol-card *ngFor="let event of events" [event]="event" action="CONFIRM_PRESENCE"></googol-card> | ||
</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,23 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { EventsService } from '../../../_services/events'; | ||
import { Event } from '../../../_models/event'; | ||
|
||
@Component({ | ||
selector: 'tab-all-events', | ||
templateUrl: 'all-events.html' | ||
}) | ||
|
||
export class AllEventsTab implements OnInit{ | ||
|
||
events: Array<Event> = []; | ||
|
||
constructor(public eventsService: EventsService){} | ||
|
||
ngOnInit(){ | ||
this.fetchEvents(); | ||
} | ||
|
||
fetchEvents(){ | ||
this.events = this.eventsService.getAll(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,38 +1,18 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { NavController } from 'ionic-angular'; | ||
import { EventsService } from '../../_services/events'; | ||
import { Event } from '../../_models/event'; | ||
|
||
import { AllEventsTab } from './all-events/all-events'; | ||
import { MyEventsTab } from './my-events/my-events'; | ||
|
||
@Component({ | ||
selector: 'page-events', | ||
templateUrl: 'events.html' | ||
}) | ||
export class EventsPage implements OnInit{ | ||
|
||
events: Array<Event> = []; | ||
|
||
match = { | ||
league: "Brasileirão Série A", | ||
location: "Bar do Agostini, Campina Grande", | ||
hour: new Date(2018, 4, 14, 20, 0, 0, 0), | ||
home: { | ||
name: "Botafogo", | ||
logo: "https://ssl.gstatic.com/onebox/media/sports/logos/KLDWYp-H8CAOT9H_JgizRg_96x96.png" | ||
}, | ||
away: { | ||
name: "Fluminense", | ||
logo: "https://ssl.gstatic.com/onebox/media/sports/logos/fCMxMMDF2AZPU7LzYKSlig_96x96.png" | ||
} | ||
} | ||
|
||
constructor(public navCtrl: NavController, public eventsService: EventsService) {} | ||
export class EventsPage{ | ||
|
||
ngOnInit(){ | ||
this.fetchEvents(); | ||
} | ||
tab1 = AllEventsTab; | ||
tab2 = MyEventsTab; | ||
|
||
fetchEvents(){ | ||
this.events = this.eventsService.getAll(); | ||
} | ||
constructor(public navCtrl: NavController) {} | ||
|
||
} |
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,4 @@ | ||
<ion-content padding> | ||
<p *ngIf="events.length === 0" class="text-default-medium" text-center> Você ainda não criou nenhum evento!</p> | ||
<googol-card *ngFor="let event of events" [event]="event" action="CONFIRM_PRESENCE"></googol-card> | ||
</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,23 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { EventsService } from '../../../_services/events'; | ||
import { Event } from '../../../_models/event'; | ||
|
||
@Component({ | ||
selector: 'tab-my-events', | ||
templateUrl: 'my-events.html' | ||
}) | ||
|
||
export class MyEventsTab implements OnInit{ | ||
|
||
events: Array<Event> = []; | ||
|
||
constructor(public eventsService: EventsService){} | ||
|
||
ngOnInit(){ | ||
this.fetchEvents(); | ||
} | ||
|
||
fetchEvents(){ | ||
this.events = this.eventsService.getAll(); | ||
} | ||
} |
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
Oops, something went wrong.