New Services, New Login, Better things

This commit is contained in:
Paulo Pinto
2020-08-21 16:18:37 +01:00
parent 86b3c8f039
commit ffadf6601c
15 changed files with 177 additions and 238 deletions
@@ -15,7 +15,9 @@ export class EventDetailPage implements OnInit {
loadedEvent: Event;
eventItem: Observable<Event>;
constructor(private activatedRoute: ActivatedRoute, private eventsService: EventsService) { }
constructor(private activatedRoute: ActivatedRoute, private eventsService: EventsService) {
this.loadedEvent = new Event();
}
ngOnInit() {
/* Emit new data when something changes */
@@ -38,7 +40,7 @@ export class EventDetailPage implements OnInit {
Save()
{
this.eventsService.PutEvent(this.loadedEvent).subscribe(response =>
this.eventsService.putEvent(this.loadedEvent, 2, 3).subscribe(response =>
{
this.loadedEvent = response;
});
+9 -11
View File
@@ -13,7 +13,7 @@
<ion-item class="ion-text-right" lines="none">
<ion-label class="ion-text-wrap">
<h3 class="header-medium"> {{greetting}} Sua Excelência <br />
Minístro Director do Gabinete do<br />
Ministro Director do Gabinete do<br />
Presidente da República
</h3>
<p class="p-small">{{customDate}}</p>
@@ -41,11 +41,10 @@
<!-- List of Text Items -->
<div [ngSwitch]="segment">
<ion-list *ngSwitchCase="'combinada'" >
<ion-item-group *ngIf="eventsList | async as events">
<ion-item-group>
<ion-item-sliding>
<ion-item lines="none"
*ngFor="let event of events"
*ngFor="let event of eventsList"
[routerLink]="['/home/events', event.EventId]">
<div class="div-item">
<div class="div-up">
@@ -77,12 +76,12 @@
</ion-list>
<!-- OFICIAL -->
<ion-list *ngSwitchCase="'oficial'">
<ion-item-group>
<!-- <ion-item-group>
<ion-item-sliding>
<ion-item-divider>
<ion-label>8:00 am</ion-label>
</ion-item-divider>
<ion-item lines="none" *ngFor="let event of events">
<ion-item lines="none" *ngFor="let event of eventsList">
<div class="div-item">
<div class="div-up">
<div class="div-icon">
@@ -107,13 +106,13 @@
</div>
</ion-item>
</ion-item-sliding>
</ion-item-group>
</ion-item-group> -->
</ion-list>
<ion-list *ngSwitchCase="'pessoal'">
<ion-item-group>
<!-- <ion-item-group>
<ion-item-sliding>
<ion-item lines="none" *ngFor="let event of events">
<ion-item lines="none" *ngFor="let event of eventsList">
<div class="div-item">
<div class="div-up">
<div class="div-icon">
@@ -138,8 +137,7 @@
</div>
</ion-item>
</ion-item-sliding>
</ion-item-group>
</ion-item-group> -->
</ion-list>
</div>
</ion-content>
+42 -40
View File
@@ -1,10 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, LOCALE_ID } from '@angular/core';
import { Event } from '../../models/event.model';
import { EventsService } from 'src/app/services/events.service';
import { Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { formatDate } from '@angular/common';
@Component({
@@ -13,52 +13,54 @@ import { Observable } from 'rxjs';
styleUrls: ['./events.page.scss'],
})
export class EventsPage implements OnInit {
/* Get current system date */
today = new Date();
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
/* Get current system date */
today = new Date();
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate = this.days[this.today.getDay()]+ ", "
+ this.today.getDate() +" de "
+ ( this.months[this.today.getMonth()]);
/* Setting appropriate greeting according to the time */
grettings = ["Bom dia", "Boa tarde", "Boa noite"];
greetting='';
timeDate = this.today.getHours() + ":" + this.today.getMinutes();
/* Set segment variable */
segment:string;
customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
events: Event[];
eventsList: Observable<Event[]>;
/* Setting appropriate greeting according to the time */
grettings = ["Bom dia", "Boa tarde", "Boa noite"];
greetting='';
constructor(private eventService: EventsService, private router: Router, public activatedRoute: ActivatedRoute) { }
timeDate = this.today.getHours() + ":" + this.today.getMinutes();
/* Set segment variable */
segment:string;
ngOnInit() {
//Inicializar segment
this.segment = "combinada";
this.showGreeting();
/* Call Get events method */
this.eventsList = this.eventService.allEvents();/* .subscribe(prods=>console.log(prods)); */
}
eventsList: Event[];
showGreeting(){
if(this.today.getHours() >= 6 && this.today.getHours() < 12){
console.log(this.grettings[0]+this.today.getHours());
this.greetting = this.grettings[0];
constructor(private eventService: EventsService, private router: Router, public activatedRoute: ActivatedRoute) { }
ngOnInit() {
//Inicializar segment
this.segment = "combinada";
this.showGreeting();
/* Call Get events method */
this.eventService.getAllEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59')
.subscribe(response => {
this.eventsList = response;
}
);
}
else if(this.today.getHours() >= 12 && this.today.getHours() < 18){
console.log(this.grettings[1]+this.today.getHours());
this.greetting = this.grettings[1];
}
else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */{
console.log(this.grettings[2]+this.today.getHours());
this.greetting = this.grettings[2];
showGreeting(){
if(this.today.getHours() >= 6 && this.today.getHours() < 12){
this.greetting = this.grettings[0];
}
else if(this.today.getHours() >= 12 && this.today.getHours() < 18){
this.greetting = this.grettings[1];
}
else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */{
this.greetting = this.grettings[2];
}
}
gotTo(){
this.router.navigate(['/home/events']);
}
}
gotTo(ev){
this.router.navigate(['/home/events']);
}
}