mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Add component in aganda
This commit is contained in:
@@ -23,12 +23,12 @@ export class NewEventPage implements OnInit {
|
||||
@Input() selectedDate: Date;
|
||||
|
||||
@Output() onAddEvent = new EventEmitter<any>();
|
||||
@Output() openAttendeesComponent = new EventEmitter<any>();
|
||||
|
||||
minDate: string;
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
//private navParams: NavParams,
|
||||
private eventService: EventsService,
|
||||
) {
|
||||
this.postEvent = new Event();
|
||||
@@ -104,26 +104,10 @@ export class NewEventPage implements OnInit {
|
||||
this.onAddEvent.emit(this.postEvent);
|
||||
}
|
||||
|
||||
async openAttendees()
|
||||
async openAttendees(data: any)
|
||||
{
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.openAttendeesComponent.emit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
@Output() viewEventDetailDismiss = new EventEmitter<any>();
|
||||
|
||||
|
||||
constructor(
|
||||
private eventsService: EventsService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { AttendeeModalPage } from './attendee-modal.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: AttendeeModalPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AttendeeModalPageRoutingModule {}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { AttendeeModalPageRoutingModule } from './attendee-modal-routing.module';
|
||||
|
||||
import { AttendeeModalPage } from './attendee-modal.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
AttendeeModalPageRoutingModule
|
||||
],
|
||||
declarations: [AttendeeModalPage]
|
||||
})
|
||||
export class AttendeeModalPageModule {}
|
||||
@@ -0,0 +1,39 @@
|
||||
<ion-header class="ion-no-border">
|
||||
<ion-toolbar>
|
||||
<ion-title>Adicionar intervenientes</ion-title>
|
||||
</ion-toolbar>
|
||||
<ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-item-group>
|
||||
<ion-list>
|
||||
<ion-item-sliding>
|
||||
<ion-item *ngFor="let attendee of contacts">
|
||||
<ion-checkbox slot="end" (ionChange)="selectContact(attendee)"></ion-checkbox><!-- [disabled]="isCheckboxDisabled" -->
|
||||
<ion-label>
|
||||
<h3>{{ attendee.Name }}</h3>
|
||||
<p>{{ attendee.EmailAddress }}</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-item-sliding>
|
||||
</ion-list>
|
||||
</ion-item-group>
|
||||
</ion-content>
|
||||
<ion-footer class="ion-no-border">
|
||||
<ion-toolbar class="width-100 d-flex justify-space-between px-20">
|
||||
<ion-buttons slot="start">
|
||||
<ion-button class="btn-cancel" fill="clear" color="#061b52" (click)="close()">
|
||||
<ion-label>Cancelar</ion-label>
|
||||
<ion-icon name="close" slot="start"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-buttons slot="end">
|
||||
<ion-button class="btn-ok" fill="clear" color="#fff" (click)="save()">
|
||||
<ion-label>Adicionar</ion-label>
|
||||
<ion-icon name="checkmark" slot="start"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
</ion-footer>
|
||||
@@ -0,0 +1,6 @@
|
||||
ion-item-group{
|
||||
margin: 15px;
|
||||
}
|
||||
ion-searchbar{
|
||||
--border-radius: 20px;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { AttendeeModalPage } from './attendee-modal.page';
|
||||
|
||||
describe('AttendeeModalPage', () => {
|
||||
let component: AttendeeModalPage;
|
||||
let fixture: ComponentFixture<AttendeeModalPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AttendeeModalPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AttendeeModalPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { ThrowStmt, removeSummaryDuplicates } from '@angular/compiler';
|
||||
|
||||
@Component({
|
||||
selector: 'app-attendee-modal',
|
||||
templateUrl: './attendee-modal.page.html',
|
||||
styleUrls: ['./attendee-modal.page.scss'],
|
||||
})
|
||||
export class AttendeeModalPage implements OnInit {
|
||||
|
||||
contacts: EventPerson[];
|
||||
showLoader: boolean = false;
|
||||
eventPersons: EventPerson[];
|
||||
|
||||
constructor(private modalCtrl: ModalController, private contactsService: ContactsService) { }
|
||||
|
||||
@Output() openAttendeesComponent = new EventEmitter<any>();
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.fetchContacts("");
|
||||
}
|
||||
|
||||
save(){
|
||||
this.modalCtrl.dismiss(
|
||||
this.contacts.filter(function(contact) {
|
||||
return contact.IsRequired == true;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
close(){
|
||||
// this.modalCtrl.dismiss(null);
|
||||
this.openAttendeesComponent.emit();
|
||||
}
|
||||
|
||||
onChange(evt: any) {
|
||||
this.fetchContacts(evt.detail.value);
|
||||
}
|
||||
|
||||
selectContact(itm: EventPerson){
|
||||
itm.IsRequired = !itm.IsRequired;
|
||||
}
|
||||
|
||||
async fetchContacts(filter: string) {
|
||||
this.showLoader = true;
|
||||
|
||||
this.contactsService.getContacts(filter).subscribe(result =>
|
||||
{
|
||||
if (this.eventPersons != null)
|
||||
{
|
||||
this.eventPersons.forEach(attendee => {
|
||||
const index: number = result.findIndex((cont) => {
|
||||
return cont.EmailAddress == attendee.EmailAddress
|
||||
});
|
||||
|
||||
result.splice(index, 1);
|
||||
});
|
||||
}
|
||||
|
||||
this.contacts = result;
|
||||
this.showLoader = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
|
||||
<ion-footer class="ion-no-border">
|
||||
<ion-toolbar class="btn-div">
|
||||
<ion-toolbar class="width-100 d-flex justify-space-between px-20">
|
||||
<ion-buttons slot="start">
|
||||
<ion-button class="btn-cancel" fill="clear" color="#061b52" (click)="close()">
|
||||
<ion-label>Cancelar</ion-label>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { ModalController, NavController } from '@ionic/angular';
|
||||
import { AttendeeModalPage } from '../attendee-modal/attendee-modal.page';
|
||||
// import { AttendeeModalPage } from '../attendee-modal/attendee-modal.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-attendees',
|
||||
@@ -17,6 +17,9 @@ export class AttendeesPage implements OnInit {
|
||||
|
||||
searchCountryString = ''; // initialize your searchCountryString string empty
|
||||
|
||||
@Output() openAttendeeModal = new EventEmitter<any>();
|
||||
|
||||
|
||||
constructor(private eventService: EventsService, private modalCtrl: ModalController,
|
||||
private navCtrl: NavController) {
|
||||
}
|
||||
@@ -26,11 +29,11 @@ export class AttendeesPage implements OnInit {
|
||||
}
|
||||
|
||||
save(){
|
||||
this.modalCtrl.dismiss(this.eventAttendees);
|
||||
// this.modalCtrl.dismiss(this.eventAttendees);
|
||||
}
|
||||
|
||||
close(){
|
||||
this.modalCtrl.dismiss(null);
|
||||
// this.modalCtrl.dismiss(null);
|
||||
}
|
||||
|
||||
removeAttendee(attendee: EventPerson)
|
||||
@@ -42,9 +45,12 @@ export class AttendeesPage implements OnInit {
|
||||
this.eventAttendees.splice(index, 1);
|
||||
}
|
||||
|
||||
async addAttendees()
|
||||
{
|
||||
const modal = await this.modalCtrl.create({
|
||||
async addAttendees() {
|
||||
|
||||
console.log('Event Intervenient');
|
||||
this.openAttendeeModal.emit();
|
||||
|
||||
/* const modal = await this.modalCtrl.create({
|
||||
component: AttendeeModalPage,
|
||||
componentProps: {
|
||||
eventPersons: this.eventAttendees
|
||||
@@ -73,7 +79,8 @@ export class AttendeesPage implements OnInit {
|
||||
this.eventAttendees.push(att);
|
||||
});
|
||||
}
|
||||
});
|
||||
}); */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user