add service for worklist notification and STAMP

MOHEMM-Q3-DEV-LATEST
enadhilal 4 years ago
parent eee3f27cec
commit d5dfc27004

@ -27,8 +27,8 @@ export class ConnectorService {
public static retryTimes = 0;
public static timeOut = 120 * 1000;
// public static host = 'https://uat.hmgwebservices.com/';
public static host = 'https://hmgwebservices.com/';
public static host = 'https://uat.hmgwebservices.com/';
// public static host = 'https://hmgwebservices.com/';
constructor(public httpClient: HttpClient,
public cs: CommonService,

@ -30,6 +30,8 @@ export class WorklistMainService {
public static getPRNotificationBody = "Services/ERP.svc/REST/GET_PR_NOTIFICATION_BODY";
public static getICNotificationBody = "Services/ERP.svc/REST/GET_ITEM_CREATION_NTF_BODY";
public static getBasicDetailNotificationBody = "Services/ERP.svc/REST/GET_BASIC_DET_NTF_BODY";
public static getStampMSNotificationBody = "Services/ERP.svc/REST/GET_STAMP_MS_NOTIFICATION_BODY";
public static getStampNSNotificationBody = "Services/ERP.svc/REST/GET_STAMP_NS_NOTIFICATION_BODY";
public static getAddressNotificationBody = "Services/ERP.svc/REST/GET_ADDRESS_NOTIFICATION_BODY";
public static getPOItemHistory = "Services/ERP.svc/REST/GET_PO_ITEM_HISTORY";
public static getMOItemHistory = "Services/ERP.svc/REST/GET_MO_ITEM_HISTORY";
@ -41,6 +43,8 @@ export class WorklistMainService {
public static getITGFormTaskCount = 'Services/COCWS.svc/REST/ITGGetTaskCountRequestType';
public static getITGFormTaskDetails = 'Services/COCWS.svc/REST/ITGFormsPendingTasks';
public static getITGFormDetails = 'Services/COCWS.svc/REST/ITGGetFormDetials';
public static getWorklistNotificationURL = 'Services/ERP.svc/REST/GET_USER_ITEM_TYPES';
public static updateWorklistNotificationURL = 'Services/ERP.svc/REST/UPDATE_USER_ITEM_TYPES';
@ -124,6 +128,36 @@ export class WorklistMainService {
);
}
public getStampMSNotificationBody(
WorkListBodyRequest: any,
onError?: any,
errorLabel?: string
): Observable<PRNotificatonBodyResponse> {
const request = WorkListBodyRequest;
this.authService.authenticateRequest(request);
return this.api.post(
WorklistMainService.getStampMSNotificationBody,
request,
onError,
errorLabel
);
}
public getStampNSNotificationBody(
WorkListBodyRequest: any,
onError?: any,
errorLabel?: string
): Observable<PRNotificatonBodyResponse> {
const request = WorkListBodyRequest;
this.authService.authenticateRequest(request);
return this.api.post(
WorklistMainService.getStampNSNotificationBody,
request,
onError,
errorLabel
);
}
public getAddressNotificationBody(
WorkListBodyRequest: any,
onError?: any,
@ -346,4 +380,33 @@ export class WorklistMainService {
}
public getWorklistNotifications(
onError?: any,
errorLabel?: string
): Observable<any> {
const request = new Request();
this.authService.authenticateRequest(request);
return this.api.post(
WorklistMainService.getWorklistNotificationURL,
request,
onError,
errorLabel
);
}
public updateWorklistNotifications(
onError?: any,
errorLabel?: string
): Observable<any> {
const request = new Request();
this.authService.authenticateRequest(request);
return this.api.post(
WorklistMainService.updateWorklistNotificationURL,
request,
onError,
errorLabel
);
}
}

@ -211,6 +211,8 @@ export class WorklistMainComponent implements OnInit {
HomeComponent.NOTIFICATION_DATA,
false
);
console.log('/////////////////////////////////////');
console.log(this.getPassNotificationDetails);
this.notificationArray = []
this.subordinatesleaveList = [];
@ -278,10 +280,30 @@ export class WorklistMainComponent implements OnInit {
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'ADDRESS') {
this.getAddressNotification(this.WorkListBodyObj);
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'BASIC_DETAILS') {
this.getBasicDetailsNotification(this.WorkListBodyObj)
this.getBasicDetailsNotification(this.WorkListBodyObj);
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'STAMP_MS') {
this.getStampMSNotification(this.WorkListBodyObj);
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'STAMP_NS') {
this.getStampNSNotification(this.WorkListBodyObj);
}
}
getStampMSNotification(notificationBodyObj) {
this.worklistMainService
.getStampMSNotificationBody(notificationBodyObj)
.subscribe((result: PRNotificatonBodyResponse) => {
this.handleWorkListBodyResult(result, "STAMP_MS");
});
}
getStampNSNotification(notificationBodyObj) {
this.worklistMainService
.getStampNSNotificationBody(notificationBodyObj)
.subscribe((result: PRNotificatonBodyResponse) => {
this.handleWorkListBodyResult(result, "STAMP_NS");
});
}
getBasicDetailsNotification(notificationBodyObj) {
this.worklistMainService
.getBasicDetailNotificationBody(notificationBodyObj)
@ -382,6 +404,20 @@ export class WorklistMainComponent implements OnInit {
console.log(result);
}
}
else if (Type === "STAMP_MS"){
if (result.GetBasicDetNtfBodyList) {
this.notificationBodyRes =
result.GetStampMsNotificationBodyList;
console.log(result);
}
}
else if (Type === "STAMP_NS"){
if (result.GetBasicDetNtfBodyList) {
this.notificationBodyRes =
result.GetStampNsNotificationBodyList;
console.log(result);
}
}
}
} //End handleWorkListBodyResult

