Merge branch 'MOHEMM-Q2-DEV' of https://gitlab.com/haroon6138/mohemmionic5 into sultan26April

zohaib-huawei-q2
Sultan Khan 5 years ago
commit 5cc00cb79d

@ -13,8 +13,10 @@
<img [src]="item.img" class="image-center">
<ion-item>
<ion-label>
<h2 class="text-style">{{item.title}}</h2>
<p class="text-style">{{item.body}}</p>
<h2 class="text-style" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
<h2 class="text-style" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
<p class="text-style" *ngIf="direction === 'en'">{{item.body_EN}}</p>
<p class="text-style" *ngIf="direction === 'ar'">{{item.body_EN}}</p>
<p class="text-style">{{item.date}}</p>
</ion-label>
</ion-item>
@ -22,35 +24,46 @@
<ion-card *ngIf="i === 0 && item.isOpen" (click)="toggleAnnouncement(item)" style="margin: 0px;">
<ion-card-header style="background: transparent;">
<ion-card-title style="font-size: 20px; margin: 5px;">{{item.title}} <br>
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'en'">{{item.title_EN}} <br>
<p style="font-size: 12px; color: gray;">{{item.date}}</p>
</ion-card-title>
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'ar'">{{item.title_AR}} <br>
<p style="font-size: 12px; color: gray;">{{item.date}}</p>
</ion-card-title>
<img [src]="item.img" class="image-center">
</ion-card-header>
<ion-card-content>
<p>{{item.body}}</p>
<p *ngIf="direction === 'en'">{{item.body_EN}}</p>
<p *ngIf="direction === 'ar'">{{item.body_AR}}</p>
</ion-card-content>
</ion-card>
<ion-item *ngIf="i > 0 && !item.isOpen" (click)="toggleAnnouncement(item)" lines='none'
style="border: 1px solid lightgray; border-radius: 30px; height: 100px;">
<img [src]="item.img" style="width: 30%;">
<img [src]="item.img" class="image-item">
<ion-label style="margin: 5px;">
<h2>{{item.title}}</h2>
<p>{{item.body}}</p>
<h2 *ngIf="direction === 'en'">{{item.title_EN}}</h2>
<p *ngIf="direction === 'en'">{{item.body_EN}}</p>
<h2 *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
<p *ngIf="direction === 'ar'">{{item.body_AR}}</p>
<p>{{item.date}}</p>
</ion-label>
</ion-item>
<ion-card *ngIf="i > 0 && item.isOpen" (click)="toggleAnnouncement(item)" style="margin: 0px;">
<ion-card-header style="background: transparent;">
<ion-card-title style="font-size: 20px; margin: 5px;">{{item.title}} <br>
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'en'">{{item.title_EN}} <br>
<p style="font-size: 12px; color: gray;">{{item.date}}</p>
</ion-card-title>
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'ar'">{{item.title_AR}} <br>
<p style="font-size: 12px; color: gray;">{{item.date}}</p>
</ion-card-title>
<img [src]="item.img" class="image-center">
</ion-card-header>
<ion-card-content>
<p>{{item.body}}</p>
<p *ngIf="direction === 'en'">{{item.body_EN}}</p>
<p *ngIf="direction === 'ar'">{{item.body_AR}}</p>
</ion-card-content>
</ion-card>
</div>

@ -1,5 +1,5 @@
.image-center{
width: 50%;
width: 100%;
display: block;
margin-left: auto;
margin-right: auto;
@ -20,3 +20,12 @@
height: 100px;
}
.class-item-close{}
.image-item{
width: 30%;
height: 70%;
margin-top: 30px;
border: 1px solid white;
border-radius: 11px;
margin-bottom: 25px;
}

@ -11,30 +11,10 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
})
export class AnnouncementComponent implements OnInit {
dt = new Date().toJSON().slice(0, 10).replace(/-/g, '/');
public arr = [
{
title:"Basic Microsoft Excel Cource",
body:" is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
img:"../assets/imgs/HMG.png",
date: this.dt,
isopen: true
},
{
title:"External Visit",
body:"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).",
img:"../assets/imgs/M.png",
date: this.dt,
isopen: false
},
{
title:"Maintenance Activity",
body:"The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from 'de Finibus Bonorum et Malorum' by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.",
img:"../assets/imgs/M.png",
date: this.dt,
isopen: false
},
];
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;
constructor(
public announcementService: AnnouncementService,
@ -43,8 +23,8 @@ export class AnnouncementComponent implements OnInit {
) { }
ngOnInit() {
this.arrList = this.arr;
// this.getAnnouncementListService();
this.direction = TranslatorService.getCurrentLanguageName();
this.getAnnouncementListService();
}
filterList(event) {
@ -53,23 +33,49 @@ export class AnnouncementComponent implements OnInit {
this.arrList = this.arr;
}
this.arrList = this.arr.filter((item) => {
return (item.title.toLowerCase().indexOf(val.toLowerCase()) > -1);
return (item.title_EN.toLowerCase().indexOf(val.toLowerCase()) > -1);
});
}
toggleAnnouncement(item){
this.arrList.forEach(element => {
if(element.title === item.title){
element.isOpen = !element.isOpen;
}else{
element.isOpen = false;
}
if(element.id === item.id){
element.isOpen = !element.isOpen;
}else{
element.isOpen = false;
}
});
}
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);
this.listOfAnnouncement = JSON.parse(holdData.result.data);
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(/\&nbsp;/g, '');
this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].Title_AR.replace(/<\/?[^>]+(>|$)/g, "");
this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].Title_AR.replace(/\&nbsp;/g, '');
this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].EmailBody_EN.replace(/<\/?[^>]+(>|$)/g, "");
this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].EmailBody_EN.replace(/\&nbsp;/g, '');
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR.replace(/<\/?[^>]+(>|$)/g, "");
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR.replace(/\&nbsp;/g, '');
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,
body_AR: this.listOfAnnouncement[i].EmailBody_AR,
date: this.listOfAnnouncement[i].created,
img: this.listOfAnnouncement[i].Banner_Image,
isopen: false
};
}
console.log(this.listOfAnnouncement);
this.arrList = this.arr;
console.log(this.arrList);
}
});
}

@ -3,12 +3,13 @@ import { Request } from 'src/app/hmg-common/services/models/request';
import { Observable } from 'rxjs';
import { AuthenticationService } from '../authentication/authentication.service';
import { ConnectorService } from '../connector/connector.service';
import { AnnouncementRequest } from '../models/announcement-request';
@Injectable({
providedIn: 'root'
})
export class AnnouncementService {
public static getAnnouncemntList = '';
public static getAnnouncemntList = 'Services/COCWS.svc/REST/GetAnnouncementDiscountsConfigData';
constructor(
public authService: AuthenticationService,
@ -17,9 +18,9 @@ export class AnnouncementService {
getAnnouncementListService(onError ?: any , oerrorLable ?: any) {
const request = new Request();
const request = new AnnouncementRequest();
this.authService.authenticateRequest(request);
console.log(request);
request.EmployeeNumber = request.P_USER_NAME;
return this.con.post(
AnnouncementService.getAnnouncemntList,
request,

@ -0,0 +1,8 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class AnnouncementRequest extends Request {
public TokenID: string;
public EmployeeNumber: string;
}
Loading…
Cancel
Save