Merge branch 'MOHEMM-Q2-DEV' into enad-Q1

MOHEMM-Q3-DEV-LATEST
umasoodch 5 years ago
commit 745287b3f4

@ -137,11 +137,41 @@ export class AppComponent implements OnInit {
this.authService.checkAds({
EmployeeNumber: '',
ItgEnableAt: "Before Service Initiation",
ItgServiceName: "Ticket"
ItgEnableAt: "After Service Submission", //Before Service Initiation
ItgServiceName: "Login"
}, () => { }, this.ts.trPK('general', 'ok')).subscribe(res => {
console.log("Check Ads")
console.log(res);
var result = JSON.parse(res.Mohemm_ITG_ResponseItem).result.data;
this.cs.sharedService.setSharedData(
result,
AuthenticationService.SERVEY_DATA
)
if (!CommonService.SKIP && result) {
if (result.notificationType == 'Survey') {
this.cs.navigateForward('/erm-channel/survey');
} else {
this.authService.adsDetails({
"ItgNotificationMasterId": result['notificationMasterId']
},
() => { }, this.ts.trPK('general', 'ok')
).subscribe((result) => {
var data = result.Mohemm_ITG_ResponseItem;
if (data) {
this.cs.sharedService.setSharedData(
JSON.parse(data),
AuthenticationService.ADS_DATA
);
this.cs.navigateForward('/erm-channel/home');
}
})
}
}
});
if (this.cs.getUpdateImage().status) {
@ -151,8 +181,8 @@ export class AppComponent implements OnInit {
}
this.User_Job_name = user.JOB_NAME;
//erm channel
if (!CommonService.SKIP)
this.cs.navigateForward('/erm-channel/survey');
// if (!CommonService.SKIP)
// this.cs.navigateForward('/erm-channel/survey');
} else {
console.log(user);
}

@ -1,13 +1,19 @@
<div class="full-ads" style="background-image: url(https://i.pinimg.com/564x/a8/b4/42/a8b442181f7c004f98d4eef842a76e76.jpg);">
<div class="full-ads" >
<div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}}</div>
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div>
<img [src]="advertisement.base64String" *ngIf="advertisement.contentType =='image/jpeg'"/>
<iframe *ngIf="advertisement.contentType =='video/mp4'" [src]="sanitizer.bypassSecurityTrustResourceUrl(advertisement.fileName)" allow="autoplay;" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<!-- <div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}}</div> -->
<div class="info-container">
<ion-icon name="thumbs-down" class="red"></ion-icon>
<ion-icon name="information" class="white"></ion-icon>
<ion-icon name="thumbs-up" class="green"></ion-icon>
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div>
<div *ngIf="setTime ==0">
<ion-icon name="thumbs-down" class="red" (click)="setView('Dislike')"></ion-icon>
<ion-icon name="information" class="white" (click)="setView('Info')"></ion-icon>
<ion-icon name="thumbs-up" class="green" (click)="setView('Like')"></ion-icon>
</div>
</div>
</div>

@ -41,4 +41,8 @@
background: #fff;
color: #000;
}
.seconds{
font-size: 28px;
font-weight: bold;
}

@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { DomSanitizer } from '@angular/platform-browser';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-home',
@ -10,9 +13,19 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service
export class HomeComponent implements OnInit {
isSkip: boolean = false;
setTime: number = 5;
constructor(public nav: NavController,) { }
advertisement: any;
data: any;
constructor(public nav: NavController, public cs: CommonService, public sanitizer: DomSanitizer, public authService: AuthenticationService, public ts: TranslatorService) { }
ngOnInit() { }
ngOnInit() {
this.data = this.cs.sharedService.getSharedData(
AuthenticationService.ADS_DATA,
false
);
this.advertisement = this.data.result.data.advertisement.viewAttachFileColl[0];
this.setTime = this.data.result.data.advertisement.durationInSeconds;
this.setTimer();
}
skip() {
this.nav.pop();
CommonService.SKIP = true;
@ -27,4 +40,29 @@ export class HomeComponent implements OnInit {
}
}, 1000);
}
setView(status) {
// var request =
// {
// "ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
// { "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
// { "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
// ]
// };
this.authService.setViewAds({
"ItgNotificationMasterId": this.data.result.data.notificationMasterId,
"ItgAdvertisement": {
"advertisementId": this.data.result.data.advertisementId,
"acknowledgment": status
}
}, (
) => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
CommonService.SKIP = true;
this.cs.openHome();
})
}
}

@ -1,6 +1,6 @@
<ion-content padding class="survey-content">
<div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}} </div>
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div>
<!-- <div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}} </div>
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div> -->
<ion-grid class="ion-no-padding grid-parent">
<ion-row>
<ion-text class="title-text">
@ -57,7 +57,7 @@
<ion-col [size]="12">
<ion-textarea rows="6" cols="20" [(ngModel)]="Note" [placeholder]="ts.trPK('replacementRoll','enterNote')"></ion-textarea>
<ion-textarea rows="6" cols="20" [(ngModel)]="note" [placeholder]="ts.trPK('replacementRoll','enterNote')"></ion-textarea>
</ion-col>
</ion-row>
</ion-card>
@ -65,7 +65,7 @@
</ion-content>
<ion-footer >
<div class="centerDiv">
<ion-button class="footer-button" ion-button (click)="submit()" [disabled]="!rate || (rate==1 && !Note)">
<ion-button class="footer-button" ion-button (click)="saveSurvey()" [disabled]="!rate || (rate==1 && !note)">
{{'general,submit' | translate}} </ion-button>
</div>

