diff --git a/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts b/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts index a90cb735..665b3992 100644 --- a/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts +++ b/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts @@ -186,7 +186,7 @@ export class AttendScanService { public updateFirebaseDocument(resultObject: any) { try { - let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document'); + let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document', false); let currentSwipeArray = currentFirebaseDocument.document.swipeData; if (currentSwipeArray) { currentSwipeArray.push(resultObject); @@ -200,7 +200,12 @@ export class AttendScanService { }; console.log(updatedDocument); this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => { - console.log("Successfully added document with id=" + this.userData.EMPLOYEE_NUMBER); + console.log("Successfully updated document with id = " + this.userData.EMPLOYEE_NUMBER); + const result = { + isDocumentAvailable: true, + document: updatedDocument + }; + this.common.sharedService.setSharedData(result, 'firebase-document'); }, (error) => { console.error("Error adding document: " + error); }); @@ -247,6 +252,11 @@ export class AttendScanService { }; this.firebasex.setDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, newDocument, this.collection, () => { console.log("Successfully added document"); + const result = { + isDocumentAvailable: true, + document: newDocument + }; + this.common.sharedService.setSharedData(result, 'firebase-document'); }, (error) => { console.error("Error adding document: "+error); }); 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 02c7bb9e..d6286590 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 @@ -119,21 +119,31 @@ - {{approvalInfo.Action}} --> + {{approvalInfo.Action}} - {{returnDateTime(approvalInfo.Date) }} - - - + + + + + + + + + + + diff --git a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.scss b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.scss index 7b9993ff..b8bf1e75 100644 --- a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.scss +++ b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.scss @@ -23,7 +23,7 @@ } .footer-btn-img{ max-width: none; - width: 60px; + width: 50px; } .timeline-item{ margin: 0; 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 f148197b..539e308d 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 @@ -105,8 +105,9 @@ export class WorkListMainItgComponent implements OnInit { this.segmentsArray[this.segmentsArray.length] = { name: 'Approval Level', number: this.segmentsArray.length }; this.segmentsArray = [this.segmentsArray[1], this.segmentsArray[2], this.segmentsArray[0]]; this.segmentData = [this.segmentData[1], this.segmentData[0]]; - // this.workList = this.request_details.WFHistory.reverse(); - this.workList = this.request_details.WFHistory; + this.workList = this.request_details.WFHistory.reverse(); + this.common.sharedService.setSharedData(this.workList, 'workflow-user'); + // this.workList = this.request_details.WFHistory; this.options = this.request_details.AllowedActions; this.activeSegment = this.segmentsArray[0].name; for (let i = 0; i < this.options.length; i++) { @@ -283,21 +284,21 @@ export class WorkListMainItgComponent implements OnInit { if (!comments) { this.common.presentAlert(this.ts.trPK('worklist', 'empty-comment')); } else { - this.workListService.getITGActionRequest(request, url) - .subscribe((result: any) => { - if (result.MessageStatus !== 1) { - this.common.presentAlert(this.ts.trPK('general', 'error-itg')); + this.workListService.getITGActionRequest(request, url) + .subscribe((result: any) => { + if (result.MessageStatus !== 1) { + this.common.presentAlert(this.ts.trPK('general', 'error-itg')); - } else if (result.MessageStatus === 1) { - setTimeout(() => { - this.messageSuccess = true; - this.common.sharedService.setSharedData(true, 'loadWorkList'); - this.confirmMsg(2); - this.skip(); - this.messageSuccess = false; - }, 2000); - } - }); + } else if (result.MessageStatus === 1) { + setTimeout(() => { + this.messageSuccess = true; + this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.confirmMsg(2); + this.skip(); + this.messageSuccess = false; + }, 2000); + } + }); } } else if (action === 3) {// request more info request.NewUserEMPId = this.replcamentID; @@ -459,7 +460,7 @@ export class WorkListMainItgComponent implements OnInit { } - selectAtion(actionSelected) { + selectAtion(actionSelected, info?) { this.actionSelected = actionSelected; if (this.actionSelected === 'Answer') { this.actionService(5, this.commentText); @@ -468,6 +469,7 @@ export class WorkListMainItgComponent implements OnInit { this.actionService(1, this.commentText); } if (this.actionSelected === 'Delegate') { + this.common.sharedService.setSharedData(info,'selectedEmpInfo'), this.presentModal(4); } if (this.actionSelected === 'Doable') { @@ -506,12 +508,14 @@ export class WorkListMainItgComponent implements OnInit { modal.cssClass = 'replaceRoll-modal'; modal.onDidDismiss() .then((data) => { - this.replcamentID = data.data.empData.USER_NAME; - this.commentText = data.data.comments; - if (actionNumber === 3) { - this.actionService(3, this.commentText); - } else if (actionNumber === 4) { - this.actionService(4); + if(data.data.empData){ + this.replcamentID = data.data.empData.USER_NAME ? data.data.empData.USER_NAME : data.data.empData.EmployeeID; + this.commentText = data.data.comments ? data.data.comments: null; + if (actionNumber === 3) { + this.actionService(3, this.commentText); + } else if (actionNumber === 4) { + this.actionService(4); + } } }); @@ -534,34 +538,47 @@ export class WorkListMainItgComponent implements OnInit { } } - returnDateTime(stringDate: string){ + returnDateTime(stringDate: string) { let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - let fullDate = this.transform(stringDate); + let dateArr= allDateTime[0].split('/') + let correctDate = dateArr[1]+'/'+dateArr[0]+'/'+dateArr[2]; + let fullDate = this.transform(correctDate); return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; - + } locale = { en: { - // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] } -}; + }; transform(value: string) { let x = new Date(Date.parse(value)); //return value.toLowerCase(); - let month = this.getMonthNameShort('en',x.getMonth()) - return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + let month = this.getMonthNameShort('en', x.getMonth()) + return "" + x.getDate() + " " + month + " " + x.getFullYear(); } - - - - getMonthNameShort(lang,month) { + getMonthNameShort(lang, month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -}; + } + + backgroundColor(statusName: string){ + // {'bg-blue-txt' : approvalInfo.Action === 'Submit','bg-red-txt': approvalInfo.Action == 'Not Doable' ,'bg-orange-txt' : approvalInfo.Action === 'Pending' ,'bg-red-txt' : approvalInfo.Action === 'Rejected','bg-green-txt' : approvalInfo.Action != 'Pending' && approvalInfo.Action != 'Rejected' && approvalInfo.Action != 'Submit'} + switch (statusName) { + case 'Submit': + return 'bg-blue-txt'; + case 'Pending': + return 'bg-orange-txt'; + case 'Not Doable' || 'Rejected': + return 'bg-red-txt'; + default: + return 'bg-green-txt'; + } + } } diff --git a/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.html b/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.html index bb4aa1b2..604ac00a 100644 --- a/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.html +++ b/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.html @@ -1,19 +1,19 @@ - - - {{ 'vacation-rule, search-employee' | translate}} - - - - - - - - - -
- - + {{ 'worklistMain, delegate' | translate}} + + + + + + + + + + + + - - - + + + + + {{'replacementRoll, searchBy' | translate}} + + + + + + +

{{'replacementRoll, workflow' | translate}}

+
+
+ + + +

{{'replacementRoll, favorite' | translate}}

+
+
+ + + +

{{'replacementRoll, employee-id' | translate}}

+
+
+ + + +

{{'replacementRoll, employee-email' | translate}}

+
+
+ + + +

{{'replacementRoll, employee-name' | translate}}

+
+
+
+
+ + + + + - - - - - - +
+ + +
+
- - -
-
+
{{'replacementRoll, search-result' | translate}}
-
- +
+ - - -
-
-
- - - - - - - {{employee.EMPLOYEE_DISPLAY_NAME}} - + + + + + + {{employee.EMPLOYEE_DISPLAY_NAME}} + - -
- -
-
+ +
+ +
+
- -
-
- -
-
+
+ + +
- {{'replacementRoll, favorite' | translate}} + {{'replacementRoll, related' | translate}}
+ +
+
+
+ + + + + + {{employee.Name}} + + +
+ +
+
+
+
+
+ -
-
-
- - - - - - {{employee.EMPLOYEE_DISPLAY_NAME}} - - -
- -
-
+ +
+
+ {{'replacementRoll, favorite' | translate}} +
+ +
+
+
+ + + + + + {{employee.EMPLOYEE_DISPLAY_NAME}} + + +
+ +
+
+
+
+ +
+ + + + +
Transaction Successful
+
-
- -
- - - -
Transaction Successful
-
- + + +
-
- - - - - -
-
+ + + +
+
- - - -
- {{'general, save' | translate}} - -
-
\ No newline at end of file + + + +
+ {{'general, save' | translate}} + +
+
+ {{'general, close' | translate}} + +
+
\ No newline at end of file diff --git a/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.scss b/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.scss index 58101d5d..9ea7dfa7 100644 --- a/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.scss +++ b/Mohem/src/app/notification/work-list-replacement-itg/work-list-replacement-itg.component.scss @@ -30,7 +30,7 @@ margin: 10px; } .star-fav-left{ - float: right; + float: left; margin: 10px 5px; } .uk-margin{margin: 15px 15px 0px 15px; @@ -64,4 +64,217 @@ } .top-radio-row{ font-size: 12px; - } \ No newline at end of file + } + + button.item-button.button.button-md.button-clear.button-clear-md { + background-color: transparent; + } + + .footer-button { + background: #dbdbdb; + border-radius: 10px; + color: black; + --background: transparent; + font-weight: bold; + width: 75%; + } + + // ion-item { + // margin-top: 5%; + // margin-right: 7%; + // width: 100%; + // } + .ionItem{ + border: #e4e4e4 solid; + /* margin: 6px; */ + /* padding: 11px; */ + height: 85px; + width: 164px; + border-radius: 5px; + text-align: center; + + } + + + .profileImageDiv{ + + z-index: 3; + position: relative; + top: 0; + + } + .profileImage{ + width:60px !important; + + } + + .activated{ + border: #209a83 0.02cm solid ; + } + .deactivated{ border: #e4e4e4 0.02cm solid; + } + .repContentDiv{ + text-align: center; + width: 85%; + font-size: 14px; + border: #e4e4e4 solid; + border-radius: 5px; + padding: 20px 8px 8px 8px; + margin-top: -9px; + margin-right: -35px + + } + .selIEmpDiv{ + text-align: right; + margin-bottom: -26px; + margin-right: 0px; + z-index: 3; + position: relative; + top: 0; + } + + .selIEmpImage{ + width:22px !important + + } + + .noteInput{ + border: solid var(--gray) 1px; + border-radius: 15px; + margin: 8px 17px 0px 17px; + padding: 10px 2px 10px 2px; + } + .filterInput{ + border: solid var(--gray) 1px; + border-radius: 21px; + padding-left: 10px !important; + } + + .filterInput-ar{ + // border: solid var(--gray) 1px; + // border-radius: 21px; + // padding-left: 10px !important; + border: solid var(--gray) 1px; + border-radius: 21px; + // width:250px + // padding-left: 145px !important; + //margin-left: 123px; + // padding-right: 129px; + //margin-right: -136px; + + } + .filterBtn{ + background: var(--newgreen); + --background: var (--newgreen); + border-radius: 50%; + height: 60px; + width: 60px; + } + .filterBtn-ar{ + // background: var(--newgreen); + // --background: var (--newgreen); + // border-radius: 50%; + // height: 60px; + // width: 60px; + background: var(--newgreen); + --background: var (--newgreen); + border-radius: 50%; + height: 60px; + width: 60px; + margin-left: -183px; + margin-right: 260px; + } + + + + *{ + box-sizing: border-box; + } + + .square-container{ + // padding: 8px; + width:100%; + } + .square{ + // width:calc(100% / 2); + width:100%; + float:left; + position: relative; + // padding-bottom: calc(100% / 2); + } + + .square .content{ + width: calc(100% - 16px) !important; + height: calc(100% - 16px) !important; + margin: 8px; + padding: 16px; + // position: absolute; + color: white; + border-radius: 9px; + text-align: center; + min-height: 92px; + // background-color: #0095ff; + // box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); + } + + .disabledButton{ + opacity:.5; + + } + + .radio-label{ + font-size: 9px; + margin: 4px; + position: relative; + bottom: 4px; + } + ion-radio{ + --color-checked: #269db8; + } + .center{text-align: center;padding: 5px;} + .boldTxtNav{ + font-weight: bold; + padding: 5px; + } + .employee-details{ + display:inline-block; + margin: 10px; + text-overflow: ellipsis; + white-space: nowrap; + width: 70%; + } + .empImgeRep{ + display: inline-block; + height: 40px; + width: 40px; + } + .star-fav{ + float: right; + margin: 15px 0px 0px 0px; + } + .uk-margin{margin: 15px 15px 0px 15px; + font-weight: bold; + clear: both; + position: relative; + top: 10px;} + .uk-padding{ padding: 20px;} + .uk-padding .employee-details{ + bottom: 10px; + position: relative;} + + // .star-fav-left{ + // float: left; + // margin: 10px 5px; + // } + .top-radio-row{ + font-size: 12px; + display: block; + padding-bottom: 25px; + padding-top: 15px; + } + .textSearchType{ + padding-top: 8px; + font-size: 12px; + } + + \ No newline at end of file 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 1f2fcd78..711d9aa8 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 @@ -33,19 +33,42 @@ export class WorkListReplacementItgComponent implements OnInit { userSelected: any; active: any; isAnswer: boolean = false; - favoriteUserList: [] = []; + favoriteUserList = []; userNote: any; + isFilter = true; + relatedList = []; public direction = ''; + arr = []; + delegtedEmp; constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, public worklistService: WorklistService, - public modalController: ModalController) { - this.direction = TranslatorService.getCurrentDirection(); - } + public modalController: ModalController) { + this.direction = TranslatorService.getCurrentDirection(); + console.log(this.direction); + } + + // async ionViewWillEnter() { + // await this.getFavruite(); + // } ngOnInit() { - this.getFavruite(); + this.delegtedEmp = this.cs.sharedService.getSharedData('selectedEmpInfo', true); + if (this.delegtedEmp === undefined) { + if (!this.relatedList || this.relatedList.length === 0 || this.relatedList === undefined) { + this.arr = this.cs.sharedService.getSharedData('workflow-user', false); + var lookupObject = {}; + for (var i in this.arr) { + lookupObject[this.arr[i]['Name']] = this.arr[i]; + } + for (i in lookupObject) { + this.relatedList.push(lookupObject[i]); + } + } + } else { + this.select(this.delegtedEmp, 1); + } } SearchReplacementList() { @@ -124,6 +147,7 @@ export class WorkListReplacementItgComponent implements OnInit { // } closePage() { + console.log(this.selEmp); this.isSave = true; let data: any = null; if (this.isSave == true) { @@ -145,12 +169,32 @@ export class WorkListReplacementItgComponent implements OnInit { } } + closeFunction() { + this.modalController.dismiss({ + 'dismissed': true, + // comments: this.userNote + }); + } + onChangeSelect(select) { - console.log(select.detail.value); let selectValue = select.detail.value; - - if (selectValue == "1" || selectValue == "2" || selectValue == "3") { + this.searchKey = ''; + if (selectValue == "1") { + this.listOfRealted = this.relatedList; + console.log(this.relatedList); + this.isSelect = true; + this.isFilter = true; + this.ReplacementList = []; + } else if (selectValue == "4") { + this.listOfFav = this.favoriteUserList; + this.isFilter = true; + this.ReplacementList = []; + if(this.favoriteUserList.length === 0 || this.favoriteUserList === undefined){ + this.getFavruite(); + } + } else if (selectValue === '2' || selectValue === '3' || selectValue === '5') { this.isSelect = true; + this.isFilter = false; } else { this.isSelect = false; @@ -170,11 +214,10 @@ export class WorkListReplacementItgComponent implements OnInit { }, 3000); } select(selectEmp, index) { - console.log(selectEmp.EMPLOYEE_DISPLAY_NAME); this.selEmp = selectEmp this.userSelected = true; this.active = index; - this.searchKey = selectEmp.EMPLOYEE_DISPLAY_NAME ? selectEmp.EMPLOYEE_DISPLAY_NAME : selectEmp.NAME; + this.searchKey = selectEmp.EMPLOYEE_DISPLAY_NAME ? selectEmp.EMPLOYEE_DISPLAY_NAME : selectEmp.Name; //this.closePage(); } @@ -241,7 +284,44 @@ export class WorkListReplacementItgComponent implements OnInit { if (this.cs.validResponse(result)) { this.cs.stopLoading(); this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; + console.log(this.favoriteUserList); } }) } + + listOfRealted = []; + listOfFav = [] + + filterList(event) { + const val = event.target.value; + if (this.searchKeySelect === '1') { + if (val === '') { + this.relatedList = this.listOfRealted; + } else { + this.relatedList = this.listOfRealted.filter((item) => { + return (item.Name.toLowerCase().indexOf(val.toLowerCase()) > -1); + }); + } + } else if (this.searchKeySelect === '4') { + if (val === '') { + this.favoriteUserList = this.listOfFav; + } else { + this.favoriteUserList = this.listOfFav.filter((item) => { + return (item.EMPLOYEE_DISPLAY_NAME.toLowerCase().indexOf(val.toLowerCase()) > -1); + }); + } + } else { + return; + } + } + isfavEmp(emp) { + let isEmp = this.favoriteUserList.find(elm => elm.USER_NAME === emp.EmployeeID); + return isEmp; + } + + saveBtnDisabled() { + if (!this.userNote || this.userNote === '') + return true; + else { return false; } + } } 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 ac841be6..09c18a12 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -1117,6 +1117,6 @@ export class WorklistMainComponent implements OnInit { getMonthNameShort(lang,month) { lang = lang && (lang in this.locale) ? lang : 'en'; return this.locale[lang].month_names_short[month]; -}; +} } diff --git a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.ts b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.ts index e745209a..20a253b7 100644 --- a/Mohem/src/app/offersdiscount/offer-details/offer-details.component.ts +++ b/Mohem/src/app/offersdiscount/offer-details/offer-details.component.ts @@ -36,9 +36,12 @@ export class OfferDetailsComponent implements OnInit { } share() { console.log(this.details); + const offerMessage = this.direction === 'ltr' ? this.details.Description : this.details.Description_AR; + const offerSubject = this.direction === 'ltr' ? this.details.Title : this.details.Title_AR; + const options = { - message: this.stripHtml(this.details.Description), - subject: this.stripHtml(this.details.Title), + message: this.stripHtml(offerMessage), + subject: this.stripHtml(offerSubject), files: [this.details.Banner_Image] } this.socialSharing.shareWithOptions(options).then((result) => {