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 retryTimes = 0;
public static timeOut = 120 * 1000; public static timeOut = 120 * 1000;
// public static host = 'https://uat.hmgwebservices.com/'; public static host = 'https://uat.hmgwebservices.com/';
public static host = 'https://hmgwebservices.com/'; // public static host = 'https://hmgwebservices.com/';
constructor(public httpClient: HttpClient, constructor(public httpClient: HttpClient,
public cs: CommonService, public cs: CommonService,

@ -30,6 +30,8 @@ export class WorklistMainService {
public static getPRNotificationBody = "Services/ERP.svc/REST/GET_PR_NOTIFICATION_BODY"; 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 getICNotificationBody = "Services/ERP.svc/REST/GET_ITEM_CREATION_NTF_BODY";
public static getBasicDetailNotificationBody = "Services/ERP.svc/REST/GET_BASIC_DET_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 getAddressNotificationBody = "Services/ERP.svc/REST/GET_ADDRESS_NOTIFICATION_BODY";
public static getPOItemHistory = "Services/ERP.svc/REST/GET_PO_ITEM_HISTORY"; public static getPOItemHistory = "Services/ERP.svc/REST/GET_PO_ITEM_HISTORY";
public static getMOItemHistory = "Services/ERP.svc/REST/GET_MO_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 getITGFormTaskCount = 'Services/COCWS.svc/REST/ITGGetTaskCountRequestType';
public static getITGFormTaskDetails = 'Services/COCWS.svc/REST/ITGFormsPendingTasks'; public static getITGFormTaskDetails = 'Services/COCWS.svc/REST/ITGFormsPendingTasks';
public static getITGFormDetails = 'Services/COCWS.svc/REST/ITGGetFormDetials'; 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( public getAddressNotificationBody(
WorkListBodyRequest: any, WorkListBodyRequest: any,
onError?: 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, HomeComponent.NOTIFICATION_DATA,
false false
); );
console.log('/////////////////////////////////////');
console.log(this.getPassNotificationDetails);
this.notificationArray = [] this.notificationArray = []
this.subordinatesleaveList = []; this.subordinatesleaveList = [];
@ -278,10 +280,30 @@ export class WorklistMainComponent implements OnInit {
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'ADDRESS') { } else if (this.getPassNotificationDetails.REQUEST_TYPE === 'ADDRESS') {
this.getAddressNotification(this.WorkListBodyObj); this.getAddressNotification(this.WorkListBodyObj);
} else if (this.getPassNotificationDetails.REQUEST_TYPE === 'BASIC_DETAILS') { } 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) { getBasicDetailsNotification(notificationBodyObj) {
this.worklistMainService this.worklistMainService
.getBasicDetailNotificationBody(notificationBodyObj) .getBasicDetailNotificationBody(notificationBodyObj)
@ -382,6 +404,20 @@ export class WorklistMainComponent implements OnInit {
console.log(result); 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 } //End handleWorkListBodyResult

@ -18,10 +18,11 @@
<ion-list> <ion-list>
<ion-item *ngFor="let data of notificationList"> <ion-item *ngFor="let data of notificationList">
<ion-label> <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 == 'ltr'" style="color: black; padding: 5px; font-size: 16px; font-family: 'Poppins'; padding-bottom: 10px;">{{data.ITEM_TYPE}}</p>
<p *ngIf="direction == 'rtl'" style="color: black; padding: 5px; font-size: 16px; font-family: 'Poppins'; padding-bottom: 10px;">{{data.nameAr}}</p>
</ion-label> </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> </ion-item>
<br> <br>
</ion-list> </ion-list>

@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular'; 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 { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { WorklistMainService } from '../service/work-list.main.service';
@Component({ @Component({
selector: 'app-worklist-setting', selector: 'app-worklist-setting',
@ -9,45 +11,32 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
}) })
export class WorklistSettingComponent implements OnInit { export class WorklistSettingComponent implements OnInit {
notificationList = [ 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
}
];
public direction: string; 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() { ngOnInit() {
this.direction = TranslatorService.getCurrentDirection(); this.direction = TranslatorService.getCurrentDirection();
// list.forEach(element => {
// this.notificationList.push(element);
// });
// console.log(this.notificationList);
} }

Loading…
Cancel
Save