@ -14,7 +14,7 @@ export class SurveyComponent implements OnInit {
isSkip: boolean = false;
setTime: number = 5;
satisfied: any = '5';
note: any;
constructor(public ts: TranslatorService, public cs: CommonService, public nav: NavController, public authService: AuthenticationService) { }
ngOnInit() {
@ -34,11 +34,26 @@ export class SurveyComponent implements OnInit {
}
}, 1000);
}
saveSruvey() {
saveSurvey() {
var request = {}
this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
var data = this.cs.sharedService.getSharedData(
AuthenticationService.SERVEY_DATA,
false
)
var request =
{
"ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
{ "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
{ "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
]
};
this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
CommonService.SKIP = true;
this.cs.openHome();
})
}
select(rating) {

@ -79,7 +79,7 @@ export class AuthenticationService {
public static getITGPageNotification = 'Services/COCWS.svc/REST/Mohemm_ITG_GetPageNotification';
public static getITGPageNotificationDetails = 'Services/COCWS.svc/REST/Mohemm_ITG_GetPageNotificationDetails';
public static saveSurveyAds = 'Services/COCWS.svc/REST/Mohemm_ITG_Survey_Response';
public static setViewAdvertisement = 'Services/COCWS.svc/REST/Mohemm_ITG_UpdateAdvertisementAsViewed';
public static LOGIN_EVENT = 'user-login-event';
@ -89,8 +89,8 @@ export class AuthenticationService {
public static DEVICE_TOKEN = "device_token";
public static LAST_LOGIN = 'last-login';
public static IMEI_USER_DATA = "imei-user-data";
public static SERVEY_DATA = "survey-data";
public static ADS_DATA = "ads-data";
// private static user: AuthenticatedUser;
constructor(
public con: ConnectorService,
@ -756,6 +756,13 @@ export class AuthenticationService {
return this.con.post(AuthenticationService.saveSurveyAds, request, onError, errorLabel);
}
setViewAds(request, onError, errorLabel) {
request = this.authenticateRequest(request);
request.EmployeeNumber = request.UserName;
return this.con.post(AuthenticationService.setViewAdvertisement, request, onError, errorLabel);
}
//**************************//

@ -638,7 +638,7 @@ export class HomePage implements OnInit {
}
openNotificationsDashbored() {
this.DS.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
this.DS.getOpenNotifications('', '', false).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
const key = 'P_OPEN_NTF_NUMBER';
this.countAllNotification = result[key];
@ -788,7 +788,7 @@ export class HomePage implements OnInit {
offersDiscount() {
this.common.navigateForward('/offersdiscount/home');
}
openAnnouncement(){
openAnnouncement() {
this.common.openAnnouncement();
}
}

@ -33,12 +33,13 @@
<div class="container-icon" *ngIf="categories.length>0">
<div class="box-icon" *ngFor="let key of categories">
<div class="sale-icon" (click)="filterOffers(key)" [ngClass]="{'active':activeClass==key }">
<div class="sale-icon" (click)="filterOffers(key)" [ngClass]="{'active':activeClass==key.name }">
<div class="top">
<!-- <ion-icon name="images"></ion-icon> -->
<img [src]="key.icon" />
</div>
<div class="bottom-icon">
<p>{{key}}</p>
<p>{{key.name}}</p>
</div>
</div>
</div>
@ -65,7 +66,7 @@
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col>
<ion-col size="10">
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==false">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col>
<ion-col size="2" *ngIf="checkDate(item['End Date']) ==false">

@ -42,9 +42,9 @@
}
.sale-icon{
box-shadow: 1px 1px 5px 1px #cccc;
padding: 5px;
margin: 5px;
border-radius: 10px;
padding: 0px;
margin: 3px;
border-radius: 8px;
background: #fff;
position: relative;
}
@ -52,16 +52,18 @@
font-size: 25px;
}
.sale-icon p{
margin-top:5px;
margin-top: 5px;
margin-bottom: 5px;
text-transform: capitalize;
font-size: 15px;
font-size: 17px;
text-align: center;
}
.bottom-icon{
text-overflow: clip;
white-space: normal;
font-size: 14px;
padding: 4px;
padding:1px;
font-weight: bold;
}
ion-card{
@ -148,4 +150,10 @@ margin: 5px;
}
ion-content{
--background:#F5F5F5 ;
}
.top{
text-align: center;
}
.top img{
height:40px
}

@ -47,20 +47,36 @@ export class HomeComponent implements AfterViewInit {
if (data['data']) {
var parseJSON = data['data'];
var offers = JSON.parse(parseJSON)
this.categoriesObj = this.groupBy(offers, 'categoryName');
this.categories = Object.keys(this.categoriesObj);
this.categoriesObj = this.groupBy(offers, TranslatorService.getCurrentDirection() == 'ltr' ? 'categoryName_en' : 'categoryName_ar');
// = Object.keys(this.categoriesObj);
for (var x in this.categoriesObj) {
for (var y in offers) {
if (x == offers[y].categoryName_en && this.categories.filter(item => item.name.includes(x)) == false) {
this.categories.push({
name: x,
icon: offers[y].icon
})
}
}
}
this.filterOffers(this.categories[0]);
}
}
groupBy(xs, key) {
return xs.reduce((rv, x) => {
(rv[x[key]] = rv[x[key]] || []).push(x);
return rv;
(rv[x[key.trim()]] = rv[x[key]] || []).push(x);
return rv
}, {});
};
filterOffers(key) {
this.activeClass = key;
this.offersData = this.categoriesObj[key];
this.activeClass = key.name;
this.offersData = this.categoriesObj[key.name];
this.tempSearch = JSON.parse(JSON.stringify(this.offersData));
}
checkDate(date) {

@ -68,7 +68,7 @@
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col>
<ion-col size="10">
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==false">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col>
<ion-col size="2" *ngIf="checkDate(item['End Date']) ==false">

Loading…
Cancel
Save