|
|
|
|
@ -10,17 +10,16 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
|
|
|
|
|
styleUrls: ['./announcement.component.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class AnnouncementComponent implements OnInit {
|
|
|
|
|
dt = new Date().toJSON().slice(0, 10).replace(/-/g, '/');
|
|
|
|
|
public arr: {id: number,title_EN:string,title_AR:string, body_EN:string,body_AR:string, img: string, date: Date, isopen: boolean}[] =[];
|
|
|
|
|
public arr: { id: number, title_EN: string, title_AR: string, body_EN: string, body_AR: string, img: string, date: Date, isopen: boolean }[] = [];
|
|
|
|
|
public arrList = [];
|
|
|
|
|
public listOfAnnouncement;
|
|
|
|
|
direction:string;
|
|
|
|
|
direction: string;
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public announcementService: AnnouncementService,
|
|
|
|
|
public translate: TranslatorService,
|
|
|
|
|
public common: CommonService
|
|
|
|
|
) { }
|
|
|
|
|
) { }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.direction = TranslatorService.getCurrentLanguageName();
|
|
|
|
|
@ -37,23 +36,23 @@ export class AnnouncementComponent implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleAnnouncement(item){
|
|
|
|
|
toggleAnnouncement(item) {
|
|
|
|
|
this.arrList.forEach(element => {
|
|
|
|
|
if(element.id === item.id){
|
|
|
|
|
element.isOpen = !element.isOpen;
|
|
|
|
|
}else{
|
|
|
|
|
element.isOpen = false;
|
|
|
|
|
}
|
|
|
|
|
if (element.id === item.id) {
|
|
|
|
|
element.isOpen = !element.isOpen;
|
|
|
|
|
} else {
|
|
|
|
|
element.isOpen = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAnnouncementListService(){
|
|
|
|
|
getAnnouncementListService() {
|
|
|
|
|
let holdData;
|
|
|
|
|
this.announcementService.getAnnouncementListService().subscribe((result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
holdData =JSON.parse(result.Mohemm_ITG_ResponseItem) //JSON.parse(result.Mohemm_ITG_ResponseItem);
|
|
|
|
|
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
|
|
|
|
|
this.listOfAnnouncement = JSON.parse(holdData.result.data);
|
|
|
|
|
for(let i=0; i< this.listOfAnnouncement.length; i++){
|
|
|
|
|
for (let i = 0; i < this.listOfAnnouncement.length; i++) {
|
|
|
|
|
this.listOfAnnouncement[i].Title_EN = this.listOfAnnouncement[i].Title_EN.replace(/<\/?[^>]+(>|$)/g, "");
|
|
|
|
|
this.listOfAnnouncement[i].Title_EN = this.listOfAnnouncement[i].Title_EN.replace(/\ /g, '');
|
|
|
|
|
this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].Title_AR.replace(/<\/?[^>]+(>|$)/g, "");
|
|
|
|
|
@ -62,8 +61,8 @@ export class AnnouncementComponent implements OnInit {
|
|
|
|
|
this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].EmailBody_EN.replace(/\ /g, '');
|
|
|
|
|
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR.replace(/<\/?[^>]+(>|$)/g, "");
|
|
|
|
|
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR.replace(/\ /g, '');
|
|
|
|
|
this.arr[i] ={
|
|
|
|
|
id:this.listOfAnnouncement[i].rowID,
|
|
|
|
|
this.arr[i] = {
|
|
|
|
|
id: this.listOfAnnouncement[i].rowID,
|
|
|
|
|
title_EN: this.listOfAnnouncement[i].Title_EN,
|
|
|
|
|
title_AR: this.listOfAnnouncement[i].Title_AR,
|
|
|
|
|
body_EN: this.listOfAnnouncement[i].EmailBody_EN,
|
|
|
|
|
@ -73,9 +72,7 @@ export class AnnouncementComponent implements OnInit {
|
|
|
|
|
isopen: false
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
console.log(this.listOfAnnouncement);
|
|
|
|
|
this.arrList = this.arr;
|
|
|
|
|
console.log(this.arrList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|