@ -18,10 +18,11 @@
<ion-list>
<ion-item *ngFor="let data of notificationList">
<ion-label>
<p *ngIf="direction == 'ltr'" style="color: black; padding: 5px; font-size: 16px; font-family: 'Poppins'; padding-bottom: 10px;">{{data.nameEn}}</p>
<p *ngIf="direction == 'rtl'" style="color: black; padding: 5px; font-size: 16px; font-family: 'Poppins'; padding-bottom: 10px;">{{data.nameAr}}</p>
<p *ngIf="direction == 'ltr'" style="color: black; padding: 5px; font-size: 16px; font-family: 'Poppins'; padding-bottom: 10px;">{{data.ITEM_TYPE}}</p>
</ion-label>
<ion-toggle [checked]="data.isChecked"></ion-toggle>
<ion-toggle (onchange)="chnageToggle()" [checked]="data.FYA_ENABLED_FALG === 'Y'"></ion-toggle>
&nbsp;&nbsp;&nbsp;
<ion-toggle (onchange)="chnageToggle()" [checked]="data.FYI_ENABLED_FLAG === 'Y'"></ion-toggle>
</ion-item>
<br>
</ion-list>

@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { WorklistMainService } from '../service/work-list.main.service';
@Component({
selector: 'app-worklist-setting',
@ -9,45 +11,32 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
})
export class WorklistSettingComponent implements OnInit {
notificationList = [
{
id: 0,
nameEn: "Human Resource (HR)",
nameAr: "الموارد البشرية (HR)",
isChecked: false
},
{
id: 1,
nameEn: "Purchase Order (PO)",
nameAr: "امر شراء (PO)",
isChecked: false
},
{
id: 2,
nameEn: "Purchase Requesr (PR)",
nameAr: "طلب شراء (PR)",
isChecked: false
},
{
id: 3,
nameEn: "Move Request (MR)",
nameAr: "طلب نقل (MR)",
isChecked: false
},
{
id: 4,
nameEn: "Item Creation (IC)",
nameAr: "انشاء عنصر (IC)",
isChecked: false
}
];
notificationList = [];
public direction: string;
constructor(public modalController: ModalController, public ts: TranslatorService) { }
constructor(
public modalController: ModalController,
public ts: TranslatorService,
public common: CommonService,
public workListService: WorklistMainService,) { }
ionViewWillEnter() {
this.workListService.getWorklistNotifications()
.subscribe((result: any) => {
result.GetUserItemTypesList.forEach(element => {
this.notificationList.push(element);
});
});
}
ngOnInit() {
this.direction = TranslatorService.getCurrentDirection();
// list.forEach(element => {
// this.notificationList.push(element);
// });
// console.log(this.notificationList);
}

Loading…
Cancel
Save