|
|
|
|
@ -22,6 +22,14 @@ export class AnnouncementComponent implements OnInit {
|
|
|
|
|
public pageSize = 1;
|
|
|
|
|
public pageLength = 0;
|
|
|
|
|
public lengthCounter = 5;
|
|
|
|
|
public detialData: {
|
|
|
|
|
id: number,
|
|
|
|
|
title_EN: string,
|
|
|
|
|
title_AR: string,
|
|
|
|
|
body_EN: string,
|
|
|
|
|
body_AR: string,
|
|
|
|
|
img?: string,
|
|
|
|
|
date: Date};
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public announcementService: AnnouncementService,
|
|
|
|
|
@ -37,24 +45,51 @@ export class AnnouncementComponent implements OnInit {
|
|
|
|
|
filterList(event) {
|
|
|
|
|
const val = event.target.value;
|
|
|
|
|
if (val === '') {
|
|
|
|
|
this.announcementList = this.arr;
|
|
|
|
|
this.announcementList = this.arrList;
|
|
|
|
|
}
|
|
|
|
|
this.announcementList = this.arr.filter((item) => {
|
|
|
|
|
this.announcementList = this.arrList.filter((item) => {
|
|
|
|
|
return (item.title_EN.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleAnnouncement(item) {
|
|
|
|
|
this.common.startLoading();
|
|
|
|
|
let holdData;
|
|
|
|
|
let data;
|
|
|
|
|
this.announcementList.forEach(element => {
|
|
|
|
|
if (element.id === item.id) {
|
|
|
|
|
element.isOpen = !element.isOpen;
|
|
|
|
|
this.announcementService.getAnnouncementListService(this.pageSize, item.id).subscribe((result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
|
|
|
|
|
data = JSON.parse(holdData.result.data)[0];
|
|
|
|
|
console.log(data);
|
|
|
|
|
this.detialData = {
|
|
|
|
|
id: data.rowID,
|
|
|
|
|
title_EN: data.Title_EN,
|
|
|
|
|
title_AR: data.Title_AR,
|
|
|
|
|
body_EN: data.Body_EN,
|
|
|
|
|
body_AR: data.Body_AR,
|
|
|
|
|
date: data.created,
|
|
|
|
|
img: data.Banner_Image
|
|
|
|
|
};
|
|
|
|
|
element.isOpen = !element.isOpen;
|
|
|
|
|
this.common.stopLoading();
|
|
|
|
|
}
|
|
|
|
|
console.log(this.detialData);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
element.isOpen = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
closeAnnouncement(item){
|
|
|
|
|
item.isOpen = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAnnouncementListService() {
|
|
|
|
|
this.common.startLoading();
|
|
|
|
|
let holdData;
|
|
|
|
|
this.announcementService.getAnnouncementListService(this.pageSize).subscribe((result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
@ -83,11 +118,10 @@ export class AnnouncementComponent implements OnInit {
|
|
|
|
|
if ( i < this.numberOfListLength){
|
|
|
|
|
this.announcementList.push(this.arr[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.arrList.push(this.arr[i]);
|
|
|
|
|
}
|
|
|
|
|
this.arrList = this.arr;
|
|
|
|
|
console.log(this.announcementList);
|
|
|
|
|
}
|
|
|
|
|
this.common.stopLoading();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|