mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Add generic modal
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { EventBody } from 'src/app/models/eventbody.model';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { Event } from 'src/app/models/event.model';
|
||||
import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page';
|
||||
import { AlertController, NavParams } from '@ionic/angular';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-event',
|
||||
templateUrl: './edit-event.component.html',
|
||||
styleUrls: ['./edit-event.component.scss'],
|
||||
})
|
||||
export class EditEventComponent implements OnInit {
|
||||
|
||||
stEvent: Event;
|
||||
isRecurring:string;
|
||||
isEventEdited: boolean;
|
||||
loadedEvent: Event;
|
||||
eventBody: EventBody;
|
||||
segment:string = "true";
|
||||
eventAttendees: EventPerson[];
|
||||
minDate: string;
|
||||
|
||||
@Input() profile:string;
|
||||
@Input() selectedSegment: string;
|
||||
@Input() postEvent: any;
|
||||
|
||||
|
||||
@Output() cloneAllmobileComponent = new EventEmitter<any>();
|
||||
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private eventsService: EventsService,
|
||||
public alertController: AlertController,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.isEventEdited = false;
|
||||
|
||||
if(this.postEvent.IsRecurring == false){
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
else{
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
}
|
||||
close(){
|
||||
// this.modalController.dismiss();
|
||||
this.cloneAllmobileComponent.emit();
|
||||
}
|
||||
save(){
|
||||
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento actualizado',
|
||||
buttons: ['OK']
|
||||
});
|
||||
await alert.present();
|
||||
});
|
||||
this.isEventEdited = true;
|
||||
// this.modalController.dismiss(this.isEventEdited);
|
||||
this.cloneAllmobileComponent.emit(this.isEventEdited);
|
||||
}
|
||||
|
||||
async openAttendees()
|
||||
{
|
||||
const modal = await this.modalController.create({
|
||||
component: AttendeesPage,
|
||||
componentProps: {
|
||||
eventAttendees: this.postEvent.Attendees
|
||||
},
|
||||
cssClass: 'attendee',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then((data) => {
|
||||
if (data['data'] != null)
|
||||
{
|
||||
let newattendees: EventPerson[] = data['data'];
|
||||
this.postEvent.Attendees = newattendees;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user