mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Attendees funcionality.
This commit is contained in:
@@ -11,6 +11,7 @@ import { AppComponent } from './app.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { IonicSelectableModule } from 'ionic-selectable';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
@@ -21,7 +22,8 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
SplashScreen,
|
||||
HttpClientModule,
|
||||
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
|
||||
InAppBrowser
|
||||
InAppBrowser,
|
||||
IonicSelectableModule
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
|
||||
@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { HomePage } from './home.page';
|
||||
import { EventsPage } from '../pages/events/events.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
|
||||
@@ -7,13 +7,16 @@ import { IonicModule } from '@ionic/angular';
|
||||
import { HomePageRoutingModule } from './home-routing.module';
|
||||
|
||||
import { HomePage } from './home.page';
|
||||
import { IonicSelectableModule } from 'ionic-selectable';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
HomePageRoutingModule
|
||||
HomePageRoutingModule,
|
||||
IonicSelectableModule
|
||||
],
|
||||
declarations: [HomePage]
|
||||
})
|
||||
|
||||
@@ -5,9 +5,15 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<!-- Searchbar with cancel button always shown -->
|
||||
<ion-searchbar></ion-searchbar>
|
||||
<!-- TABS -->
|
||||
<ion-searchbar [(ngModel)]="searchCountryString" (input)="searchCountry($event)" placeholder="Search"></ion-searchbar>
|
||||
<ion-list>
|
||||
<button ion-item *ngFor="let attendee of eventAttendees">
|
||||
{{attendee.Name}}
|
||||
</button>
|
||||
</ion-list>
|
||||
|
||||
|
||||
<!--
|
||||
<ion-toolbar >
|
||||
<ion-segment [(ngModel)]="segment" (ionChange)="onSegmentChange()">
|
||||
<ion-segment-button value="required">
|
||||
@@ -19,14 +25,15 @@
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
<div [ngSwitch]="segment">
|
||||
<ion-searchbar
|
||||
[showCancelButton]=""
|
||||
(ionChange)="onChange($event)">
|
||||
</ion-searchbar>
|
||||
<ion-list>
|
||||
<ion-item-sliding>
|
||||
<ion-item lines="none" *ngFor="let attendee of eventAttendees">
|
||||
<div class="div-item">
|
||||
<div class="div-up">
|
||||
<div class="div-icon">
|
||||
<ion-icon class="ion-icon-attach" slot="end" name="attach-outline"></ion-icon>
|
||||
</div>
|
||||
<div class="div-content-attachment">
|
||||
<h3>{{ attendee.Name }}</h3>
|
||||
<p>{{ attendee.EmailAddress }}</p>
|
||||
@@ -36,5 +43,5 @@
|
||||
</ion-item>
|
||||
</ion-item-sliding>
|
||||
</ion-list>
|
||||
</div>
|
||||
</div>TABS -->
|
||||
</ion-content>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { Component, OnInit, Injectable } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { EventDetailPage } from '../event-detail/event-detail.page';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
|
||||
@Component({
|
||||
@@ -11,18 +9,54 @@ import { EventsService } from 'src/app/services/events.service';
|
||||
})
|
||||
export class AttendeesPage implements OnInit {
|
||||
|
||||
eventAttendeesInitial: EventPerson[];
|
||||
eventAttendees: EventPerson[];
|
||||
segment:string;
|
||||
segment:string = "required";
|
||||
shouldShowCancel:boolean = true;
|
||||
|
||||
constructor(private activatedRoute: ActivatedRoute, public eventService: EventsService) {
|
||||
searchCountryString = ''; // initialize your searchCountryString string empty
|
||||
|
||||
constructor(private eventService: EventsService) {
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.eventAttendees = this.eventService.loadedEvent.Attendees;
|
||||
console.log(this.eventService.loadedEvent);
|
||||
this.loadAttendees();
|
||||
}
|
||||
|
||||
onSegmentChange(){
|
||||
|
||||
this.loadAttendees();
|
||||
}
|
||||
|
||||
searchCountry(searchbar) {
|
||||
// reset countries list with initial call
|
||||
this.eventAttendees = this.eventAttendeesInitial;
|
||||
|
||||
// set q to the value of the searchbar
|
||||
var q = searchbar.value;
|
||||
|
||||
// if the value is an empty string don't filter the items
|
||||
// if (q.trim() == '') {
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.eventAttendees = this.eventAttendees.filter((v) => {
|
||||
if (v.Name.toLowerCase().indexOf(q.toLowerCase()) > -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
loadAttendees(){
|
||||
let isRequired: boolean = (this.segment == "required");
|
||||
this.eventAttendees = this.eventService.lastloadedevent.Attendees.filter(function(person) {
|
||||
return person.IsRequired == isRequired;
|
||||
});
|
||||
this.eventAttendeesInitial = this.eventAttendees;
|
||||
}
|
||||
|
||||
onChange(evt: any) {
|
||||
console.log(evt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,12 @@
|
||||
<ion-label position="stacked">Localização</ion-label>
|
||||
<ion-input [(ngModel)]='loadedEvent.Location'></ion-input>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Intervenientes</ion-label>
|
||||
<ion-list>
|
||||
<ion-item *ngFor="let inter of loadedEvent.RequiredAttendees">
|
||||
<ion-input [(ngModel)]='inter.Name'></ion-input>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-item>
|
||||
<ion-item-sliding>
|
||||
<ion-item
|
||||
[routerLink]="['/home/attendees']">
|
||||
<ion-label position="stacked">Pessoas</ion-label>
|
||||
</ion-item>
|
||||
</ion-item-sliding>
|
||||
<ion-item>
|
||||
<ion-label position="stacked">Calendário</ion-label>
|
||||
<ion-input [(ngModel)]='loadedEvent.CalendarName'></ion-input>
|
||||
@@ -46,13 +44,12 @@
|
||||
<ion-label position="stacked">Data Fim</ion-label>
|
||||
<ion-input [(ngModel)]='loadedEvent.EndDate'></ion-input>
|
||||
</ion-item>
|
||||
<ion-list>
|
||||
<ion-list-header>Anexos</ion-list-header>
|
||||
<ion-item>
|
||||
<ion-icon name="attach" slot="start"></ion-icon>
|
||||
<ion-label>Lei do orçamento geral do Estado</ion-label>
|
||||
<ion-item-sliding>
|
||||
<ion-item
|
||||
[routerLink]="['/home/attachments', loadedEvent.EventId]">
|
||||
<ion-label position="stacked">Anexos</ion-label>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-item-sliding>
|
||||
</ion-item-group>
|
||||
<div class="event-detail-buttons">
|
||||
<ion-button fill="outline" class="ion-button-left" (click)="deleteConfirm()">Apagar</ion-button>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, Injectable } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { Event } from '../../../models/event.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { EventBody } from 'src/app/models/eventbody.model';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-detail',
|
||||
@@ -15,7 +15,6 @@ import { AlertController } from '@ionic/angular';
|
||||
export class EventDetailPage implements OnInit {
|
||||
|
||||
loadedEvent: Event;
|
||||
eventItem: Observable<Event>;
|
||||
|
||||
constructor(public alertController: AlertController, private router: Router, private activatedRoute: ActivatedRoute, private eventsService: EventsService) {
|
||||
this.loadedEvent = new Event();
|
||||
@@ -23,29 +22,42 @@ export class EventDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
/* Emit new data when something changes */
|
||||
this.activatedRoute.paramMap.subscribe(paramMap =>{
|
||||
if(!paramMap.has('eventId')){
|
||||
//Redirect
|
||||
return;
|
||||
}
|
||||
const eventId = paramMap.get('eventId');
|
||||
this.loadEvent();
|
||||
}
|
||||
|
||||
/* Load my event detail */
|
||||
/* this.loadedEvent = this.eventsService.getEvent(eventId); */
|
||||
this.eventItem = this.eventsService.getEvent(eventId);
|
||||
|
||||
/* console.log(this.eventItem); */
|
||||
|
||||
this.eventsService.getEvent(eventId).subscribe(response =>
|
||||
loadEvent()
|
||||
{
|
||||
this.activatedRoute.paramMap.subscribe(paramMap =>
|
||||
{
|
||||
if (!paramMap.has("eventId"))
|
||||
{
|
||||
this.loadedEvent = response;
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.eventsService.getEvent(paramMap.get('eventId')).subscribe(response =>
|
||||
{
|
||||
this.loadedEvent = response;
|
||||
this.eventsService.lastloadedevent = this.loadedEvent;
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getEventAttendees(): EventPerson[]
|
||||
{
|
||||
return this.loadedEvent.Attendees;
|
||||
}
|
||||
|
||||
setEventAttendees(newattendes: EventPerson[])
|
||||
{
|
||||
this.loadedEvent.Attendees = newattendes;
|
||||
}
|
||||
|
||||
async deleteConfirm()
|
||||
{
|
||||
console.log(this.loadedEvent.Attendees);
|
||||
console.log(this.loadedEvent.CalendarName);
|
||||
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Apagar evento!',
|
||||
@@ -55,7 +67,7 @@ export class EventDetailPage implements OnInit {
|
||||
text: 'Não',
|
||||
role: 'cancel',
|
||||
cssClass: 'secondary',
|
||||
handler: (blah) => { }
|
||||
handler: () => { }
|
||||
}, {
|
||||
text: 'Sim',
|
||||
handler: () => {
|
||||
@@ -70,7 +82,7 @@ export class EventDetailPage implements OnInit {
|
||||
|
||||
Delete()
|
||||
{
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async response =>
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () =>
|
||||
{
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
@@ -86,7 +98,7 @@ export class EventDetailPage implements OnInit {
|
||||
|
||||
Save()
|
||||
{
|
||||
this.eventsService.putEvent(this.loadedEvent, 2, 3).subscribe(async response =>
|
||||
this.eventsService.putEvent(this.loadedEvent, 2, 3).subscribe(async () =>
|
||||
{
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
|
||||
@@ -15,7 +15,7 @@ export class EventsService {
|
||||
authheader = {};
|
||||
loggeduser: User;
|
||||
headers: HttpHeaders;
|
||||
public loadedEvent: Event;
|
||||
lastloadedevent: Event;
|
||||
|
||||
constructor(private http: HttpClient, user: AuthService) {
|
||||
this.loggeduser = user.ValidatedUser;
|
||||
|
||||
Reference in New Issue
Block a user