Files
doneit-web/src/app/pages/search/sender/sender.page.ts
T

68 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-01-16 17:45:09 +01:00
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
2021-01-19 08:52:43 +01:00
import { EventPerson } from 'src/app/models/eventperson.model';
2021-10-25 13:54:34 +01:00
import { ThemeService } from 'src/app/services/theme.service'
2024-10-18 16:22:45 +01:00
import { AgendaService } from 'src/app/module/agenda/domain/agenda.service'
2021-01-19 16:44:39 +01:00
2021-01-16 17:45:09 +01:00
@Component({
selector: 'app-sender',
templateUrl: './sender.page.html',
styleUrls:
['./sender.page.scss'],
})
export class SenderPage implements OnInit {
2021-01-19 08:52:43 +01:00
contacts: EventPerson[];
showContacts: EventPerson[];
2021-01-19 16:44:39 +01:00
sender: string;
selectedUser: string;
2021-01-19 08:52:43 +01:00
constructor(private modalController:ModalController,
2024-10-18 16:22:45 +01:00
public ThemeService: ThemeService,
private AgendaService: AgendaService
) {
2021-01-19 08:52:43 +01:00
}
2021-01-16 17:45:09 +01:00
ngOnInit() {
2021-01-19 08:52:43 +01:00
this.getSender();
}
2024-10-18 16:22:45 +01:00
async getSender(){
const result = await this.AgendaService.setDefaultParticipants()
if(result.isOk()) {
if(result.value) {
console.log('Attendes Email', result.value)
this.contacts = result.value as any;
this.showContacts = result.value as any
}
}
2021-01-19 08:52:43 +01:00
}
2021-01-19 16:44:39 +01:00
2021-03-30 15:35:22 +01:00
filterContact(event?:any){
2021-01-19 08:52:43 +01:00
2021-01-19 16:44:39 +01:00
const findPerson = this.sender.toLowerCase();
const persons = this.contacts.filter((person) => {
2021-01-19 08:52:43 +01:00
2021-01-19 16:44:39 +01:00
if (person.Name.toLowerCase().indexOf(findPerson) == 0){
return true;
}
2021-01-19 08:52:43 +01:00
2021-01-19 16:44:39 +01:00
});
2021-01-19 08:52:43 +01:00
2021-01-19 16:44:39 +01:00
this.showContacts = persons;
}
2021-01-19 08:52:43 +01:00
2023-08-11 16:14:25 +01:00
selectUser(username){
2021-01-19 16:44:39 +01:00
this.selectedUser = username;
this.close(this.selectedUser);
2021-01-16 17:45:09 +01:00
}
2021-03-30 15:35:22 +01:00
close(username?: string){
2021-01-19 16:44:39 +01:00
this.modalController.dismiss(username);
2021-01-16 17:45:09 +01:00
}
}