diff --git a/Mohem/src/app/authentication/sms-page/sms-page.page.ts b/Mohem/src/app/authentication/sms-page/sms-page.page.ts index 0bc5507f..a0ccea26 100644 --- a/Mohem/src/app/authentication/sms-page/sms-page.page.ts +++ b/Mohem/src/app/authentication/sms-page/sms-page.page.ts @@ -96,7 +96,7 @@ export class SmsPageComponent implements OnInit { initTimer() { if (!this.timeInSeconds) { - this.timeInSeconds = 600; + this.timeInSeconds = 120; } this.time = this.timeInSeconds; this.runTimer = false; diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index a9f6cf0d..738456eb 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1216,6 +1216,9 @@ export class CommonService { public openWorklistMainPage() { this.nav.navigateForward(['/notification/worklist-main']); } + public openWorklistSettingsPage() { + this.nav.navigateForward(['/notification/worklist-settings']); + } public openWorklistMainPRPage() { this.nav.navigateForward(['/notification/worklist-main-PR']); } diff --git a/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.ts b/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.ts index 6589c50d..04758300 100644 --- a/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.ts +++ b/Mohem/src/app/hmg-common/ui/generic-header/generic-header.component.ts @@ -41,11 +41,12 @@ export class GenericHeaderComponent implements OnInit { } async openNotifictionSetting() { - const modal = await this.modalController.create({ - component: WorklistSettingComponent, - cssClass: 'app-update-modal-css', - }); - return await modal.present(); + // const modal = await this.modalController.create({ + // component: WorklistSettingComponent, + // cssClass: 'app-update-modal-css', + // }); + // return await modal.present(); + this.common.openWorklistSettingsPage(); } } diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 13add5f0..c26fd2c5 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -638,33 +638,35 @@ export class HomeComponent implements OnInit { this.ITGItem = []; this.workListService.getITGCount('', '', this.isPostNoLoad) .subscribe((result: any) => { - if (result.RequestType.length > 0) { - this.ITGSegment[0] = { - name: 'All', - code: 'All', - data: null, - style: false - }; - this.ITGSegment[0].data = datas; - this.ITGSegment[0].names = names; - this.setActive(this.ITGSegment[0].code); - } - console.log(result.RequestType); - let count = 1; - for (let i = 0; i < result.RequestType.length; i++) { - console.log() - this.ITGSegment[count] = { - name: result.RequestType[i].RequestTypeName, - code: result.RequestType[i].RequestTypeCode, - data: result.RequestType[i].RequestDetails, - style: false - }; - datas[i] = result.RequestType[i].RequestDetails; - names[i] = result.RequestType[i].RequestTypeCode; - count++; + if (result.RequestType) { + if (result.RequestType.length > 0) { + this.ITGSegment[0] = { + name: 'All', + code: 'All', + data: null, + style: false + }; + this.ITGSegment[0].data = datas; + this.ITGSegment[0].names = names; + this.setActive(this.ITGSegment[0].code); + } + console.log(result.RequestType); + let count = 1; + for (let i = 0; i < result.RequestType.length; i++) { + console.log() + this.ITGSegment[count] = { + name: result.RequestType[i].RequestTypeName, + code: result.RequestType[i].RequestTypeCode, + data: result.RequestType[i].RequestDetails, + style: false + }; + datas[i] = result.RequestType[i].RequestDetails; + names[i] = result.RequestType[i].RequestTypeCode; + count++; + } + //this.sortArrayOfAll(this.ITGSegment[0].data) + console.log(this.ITGSegment); } - //this.sortArrayOfAll(this.ITGSegment[0].data) - console.log(this.ITGSegment); }); } diff --git a/Mohem/src/app/notification/models/userItemTypeRequest.ts b/Mohem/src/app/notification/models/userItemTypeRequest.ts new file mode 100644 index 00000000..d6c934a2 --- /dev/null +++ b/Mohem/src/app/notification/models/userItemTypeRequest.ts @@ -0,0 +1,6 @@ +export class UserItemTypes extends Request { + public P_ITEM_TYPE: string; + public P_FYA_ENABLED_FALG: string; + public P_FYI_ENABLED_FLAG: string; + public ItemID: number; +} \ No newline at end of file diff --git a/Mohem/src/app/notification/notification.module.ts b/Mohem/src/app/notification/notification.module.ts index d9b5da73..8364c21c 100644 --- a/Mohem/src/app/notification/notification.module.ts +++ b/Mohem/src/app/notification/notification.module.ts @@ -32,6 +32,7 @@ import { MoreActionModalComponent } from './more-action-modal/more-action-modal. import { WorkListReplacementItgComponent } from './work-list-replacement-itg/work-list-replacement-itg.component'; import { MoItemHistoryComponent } from './mo-item-history/mo-item-history.component'; import { WorklistMainIcComponent } from './worklist-main-ic/worklist-main-ic.component'; +import { WorklistSettingComponent } from './worklist-setting/worklist-setting.component'; const routes: Routes = [ @@ -123,6 +124,10 @@ const routes: Routes = [ { path: 'item-creation-IC', component: WorklistMainIcComponent + }, + { + path: 'worklist-settings', + component: WorklistSettingComponent } ] } diff --git a/Mohem/src/app/notification/service/work-list.main.service.ts b/Mohem/src/app/notification/service/work-list.main.service.ts index a68047d4..c3badf4c 100644 --- a/Mohem/src/app/notification/service/work-list.main.service.ts +++ b/Mohem/src/app/notification/service/work-list.main.service.ts @@ -20,6 +20,7 @@ import { QuotationAnalysisResponse } from '../models/quotationAnalysisRes'; import { Request } from 'src/app/hmg-common/services/models/request'; import { LoginModel } from '../../authentication/models/LoginModel'; import { itgRequest } from '../models/itgFormDetailsRequest'; +import { UserItemTypes } from "../models/userItemTypeRequest"; @Injectable() export class WorklistMainService { @@ -30,6 +31,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 +44,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 +129,36 @@ export class WorklistMainService { ); } + public getStampMSNotificationBody( + WorkListBodyRequest: any, + onError?: any, + errorLabel?: string + ): Observable { + 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 { + const request = WorkListBodyRequest; + this.authService.authenticateRequest(request); + return this.api.post( + WorklistMainService.getStampNSNotificationBody, + request, + onError, + errorLabel + ); + } + public getAddressNotificationBody( WorkListBodyRequest: any, onError?: any, @@ -346,4 +381,32 @@ export class WorklistMainService { } + public getWorklistNotifications( + onError?: any, + errorLabel?: string + ): Observable { + const request = new Request(); + this.authService.authenticateRequest(request); + return this.api.post( + WorklistMainService.getWorklistNotificationURL, + request, + onError, + errorLabel + ); + } + + public updateWorklistNotifications( + requestData: any, + onError?: any, + errorLabel?: string + ): Observable { + this.authService.authenticateRequest(requestData); + return this.api.post( + WorklistMainService.updateWorklistNotificationURL, + requestData, + onError, + errorLabel + ); + } + } diff --git a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.html b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.html index d6286590..e7dec45b 100644 --- a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.html +++ b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.html @@ -112,10 +112,15 @@
- -
+
Note: {{approvalInfo.Notes}}
+
+ Note: {{approvalInfo.Notes}} +
+
diff --git a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts index 6ebede5e..681ea344 100644 --- a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts +++ b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts @@ -62,6 +62,7 @@ export class WorkListMainItgComponent implements OnInit { defaultSegment = ''; public slideIndex = 0; public messageSuccess = false; + public actionHistory = false; constructor( public common: CommonService, public ts: TranslatorService, @@ -271,13 +272,16 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(1); this.skip(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } else if (action === 2) {// reject @@ -291,13 +295,16 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = true; + // this.messageSuccess = true; this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(2); this.skip(); - this.messageSuccess = false; + // this.messageSuccess = false; }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } @@ -315,15 +322,18 @@ export class WorkListMainItgComponent implements OnInit { } if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ')); this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(3); this.skip(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } @@ -336,15 +346,18 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ')); this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(4); this.skip(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } else if (action === 5) { // answer @@ -358,15 +371,18 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ')); this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(5); this.skip(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } @@ -383,15 +399,18 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ')); this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(6); this.skip(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } else { @@ -409,15 +428,18 @@ export class WorkListMainItgComponent implements OnInit { this.common.presentAlert(this.ts.trPK('general', 'error-itg')); } else if (result.MessageStatus === 1) { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.common.sharedService.setSharedData(true, 'loadWorkList'); // this.common.presentAlert(this.ts.trPK('worklistMain', 'Tran_Succ')); this.common.sharedService.setSharedData(true, 'loadWorkList'); this.confirmMsg(6); this.skip(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); } else { diff --git a/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.ts b/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.ts index bd1ab765..42910539 100644 --- a/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.ts +++ b/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.ts @@ -68,7 +68,7 @@ export class WorkListReplacementItgComponent implements OnInit { this.relatedList.push(lookupObject[i]); } } - this.getFavruite(); + // this.getFavruite(); } else { this.select(this.delegtedEmp, 1); } @@ -164,9 +164,11 @@ export class WorkListReplacementItgComponent implements OnInit { if (this.isSave == true) { if (this.selEmp) { data = this.selEmp; - this.messageSuccess = true; + // this.messageSuccess = true; + this.cs.greenToastPK('worklist', 'save-successfully'); } else { data = null; + this.cs.redToastPK('worklist', 'save-error'); } if (typeof this.callback == 'function') { this.callback(data); diff --git a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts index f39e81c2..d2ddf81b 100644 --- a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts +++ b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts @@ -53,7 +53,7 @@ export class WorkListReplacementRollComponent implements OnInit { this.P_PAGE_NUM = 1; this.P_PAGE_LIMIT = 50; this.getPassActionMode = this.cs.sharedService.getSharedData('passActionMode', false); - this.getFavruite(); + // this.getFavruite(); this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo', false); this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr', false); this.pQuestion = this.cs.sharedService.getSharedData('pQuestion', false); @@ -489,8 +489,13 @@ export class WorkListReplacementRollComponent implements OnInit { // } } getPlaceHolder() { - return this.searchBy == '1' ? this.ts.trPK('replacementRoll', 'searchbyname') : this.searchBy == '2' ? this.ts.trPK('replacementRoll', 'searchbyusername') : this.ts.trPK('replacementRoll', 'searchbyemail'); + return this.searchBy === '1' ? + this.ts.trPK('replacementRoll', 'searchbyname') : + this.searchBy === '2' ? + this.ts.trPK('replacementRoll', 'searchbyusername') : + this.ts.trPK('replacementRoll', 'searchbyemail'); } + getFavruite() { this.cs.startLoading(); this.worklistService.getFavorite({}, () => { @@ -503,20 +508,10 @@ export class WorkListReplacementRollComponent implements OnInit { this.favoriteUserList.forEach((obj) => { obj.IsFavorite = true; }); - /**** THIS CODE TO CHECK STAR OF EMPLOYEE IF IT IS IN FAVORITE LIST AND SHOW IN WORKFLOW LIST****/ - // this.actionHistory.forEach((obj, i) => { - // if(this.favoriteUserList.some(x => x['USER_NAME'] === obj.USER_NAME)) { - // this.actionHistory[i].isInFavorite = true; - // } else { - // this.actionHistory[i].isInFavorite = false; - // } - // }); - // console.log(this.actionHistory); - /**** END ****/ - } }); } + saveUserFavruiteList(request, isFav: boolean) { this.worklistService.saveFavoriteList(request, () => { }).subscribe((result) => { diff --git a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts index f5c2abec..09a818f3 100644 --- a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts +++ b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts @@ -427,12 +427,15 @@ export class WorklistMainIcComponent implements OnInit { // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { this.common.sharedService.setSharedData(true, 'loadWorkList'); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; // this.openNotificationsDashboard(); this.nextNotfification(); }, 5000); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -1210,13 +1213,16 @@ export class WorklistMainIcComponent implements OnInit { return; } else if (data.data.data == "Success") { // this.openNotificationsDashboard(); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.nextNotfification(); }, 2000); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts index c64765f5..b481ea5f 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts @@ -368,12 +368,15 @@ export class WorklistMainMRComponent implements OnInit { // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { this.common.sharedService.setSharedData(true, 'loadWorkList'); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; // this.openNotificationsDashboard(); this.nextNotfification(); }, 5000); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -1111,13 +1114,16 @@ export class WorklistMainMRComponent implements OnInit { return; } else if (data.data.data == 'Success') { // this.openNotificationsDashboard(); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.nextNotfification(); }, 2000); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); diff --git a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts index 844f3af6..f0dcf22c 100644 --- a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts +++ b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts @@ -404,12 +404,15 @@ export class WorklistMainPoComponent implements OnInit { // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { this.common.sharedService.setSharedData(true, 'loadWorkList'); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; // this.openNotificationsDashboard(); this.nextNotfification(); }, 5000); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -1187,9 +1190,11 @@ export class WorklistMainPoComponent implements OnInit { return; } else if (data.data.data == "Success") { // this.openNotificationsDashboard(); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; + this.common.redToastPK('worklist', 'save-error'); this.nextNotfification(); }, 2000); // this.nextNotfification(); diff --git a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts index 83f68c84..71b038cc 100644 --- a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts +++ b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts @@ -394,13 +394,16 @@ export class WorklistMainPRComponent implements OnInit { // tslint:disable-next-line: triple-equals if (result.MessageStatus == 1) { this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.greenToastPK('worklist', 'save-successfully'); // show succsfull popup - this.messageSuccess = true; - setTimeout(() => { - this.messageSuccess = false; - }, 5000); + // this.messageSuccess = true; + // setTimeout(() => { + // this.messageSuccess = false; + // }, 5000); // this.openNotificationsDashboard(); this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -1111,13 +1114,16 @@ export class WorklistMainPRComponent implements OnInit { return; } else if (data.data.data == 'Success') { // this.openNotificationsDashboard(); - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.nextNotfification(); }, 2000); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.html b/Mohem/src/app/notification/worklist-main/worklist-main.component.html index 0d6073b6..e633778a 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.html +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.html @@ -49,7 +49,19 @@ -
+ +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
+ +
@@ -68,6 +80,165 @@
+ +
+ + +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+
+
+
+ +
+ + +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ + +
+ + +
+ + +
+ + +
+
+
+
+ + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+
+
+
+
+
+
+
{{ts.trPK('worklistMain','employee-on-leave')}} @@ -123,6 +294,14 @@ +
+

{{'worklist, loading'| translate}}

+
+ +
+

{{ 'general, empty' | translate}}

+
@@ -139,7 +318,7 @@ - + diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.scss b/Mohem/src/app/notification/worklist-main/worklist-main.component.scss index a60545fb..31893558 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.scss +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.scss @@ -137,6 +137,15 @@ border-radius: 10px; margin: 10px; } + + .no-data-div{ + background: #ffffff; + height: 100%; + text-align: center; + padding-top: 1px; + border-radius: 10px; + margin: 10px; + } .container { font-size: 14px; diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts index 8212c4fe..841d91d0 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -53,6 +53,8 @@ export class WorklistMainComponent implements OnInit { public static PASS_RES_ATTR = "passResAttr"; TransactionID: number = -999; notificationBodyRes: any = []; + stampNsNotificationBodyRes: any =[]; + stampMsNotificationBodyRes: any =[]; actionHistoryRes: any = []; notificationButtonRes: any; actionMode: any; @@ -108,6 +110,8 @@ export class WorklistMainComponent implements OnInit { closeDis: boolean = false; public selectedFilter: string; public arr_hr_req_only = []; + public showInformation = true; + constructor( public worklistService: WorklistService, @@ -210,6 +214,8 @@ export class WorklistMainComponent implements OnInit { HomeComponent.NOTIFICATION_DATA, false ); + console.log('/////////////////////////////////////'); + console.log(this.getPassNotificationDetails); this.notificationArray = [] this.subordinatesleaveList = []; @@ -277,10 +283,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) @@ -337,7 +363,7 @@ export class WorklistMainComponent implements OnInit { } handleWorkListBodyResult(result, Type) { - + this.showInformation = false; if (this.common.validResponse(result)) { this.pInformation = result.P_INFORMATION; this.pQuestion = result.P_QUESTION; @@ -381,6 +407,20 @@ export class WorklistMainComponent implements OnInit { console.log(result); } } + else if (Type === "STAMP_MS"){ + if (result.GetStampMsNotificationBodyList) { + this.stampMsNotificationBodyRes = + result.GetStampMsNotificationBodyList; + console.log(result); + } + } + else if (Type === "STAMP_NS"){ + if (result.GetStampNsNotificationBodyList) { + this.stampNsNotificationBodyRes = + result.GetStampNsNotificationBodyList; + console.log(result); + } + } } } //End handleWorkListBodyResult @@ -449,12 +489,15 @@ export class WorklistMainComponent implements OnInit { // this.notificationArray.splice(i, 1); // } // } - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; // this.openNotificationsDashboard(); this.nextNotfification(); }, 2000); + } else { + this.common.redToastPK('worklist', 'save-error'); } } // valid it } @@ -1029,12 +1072,15 @@ export class WorklistMainComponent implements OnInit { if (data.data.data == "cancel" || data.data.data == undefined) { return; } else if (data.data.data == "Success") { - this.messageSuccess = true; + // this.messageSuccess = true; + this.common.greenToastPK('worklist', 'save-successfully'); setTimeout(() => { - this.messageSuccess = false; + // this.messageSuccess = false; this.nextNotfification(); }, 2000); // this.nextNotfification(); + } else { + this.common.redToastPK('worklist', 'save-error'); } }); return await modal.present(); @@ -1149,7 +1195,6 @@ export class WorklistMainComponent implements OnInit { } - @@ -1158,4 +1203,12 @@ export class WorklistMainComponent implements OnInit { return this.locale[lang].month_names_short[month]; } +showLoading( notificationList ) { + if (notificationList.length < 0) { + return true; + } else if (notificationList === []){ + return false; + } else {return true;} +} + } diff --git a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.html b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.html index 93b94944..9f1ef3f6 100644 --- a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.html +++ b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.html @@ -16,17 +16,26 @@
+ + +

item type

+
+

FYA

+          +

FYI

+
-

{{data.nameEn}}

-

{{data.nameAr}}

+

{{data.ITEM_TYPE}}

- + +     +

- {{ 'worklist, save-changes' | translate}} + {{ 'worklist, save-changes' | translate}} \ No newline at end of file diff --git a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts index 3280ecfd..1521d3e6 100644 --- a/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts +++ b/Mohem/src/app/notification/worklist-setting/worklist-setting.component.ts @@ -1,6 +1,9 @@ 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 { UserItemTypes } from '../models/userItemTypeRequest'; +import { WorklistMainService } from '../service/work-list.main.service'; @Component({ selector: 'app-worklist-setting', @@ -8,53 +11,76 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl styleUrls: ['./worklist-setting.component.scss'], }) 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 = []; + request = []; + isChange = false; public direction: string; - constructor(public modalController: ModalController, public ts: TranslatorService) { } + constructor( + public modalController: ModalController, + public ts: TranslatorService, + public common: CommonService, + public workListService: WorklistMainService) {} + ngOnInit() { this.direction = TranslatorService.getCurrentDirection(); + this.workListService.getWorklistNotifications() + .subscribe((result: any) => { + this.notificationList = result.GetUserItemTypesList; + for (let i = 0; i < this.notificationList.length; i++) { + this.request[i] = { + P_FYA_ENABLED_FALG: this.notificationList[i].FYA_ENABLED_FALG, + P_FYI_ENABLED_FLAG: this.notificationList[i].FYI_ENABLED_FLAG, + P_ITEM_TYPE: this.notificationList[i].ITEM_TYPE, + ItemID: i + }; + } + }); } + chnageToggle(toggleValue, type, val) { + if ( val === 'Y') { + val = 'N'; + } else if ( val === 'N') { + val = 'Y'; + } + this.notificationList.forEach((el, index) => { + if ( el.ITEM_TYPE === toggleValue.ITEM_TYPE) { + if (type === 'FYI') { + this.request[index].P_FYI_ENABLED_FLAG = val; + } else if (type === 'FYA') { + this.request[index].P_FYA_ENABLED_FALG = val; + } + this.request[index].ItemID = index; + } + this.request[index].P_ITEM_TYPE = el.ITEM_TYPE; + }); + } - dismiss() { - this.modalController.dismiss({ - 'dismissed': true + saveChanges() { + const body = { + UpdateItemTypeList: this.request + }; + this.workListService.updateWorklistNotifications(body) + .subscribe((result: any) => { + if (result.UpdateItemTypeSuccessList) { + if (result.UpdateUserItemTypesList) { + this.common.greenToastPK('worklist', 'save-successfully'); + this.dismiss(); + } else { + this.common.redToastPK('worklist', 'save-error'); + } + } else { + this.common.redToastPK('worklist', 'save-error'); + } }); } + public dismiss() { + this.common.sharedService.setSharedData(false, 'loadWorkList'); + this.common.back(); + } } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 24bbab1f..89df168a 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -2582,6 +2582,26 @@ "save-changes": { "en": "Save Changes", "ar": "حفظ التغيرات" + }, + "loading": { + "en": "Loading", + "ar": "يتم التحميل" + }, + "save-successfully": { + "ar": "تم حفظ التغيير بنجاح", + "en": "Your change has been saved successfully" + }, + "save-error": { + "ar": "هناك شئ خاطئ، يرجى المحاولة فى وقت لاحق", + "en": "Something went wrong please try again later" + }, + "assignment-number": { + "ar": "رقم التخصيص ", + "en": "Assignment Number" + }, + "schedule-date": { + "ar": "تاريخ الجدول", + "en": "Schedule Date" } }, "worklistMain": {